简体   繁体   中英

Unicode Font Support - WinForms Label

I have a WinForms label control that is reading data from a JSON object and setting the text property.

I have not found a font that properly supports certain glyphs.

I'm only dealing with European countries in my situation, so no Chinese or Japanese.

Here's an example of how it is rendering it in the label control:

标签中的瑞典语渲染

However, when I open the JSON file in Visual Studio, rendering with Consolas, it appears fine:

正确渲染 - Visual Studio 中的瑞典语

Even if I set the label to Consolas font, it does not match what Visual Studio is showing.

What do I have to go about here to make the label properly render these glyphs?

Thanks to @HansPassant, I realized what the issue here was.

The JSON file in question was an embedded resource, and was set to FileType.Binary .

This was unnecessary, so I changed this to FileType.Text , which allows the Encoding property to be set.

With Encoding as Unicode (UTF-8) - Codepage 65001 , this is now displaying as intended.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM