How to programatically get the character encoding a font supports?
Is there a way, using C#, to get the character encoding a Font supports?开发者_如何学编程
Short answer: No
In the .Net world, there are not code pages: everything is done in Unicode.
A font is a collection of glyphs (a graphic representation of a character) mapped onto a subset of Unicode codepoints (32-bit integers).
CLR strings are UTF-16 encoded lists of System.Char (unsigned 16-bit integers). This means that certain Unicode codepoints (0x00000080 and higher) are represented in the string as a pair of 16-bit characters, computed according to UTF-16. Internally[1], the string is converted from UTF-16 to UTF-32 and the now-32-bit characters are used to look up the appropriate glyph.
[1]Logically, anyway. I've got no idea what the actual implementation details are.
精彩评论