Xprint's use of FreeType: external symlink difficulties

Drew Parsons dparsons at debian.org
Sat Jan 21 21:43:43 PST 2006


[oops I send this message to the Xprint mailing list, I actually meant xorg-modular]

Now that the basic Xprt server is working, I'm focussing on adding
FreeType support. I understand we need this to get proper "wysiwyg"
printing from Firefox (otherwise the page comes out all in Courier
font).

There are a number of problems, related to symlinks made to external
code, namely freetype2 and ttf2pt1, both found previously in xc/extra.
Some of the symlinks are made to internal source, so it's not simply a
matter of installing libfreetype2-dev and working with public
interfaces. 

The references start in xorg/Xprint/ps/PsText.c::PsPolyText8(), where an
"#ifdef XP_USE_FREETYPE" is located, calling PsOut_DownloadFreeType().
This is found in psout_ft.c and calls PsOut_DownloadFreeType3 or
PsOut_DownloadFreeType1 depending on the value of downloadfonttype.

These two alternate paths give us the two symlink problems. I'll go over
the two cases separately.  Three, actually, but the third is inside
X.org (using a header in a lib).

1) extras/freetype2 and USE_FT_INTERNALS

PsOut_DownloadFreeType3( ) is defined in psout_ftpstype3.c. It #defines
USE_FT_INTERNALS and thereby #includes "t42types.h".  This header file
was previously found in  xc/extras/freetype2/src/type42. I'm not sure
how t42types.h, but it will be related to FT_Get_PS_Font_BBox(), also
defined under #ifdef USE_FT_INTERNALS. FT_Get_PS_Font_BBox is used in
PSType3_generateOutlineFont(), but under "if (! ti->ttheader)". It
probably needs #ifdef USE_FT_INTERNALS around it too.

psout_ftpstype3.c  also includes freetype2/freetype/internal/t1types.h
via the symbol 
#include FT_INTERNAL_TYPE1_TYPES_H. This is provided externally by
libfreetype2-dev.  However t1types.h #includes
FT_SERVICE_POSTSCRIPT_CMAPS_H, defined in internal/ftserv.h as
<freetype/internal/services/svpscmap.h>.  Previously in
xc/extras/freetype2 there was such an internal/services directory, but
in my Debian installation of libfreetype2-dev it is missing.  I don't
know if this is a Debian or FreeType2 packaging bug or an error in
Xprint/ps for wanting to use FT_INTERNAL.

One solution is to undef USE_FT_INTERNALS, but this will lose the
definition of the Font BoundingBox. I don't know what the consequences
of that would be.

freetype.org says they emphatically do NOT want applications to use the
internal headers, and in fact will remove them in freetype 2.2
(http://freetype.sourceforge.net/freetype2/freetype-2.2.0.html). In
fact they even offer to make patches for "rogue" programs.  I'll take
them up on their offer, maybe they'll have a good idea on how to get
the Font BoundingBox done "properly".


2) extras/ttf2pt1

PsOut_DownloadFreeType1 is defined in ps/psout_ftpstype1.c. It calls
ft2pt1_main( ), defined in xc/extras/ttf2pt1/ttf2pt1.c (in place of
ttf2pt1 normal main() ).

extras/ttf2pt1 seems to have quite a large number of extra code on top
of the upstream original, specific to X.org. This makes it a problem to
simply link to external source.  Most of it is specific to Xprint
(controlled by "#ifdef XP_PSTEXT").   A half dozen or more symlinks to
supporting files in extras/ttf2pt1 are made in Xprint/ps to allow
ttf2pt1.o to be built.

What is the best way to deal with this?  Create a ttf2pt1 subdirectory
below xorg/Xprint/ps ?  Let it contain a patch to external ttf2pt1,
copy rather than link files from external, than apply the patch?


3) modular lib/Xfont 

ps/PsFTFonts.c refers to FTFontPtr, defined in modular
lib/XFont/src/FreeType/ftfuncs.h.  The path can be made directly in the
monolithic build but in a modular system the header is lost.  How should
this be resolved?  Will we have to make the Xfont module to start
providing ftfuncs.h?


These are all the symlink or #include problems I've logged so far
related to freetype support in Xprt.

Thanks,

Drew


More information about the xorg-modular mailing list