🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Font weights and thickness classification (in Freetype)

Started by
2 comments, last by LorenzoGatti 6 years, 11 months ago

What is the standardized way to quantify font weights in FreeType? FT seems to expose the style name via FT_Face, which provides a string-based descriptive name, but I'm encountering a number of styles that do not have a one-to-one match on the weight scale used by WinAPI (I'm not sure where the origin of the weight scale is from). For instance, "Narrow" does not seem to be a quantifiable descriptor. Nor does "Condensed". I presently have the following table, but it's incomplete (eg in addition to the two abovementioned styles it lacks things like "Semilight", etc):

 

Extra Light = 100
Ultra Light = 100

Light = 200
Thin = 200

Book = 300
Demi = 300

Normal = 400
Regular = 400

Medium = 500

Semibold = 600
Demibold = 600

Bold = 700

Black = 800
Extra Bold = 800
Heavy = 800

ExtraBlack = 900
Fat = 900
Poster = 900
Ultra Black = 900

 

In addition to this, the PostScript descriptor seems to have a weight member (though I cannot tell whether it uses the same scale as above) and there seems to be no entirely consistent way in which the literal style tokens  are written in the first place ("Semi Light" != "Semilight"). Am I missing something obvious or is there some voodoo involved here?

Advertisement

Hm - I accidentally stumbled across the usWeightClass member inside the TT_OS2 structure, which seems to be present for most fonts (at least on my system). Statistically speaking, it seems most other fonts either seem to be Regular (weight 400) in nature or can blindly be assumed to have the default weight.

  • Narrow and Condensed are widths, not weights: they are traditional adjectives for variant font families that have a smaller character width than the normal font and a similar design. Wider designs are usually called Expanded, Extended or Wide
    For example typical Windows fonts include Arial (main design) and Arial Narrow, and Arial Narrow has the same set of weights as Arial, e.g. Arial Narrow Bold that looks like a narrower Arial Bold.
     
  • Quote

    I'm encountering a number of styles that do not have a one-to-one match on the weight scale used by WinAPI

    If you use FreeType, why do you bother with matching a different API? What use do you have for descriptions of the font weight, except to report in some debug log or end-user report interesting details, found in the font file, of the fonts you are using? None of this data has any relevance to using the font to render characters.
    In case you are letting the users select fonts interactively, you can conservatively group them by name heuristics, without trying to guess and sort weights and widths.

Omae Wa Mou Shindeiru

This topic is closed to new replies.

Advertisement