in reply to Win32 Module to return font filename from full font name/weight/slant ?

There are a couple of things that come to mind; first it's dangerous to assume that font file names are regular. I'm not sure myself as I look at the 600 or so fonts installed on my system(s) if I've ever seen rhyme or reason to the names. If you know otherwise then of course ignore the warning--YMMV. The other notion is that your module should have some means of telling you and the world if a particular font exists. One of the things missing from MSFT's bizarre approach to font tech is the idea of telling you that it can't find the font you are looking for; instead it cheerfully loads some other font that it thinks might be nice. Imagine trying this with symbol fonts---like say "Chess Alpha"! You might find http://www.codeproject.com/gdi/fontfile.asp useful.

--hsm

"Never try to teach a pig to sing...it wastes your time and it annoys the pig."
  • Comment on Re: Win32 Module to return font filename from full font name/weight/slant ?

Replies are listed 'Best First'.
Re^2: Win32 Module to return font filename from full font name/weight/slant ?
by renodino (Curate) on Jan 04, 2006 at 17:07 UTC
    Yes, the font naming can be a bit random, but in general the last pieces are the weight and slant (but what the difference between italic and oblique is I'm not certain, they look the same to me...). Fortunately, we have regexen, so dealing with those issues should be feasible.

    As to loading a "similar" font, I'd never knowingly do that; however, I am thinking of providing a "get_ttf_matching('string')" i/f that returns the list of fonts that start with 'string'.

    And the URL you gave is what got me rolling down this hill in the first place, but thanks for the pointer!

      It's not that you would load a similar font, under the windows regime, the OS loads a similar font if it can't find an exact match! Then it cheerfully goes on about your business as if what it did were perfectly reasonable. GRRRR! Sigh!!

      Typically the difference between italic and oblique is that an italic font is designed to slant, while oblique is just knocked up the side of it's head and made to tilt. Use italic over oblique is best from the typophile point of view.

      --hsm

      "Never try to teach a pig to sing...it wastes your time and it annoys the pig."