I'm creating a logical font using CreateFont() and OUT_DEFAULT_PRECIS. Now how can I check if the resulting HFONT Windows has allocated for me is a raster or a vector font?
My naive approach would be to just try to get a glyph outline using GetGlyphOutline() and if this succeeds, it must be a vector font, else a raster font.
But I'd like to ask if there is a nicer version to examine the HFONT handle and tell if it is a raster or a vector font.
CodePudding user response:
Select the HFONT into an HDC via SelectObject(), and then pass the HDC to GetTextMetrics(). The resulting TEXTMETRIC struct has a tmPitchAndFamily field, which has a TMPF_VECTOR flag enabled for vector fonts.
