Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.

Detecting "Multi-style" font file?

Skip to first unread message

Oliver Knoll

Sep 9, 2004, 4:39:36 AM9/9/04

I experimented with some code, read some newsgroups, and here's what
I've come up with to find the font filename on Win32:

Fonts are identified in the registry with the "full font name" which
looks for a normal style e.g. like this:

Microsoft Sans Serif (TrueType)

The value for this registry name is e.g. MICROSS.TTF which is the
value I'm looking for.

Now when enumerating the fonts on Win32 I have access to the "full
font name". So far so good.

But now the problem:

For PDF export we use the PDFLib which requires the font filename for
a given style.

Usually there are font files for each style, e.g. ARIALBD.TTF for a
bold Arial font, but not for MICROSS.TTF which is really the only
(big) font file I have in the c:\windows\fonts folder! Nevertheless
windows is able to draw this font bold, italic or both (and normal).
And when enumerating the fonts also the styles bold and italic seem to
be supported for MICROSS.TTF. I guess this font file contains several
styles? Or windows emulates them, whatever.

The question is hence: how do I indicate an italic or bold Sans Serif
font with the PDFLib? For example if I want to draw this font bold I
would have to indicate something like MICROSSBD.TTF or the like, but
this TTF font file doesn't exist off course.

I could use the keyword "style=bold" ("style=italic" etc.) and simply
use the "base font filename" MICROSS.TTF, but "style=..." according to
the PDFLib docs is not recommended and does merely an emulation(and
works only if I don't embed the font).

Moreover: how do I detect such a "multi-style" font file or whether
windows does a style emulation? If I cannot detect whether it's a
multi-style font (or emulation) that would mean on Win32 I could never
embed fonts since I would have to use the "style=..." keyword all the
time, even for fonts where there would be the proper font style file.

Thanks, Oliver

0 new messages