How to determine if a font is a character font?

Given HFONT, how to determine if it is a character font? The pdf library I use requires character font handling differently, so I need a way to programmatically determine if any given font is a character font or not.

+5
source share
2 answers

Use GetObject to get font properties in the LOGFONT structure. Check lfCharSet member; if it is SYMBOL_CHARSET, you have a character font.

+5
source

Answer Mark Ransom will work 99.999% of the time, but there is a theoretical possibility that it might give the wrong answer.

, GetTextMetrics, TEXTMETRICS , tmCharSet SYMBOL_CHARSET.

lfCharSet tmCharSet?

HFONT Windows LOGFONT. , , , .

HFONT ( ), , LOGFONT, HFONT. . , - , , HDC, HFONT.

HFONT GetObject, LOGFONT. GetObject , , ( ).

API, , DC, GetTextMetrics, GetTextFace .., .

Mark ( GetObject), , , -, , ( ), . , , - , HDC.

+1

All Articles