Lỗi font chữ trong visual studio 2023 fontfamily

Visual studio code (VSC) đang là một trong những text editor được ưa chuộng nhất bởi nó kế thừa được các điểm mạnh của các editors khác như Sublime Text, Vim,... và có những tính năng rất tuyệt vời của riêng mình. Tuy vẫn còn một số điểm yếu về tốc độ (khi so với Sublime Text hoặc Vim), nhưng những tiện ích mà VScode mang lại vẫn khiến nó là lựa chọn gần như tốt nhất cho các lập trình viên hiện nay. Mình đã từng sử dụng qua khá nhiều những text editors và ide như Sublime, Vim, Atom hay Webstorm, chúng đều là những công cụ rất mạnh mẽ, nhưng lại tồn tại những khuyết điểm mà mình khá khó chấp nhận: Sublime nhanh nhưng khả năng hỗ trợ các ngôn ngữ hiện đại chưa tốt và có vẻ ít phát triển thêm, Vim thì hơi khó dùng, Atom thì mình cảm giác hơi chậm, Webstorm khiến mình hài lòng nhất nhưng lại phải crack :v. Vscode chính là text editors có thể khác phục những điều đó và ngày hôm nay, mình sẽ cùng với các bạn cài đặt và cấu hình vscode để có thể làm việc với nó một cách thoải mái nhất. Let's start!

Cài đặt

Theo mình biết thì hiện tại, VSC đã hỗ trợ đầy đủ các hệ điều hành phổ biến như Linux, Windows, Mac, ở đây, mình đang dùng hệ điều hành Linux nên sẽ minh họa quá trình cài đặt trên hệ điều hành này, quá trình cài đặt trên hệ điều hành khác cũng tuơng tự

  1. Đầu tiên các bạn vào trang chủ của vscode: https://code.visualstudio.com/
  2. Click vào nút download bản .deb (đối với các hệ điều hành như Fedora, các bạn download .rpm)
  3. Download xong, các bạn cd vào thư mục chứa file .deb vừa tải và chạy lệnh sudo dpkg -i .deb
  4. Đợi quá trình cài đặt hoàn tất Vậy là xong! Chúng ta có thể sử dụng vscode được rồi
    Lỗi font chữ trong visual studio 2023 fontfamily

Các cấu hình cơ bản

Mặc định, khi cài xong, vscode đã rất đầy đủ chức năng rồi và bạn có thể code luôn. Tuy nhiên, đối với một đứa (khá) lười và thích ide đẹp như mình (và hi vọng các bạn cũng thế) thì có khá nhiều việc phải làm. Mình sẽ list ra các đầu việc sau đây để chúng ta có thể hình dung được những bước cần làm:

  • Thiết lập font
  • Thiết lập về caret (là con trỏ lúc gõ văn bản)
  • Các thiết lập chung khác

Thiết lập font

Mặc định thì font của vscode theo mình khá xấu (hoặc do mình dùng quen font khác rồi). 2 fonts mình thấy đẹp và dùng ổn nhất là Source Code Pro và Pragmata Pro (mình thích Source Code Pro hơn một chút vì đồng bộ luôn với Terminal của mình và do nó được support bởi Adobe nên dùng rất chuẩn và ít bị lỗi) Để thiết lập fonts, các bạn làm như sau:

  • Download fonts bạn ưa thích về (nếu bạn cũng thích dùng Source Code Pro như mình thì có thể vào https://www.fontsquirrel.com/fonts/source-code-pro để download bộ fonts này về)
  • Sau khi download, các bạn giải nén các file fonts vào trong thư mục ~/.fonts (nếu chưa có thư mục này thì tạo)
  • Mở VScode và bấm tổ hợp Ctrl+Shift+P, gõ setting và tìm đến phần Open User Settings (từ giờ mình sẽ gọi tắt bước này là vào Setting nhé)
  • trong cặp dấu {}, chúng ta viết: "editor.fontFamily": "'Source Code Pro Semibold'" để set kiểu font Source Code Pro Semibold cho ediors
  • Save lại và vscode sẽ tự reload cấu hình mới Các thiết lập khác với fonts
  • Thiết lập cỡ chữ: "editor.fontSize": 16
  • Thiết lập độ đậm: "editor.fontWeight": "bold"

Ok, fonts như vậy với mình là ổn, các bạn kỹ tính hơn có thể đọc ở Default Settings của VScode để có thể tìm được những cài đặt nâng cao hơn

I have some source files that have comments written in Japanese. When I open these files in Visual Studio they appear like this:

à–¾FNCAP‰¹—p‚̃XƒŒƒbƒh

I am using the English version of WinXP, but is there a way to get Visual Studio to display the actual Japanese characters rather than the random jibberish it currently is?

asked Oct 16, 2008 at 22:40

1

Presumably VS is interpreting the file with the wrong encoding.

Reopen it using "File -> Open -> File... -> Open -> Open With... -> Source Code (Text) Editor With Encoding" and try various encodings.

answered Oct 16, 2008 at 22:44

2

I found a general solution to the problem. This worked for me in Chinese text for Visual Studio 2013 and Windows 8.1.

per https://msdn.microsoft.com/en-us/library/ms246590.aspx

  1. As Administrator Click Start, click Control Panel, and then open Regional and Language Options (or Region in Windows 8).
  2. Click the Advanced tab. (or Administrative in Windows 8)
  3. In the Select a language to match the language version of the non-Unicode programs you want to use list, select the language you are currently using.
  4. Click OK.

answered Jul 6, 2015 at 15:05

puziopuzio

611 silver badge1 bronze badge

1

Have you turned on support for Eastern languages for Windows? I have that turned on and I can see Chinese characters in Visual Studio 2005 on WinXP.

To turn it on you'll probably need the installation DVD for Windows. The setting is under Regional and Language Options in the Control Panel. I think you just need to check the "Install files for East Asian languages" option.

Microsoft's support page for internationalization has some screenshots and instructions.

answered Oct 16, 2008 at 22:45

ryan_sryan_s

7,8663 gold badges28 silver badges28 bronze badges

1

I faced the same issue and have found a solution that works for me.

The problem is that the files aren't unicode and VS is trying to open them with an encoding that matches your location. Luckily, you can set Windows default behavior for non-unicode files. Check out this link, http://msdn.microsoft.com/en-us/library/ms246590.aspx. Look under "To correctly display characters that are not included in the current code page."

These directions are incorrect for Windows 8 (I can't speak for 7 or older.) For Windows 8:

  1. Navigate to Control Panel
  2. Select Clock, Language, and Region (yeah they still have the comma before and)
  3. Region
  4. Administrative
  5. Change System Locale...
  6. Select the desired language from the "Current System Locale" drop down

Most of your programs should continue to function in English as this setting is only applied when programs and files don't support unicode.

answered Jul 10, 2014 at 17:44

DubiousPusherDubiousPusher

1,1422 gold badges8 silver badges19 bronze badges

i have just gotten this problem and fixed it by changing config "files.encoding" in file "setting.json" . Go to Menu => File => Reference => setting to open the file. Search for "files.encoding" and change value to Encoding of your file (my file encoded in Shift-JIS , i checked ending by using Notpad++)

answered Sep 14, 2017 at 1:28

Windows 10 : --> Control Panel\Clock and Region\Region

Lỗi font chữ trong visual studio 2023 fontfamily
Lỗi font chữ trong visual studio 2023 fontfamily

Lỗi font chữ trong visual studio 2023 fontfamily

Bugs

4,4999 gold badges32 silver badges41 bronze badges

answered Sep 6, 2018 at 4:46

You can also convert the text encoding to UTF-8 using Notepad++.

  1. Originally encoded as Shift-JIS:
    Lỗi font chữ trong visual studio 2023 fontfamily
  2. Convert to UTF-8:
    Lỗi font chữ trong visual studio 2023 fontfamily
  3. Save file.

It should now display correctly regardless of local region.

answered Aug 8, 2019 at 14:53

You need to encoding file to UTF-8 BOM (not UTF-8) in Notepad++. After that, you can use your file in visual studio. It's work for me.