freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] FT_MODULE_CLASS to check font type (e.g. TrueType, Type1, et


From: Richard Michael
Subject: [ft-devel] FT_MODULE_CLASS to check font type (e.g. TrueType, Type1, etc.)
Date: Thu, 30 Nov 2006 18:31:24 -0500
User-agent: Mutt/1.4.2.1i

Hello,

I'm trying to fix/compile a recent Inkscape snapshot, and I believe it is
using a deprecated manner of interacting with FreeType; it seems to be
using macros from the internals/ portion of the includes, which are no
longer installed (according to what I've read in the FreeType source and
my FC6 system).

I've spent the day trying to familiarize myself with the FreeType API,
but now I'm just dancing around and not making much progress.

The code in question determines the font type as follows:

 FT_Face font_face = pango_ft2_font_get_face(font->pFont);
 const FT_String* font_type = FT_MODULE_CLASS(font_face->driver)->module_name;

FT_MODULE_CLASS is the deprecated internal macro, and from what I can
tell, it casts an object to type FT_Module and accesses it's variable
named "clazz": (see: internal/ftobjs.h)

 #define FT_MODULE_CLASS( x )    FT_MODULE( x )->clazz

The inkscape code (inscape-XXXX/src/extension/internal/ps.cpp) wants to
know the font type to determine if it is a font suitable for embedding
in postscript; the code (essentially) "switch"es on the "font_type"
variable.

I found the Pango patch that the FreeType team provided, which uses the
macro FT_IS_SFNT to replace a similar use of FT_MODULE_CLASS:

 strcmp (FT_MODULE_CLASS (face->driver)->module_name, "cff") == 0;

vs. 

 return FT_IS_SFNT(face);

However, I don't know that a SFNT font is always suitable for postscript
embedding.  I'm especially reluctant to use FT_IS_SFNT because the
FreeType documentation on the macro indicates "This usually means:..",
and "usually" worries me, because I don't know when this might *not* be
true.

I'd much prefer to simply duplicate the exact functionality of the
existing inkscape code (a switch on the determined font type), and
revisit the logic later.  (In fact, the inkscape code only handles
Type1, from what I can tell.)

I've seen this usage of FT_MODULE_CLASS (and friends) in a few places.
What is the best way to replace this type of code?

Thanks for any suggestions.

Regards,
Richard




reply via email to

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