Display Unicode Glyph Fonts for Actual Characters

I am trying to display all the glyphs in a font. I use GetFontUnicodeRangesto get the available characters, then create a bitmap with all the available characters and their index next to each.

I used the font "Wingdings 2"as a test case and compared it to what I see on Windows charmap.exe. I see that while all the characters appear, some characters appear more than once (a total of 480 glyphs in this font other than Unicode), and the positions are not the same as in charmap(for example, the middle glyph of the circle in charmap is like 0x97, but in the font is a symbol 0xF097, and I also think that it is one in 0x2014).

I want to use the font as a “regular” way, that is, I want to see the same data as in charmap.exe(and in the side note I would also like to know if the font is a Unicode or ascii font, as shown charmap). Basically, you can say that I'm trying to write my own charmapfrom scratch.

How can I fill in this missing data? I looked at Windows fonts and text APIs, but could not find anything that could help me, so I have to miss out on some relevant APIs. What they?

+5
source share
3 answers

GetFontData (, , , ), CharMap. :

  • "", cmap. , IN cmap. , loca.

  • head ( 34) maxp ( 4).

  • , ( , , cmap 0, , TTF 4, Microsoft), 0xF000 , ASCII Unicode Unicode. 0xF000 Wingdings [2,3] Webdings, .

: www.microsoft.com/typography/tt/ttf_spec/ttch02.doc : http://support.microsoft.com/kb/241020.

C, , #, byte[] "" .

+6

, . , .

1) , "loca" "cmap". . OffsetTable, 0 . (http://www.microsoft.com/typography/otspec/otff.htm)

2) , " cmap 0, TTF 4" . , . , . Windows , , . , , . OS/2 32 .

3) 0xF000 0-255 , , , . , 0 255 "ASCII" .

Windows.

, , , unicode, CP_ACP.

, Pretend : '%'. CP 1252 , , , "0xC2".

CP 1251 , , , "0x416", .

unicode , !

, - , 0 255, CP_ACP unicode.

? , MultiByteToWideChar CP_ACP, 0 255 (CP_ACP).

, ​​, :

ASCII -> localized non-static UNICODE
0x00 -> 0x00
0x01 -> 0x01
0x02 -> 0x02
...
0xC2 -> 0x416 <----- This is correct : the value will be different in some cases.
...
0xE3 -> 0xE3

0xF000 0xF0FF UNICODE: .

, " UNICODE", , ASCII, 0xF000, .

, - MS... .

+2

"WingDings 2" , . , .

, , 0x97, 0xF097 0x2014 - -1252. windows-1252 0x97 em-, 0x2014 Unicode. 0xF097 ; , Unicode- ( ) -1252 0x97.

, , , - cmap ttf. (cmap - ), . GetFontData ttf.

charmap GetFontData, "cmap", , charmap .

Windows SDK logger.exe, API, . , , charmap.

+1

All Articles