freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft] FT_New_Memory_Face and .ttc


From: Niels-Peter Nielsen
Subject: Re: [ft] FT_New_Memory_Face and .ttc
Date: Wed, 18 Jan 2006 14:09:37 +0100

> Let
> 
>         N      := num. of tables
>         Min    := min(offset of tables)
>         Offset := Min - (12 + 16 * N).
> 
> Then Offset should be the offset of the face in the TTC file.  Even if
> it is not, it won't harm freetype.

Adjusting the offsets might work if done on the TTF that is returned by
GetFontData. This relies on three things, though:

 - The first table starts immediately after the TTF table directories.
This is necessary to determine the new offset, and thus the amount to
change all the offsets.
 - The TTF format isn't about to undergo lots of changes. I don't fancy
re-hacking this problem over and over again.
 - The shared tables are placed at the end of the file, or at least
after all the faces that use them. If they are not, then Windows will
simply not be giving me enough information to create the face with
freetype!

Does anybody know if I can rely on this to be true?

An alternative is to try using FT_New_Memory_Face as before, but if it
fails then enumerate
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Fonts (or
WindowsNT, for some versions) to find all the registered font files.
Considering only the .ttc files, enumerate the faces within them, and
see if there is a match for the facename given in the LOGFONT.

This also has obvious drawbacks, e.g. it depends on Microsoft not making
any major changes in their font handling in future Windows versions.
This is something I consider not entirely unlikely, given that they have
hidden the font files entirely in their API. It also depends on the
facename in the LOGFONT structure being matchable with the face name in
the file.

Can anybody suggest other alternatives, or tell me why I should select
one or the other alternative?






reply via email to

[Prev in Thread] Current Thread [Next in Thread]