🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #459

followup on TrueType font weirdness

#459
From: Berthold K.P. Horn
Date: Fri, 17 Apr 1992 12:01
38 lines
2081 bytes
OK, so it IS possible to distinguish `text' TT fonts from `snowflake'
(decorative/symbol) TT fonts using EnumFonts. The distinguishing
chracteristic is that non-text fonts have CharSet = 2 (Symbol) and
PitchAndFamily = 2 (Variable Pitch and unknown Family).  
But I don't want to have to do an EnumFont everytime a document calls 
for a font change! 

Type 1 fonts behave much more logically in this respect.  If you ask for a
font by name you GET that font, whether it uses Windows ANSI encoding or
`native' encoding.  (Exception: if the font is not there, you get something
totally bizarre, calculated by the Windows font remapping algorithm ---
which uses the weeghee board algorithm - but that is another story).

With TrueType fonts instead, you have to KNOW in advance whether the font is
decorative/symbol, and set CharSet and PitchAndFamily in the CreateFont call
appropriately.  Otherwise the Windows font mapper gives you something else
AND lies about what its FaceName is, so you can't tell you have been shafted.

For example, if you ask for WingDing, but do not set CharSet=2 and
PicthandFamily=2, you get a text font instead (who knows what).
Yet the FaceName of the font is WingDing!

Conversely, if you ask for say Times New Roman, but DO set CharSet = 2 and
PitchAndfamily = 2 you get some decorative font (a blackletter font in my
case). Again when asked for the FaceName it claims it IS Times New Roman!

So:

(*) Is there a sure way to know that you did NOT get the font you asked for?
(Obviously testing the FaceName does not work).

(*) Is there a sure way to tell, given a fonts Window FaceName, 
whether it is plain vanialla text or `snowflake'?


Berthold K.P. Horn
Cambridge, Massachusetts, USA
Technical Details
Message-ID: <23403@life.ai.mit.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!snorkelwacker.mit.edu!ai-lab!wheat-chex!bkph

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!snorkelwacker.mit.edu!ai-lab!wheat-chex!bkph
From: bkph@wheat-chex.ai.mit.edu (Berthold K.P. Horn)
Newsgroups: comp.windows.ms.programmer
Subject: followup on TrueType font weirdness
Message-ID: <23403@life.ai.mit.edu>
Date: 17 Apr 92 12:01:24 GMT
Sender: news@ai.mit.edu
Lines: 38