C #: How does the Noto Sans font support Korean,
1. Source:
The VCU10 project uses the Noto Sans font, which is really beautiful. However, it is a headache to verify that it is garbled in Korean in win7.
Its Interface display
Du Niang, The Noto Sans has a CJK font. As the name suggests, it supports Chinese and Japanese Korean, and its size is huge. It is not suitable as a solution. continue thinking!
2. Font. GdiCharSet attributes
There is no way to solve the problem based on the current situation? Multi-language support is required.
Check the font attributes and verify that the GdiCharSet character set can be changed to display Korean. The solution is available!
According to the information, the font GdiCharSet can have the following values:
Character Set |
Value |
ANSI |
0 |
DEFAULT |
1 |
Symbol |
2 |
SHIFTJIS applicable |
128 |
Korean |
129 |
Korean |
129 |
GB2312 |
134 |
CHINESEBIG5 applicable |
136 |
OEM |
255 |
Korean |
130 |
Hebrew |
177 |
Arabic |
178 |
Greek |
161 |
Turkish |
162 |
Vietnamese |
163 |
Thai |
222 |
EASTEUROPE |
238 |
Russian |
204 |
MAC |
77 |
Boro |
186 |
Verify that the default Character Set of the Eastern Europe, the Baltic Sea, and other character sets can be normally displayed in Korean without affecting the display effect. Therefore, you decide to replace the character set.
3. Replacement
The font has been set on the project interface, and there are many interfaces. it is not convenient to change one interface at a time. Please write code in batch!
In each form or UserControl, call the UpdateNotoSansCharset () number to replace it.
// Process the Label font to display the Korean public static void UpdateNotoSansCharset (Form form) {if (OSUtils. OSVersion> FriendlyOSVersion. win7) return; foreach (Control ctrl in form. controls) UpdateNotoSansCharset (ctrl);} public static void UpdateNotoSansCharset (ScrollableControl parent) {if (OSUtils. OSVersion> FriendlyOSVersion. win7) return; foreach (Control ctrl in parent. controls) UpdateNotoSansCharset (ctrl);} public static void UpdateNotoSansCharset (GControl ctrl) {if (ctrl is ScrollableControl) UpdateNotoSansCharset (ctrl as ScrollableControl); else if (ctrl is Label) {// CharSet uses the Central European character set var font = new Font (ctrl. font. fontFamily, ctrl. font. size, ctrl. font. style, ctrl. font. units, 238); ctrl. font = font ;}}
4. Effect
OK. The problem is solved perfectly: