Bug 603

Summary: PS DDX's PS Type3 font converter uses FreeType internals
Product: xprint Reporter: Roland Mainz <roland.mainz>
Component: Server: DDX: PostScriptAssignee: Roland Mainz <roland.mainz>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: high CC: bugzilla, cyamauch, dberkholz, dparsons, eich, idr
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
clears use of FT internals, switches on FT support in Xprint
none
updates lib/Xfont BUILD_FREETYPE to XFONT_FREETYPE none

Description Roland Mainz 2004-05-06 12:09:02 UTC
The PostScript DDX's PS Type3 font converter currently depends on FreeType
internals - which is bad when Xprt links against shared library versions of
libfreetype.so.

The code can be found in xc/programs/Xserver/Xprint/ps/psout_ftpstype3.c, just
follow the |USE_FT_INTERNALS| define.
The main part looks like this:
-- snip --
#ifdef USE_FT_INTERNALS
static FT_BBox *
FT_Get_PS_Font_BBox( FT_Face face )
{
  const char *driver_name;
  FT_BBox    *font_bbox = NULL;

  if ( face && face->driver && face->driver->root.clazz )
  {
    driver_name = face->driver->root.clazz->module_name;
    if ( ft_strcmp( driver_name, "type1" ) == 0 )
      font_bbox = &(((T1_Face)face)->type1.font_bbox);
    else if ( ft_strcmp( driver_name, "t1cid" ) == 0 )
      font_bbox = &(((CID_Face)face)->cid.font_bbox);
    else if ( ft_strcmp( driver_name, "type42" ) == 0 )
      font_bbox = &(((T42_Face)face)->type1.font_bbox);
  }
  
  return font_bbox;
}
#endif /* USE_FT_INTERNALS */
-- snip --

Egbert/Chisato:
Any idea how |FT_Get_PS_Font_BBox| can be changed that only "public" FreeType
APIs are used ?
Comment 1 Drew Parsons 2006-01-24 22:50:37 UTC
Discussion of this issue can be found at
http://lists.gnu.org/archive/html/freetype-devel/2006-01/msg00060.html

The general idea is to use face->bbox instead of the underlying font_bbox.
Those values will need to be multiplied by 65536 to get the scaling right.

Drew
Comment 2 Drew Parsons 2006-01-25 16:08:12 UTC
I now have a patch against X.org 7 for this problem.

In the course of testing it, I discovered a bug in lib/Xfont, namely that
BUILD_FREETYPE had not been replaced by the new XFONT_FREETYPE in
Xfont/src/fontfile/ffcheck.c.

Similarly, there is a redundant reference to BUILD_FREETYPE in
Xfont/src/fontfile/register.c l.69, which is used to define XFONT_FREETYPE.
BUILD_FREETYPE no longer exists in the modular build of Xfont, it has been
replaced by XFONT_FREETYPE.  Therefore the block there at l.69 should be deleted
I think.  I have not done this in the attached patch myself, however. Please
remove it if you agree it's not needed.
Comment 3 Drew Parsons 2006-01-25 16:24:16 UTC
Created attachment 4460 [details] [review]
clears use of FT internals, switches on FT support in Xprint

This patch 
a) switches on Freetype support in Xprint (PS driver).
b) fixes usage of Freetype internals psout_ftpstype3.c

Note that it not a complete fix for full freetype support. Remaining issues are


1) use of ttf2pt1 by the type1 handler
2) use of lib/XFont/src/FreeType/ftfuncs.h, not exported by the Xfont module

To build Xprt without freetype support, use --disable-freetype in the autogen
step.
Comment 4 Drew Parsons 2006-01-25 16:26:45 UTC
Created attachment 4461 [details] [review]
updates lib/Xfont BUILD_FREETYPE to XFONT_FREETYPE

This patch updates fontfile/ffcheck.c in lib/Xfont.

I also recommend removing the BUILD_FREETYPE block at l.69 in
fontfile/register.c
Comment 5 Daniel Stone 2006-03-31 17:22:17 UTC
drew, I've committed your two new patches now.
note that this is not an endorsement or otherwise of CVS access, just that I
didn't notice this bug with the outstanding patch 'till now.
cheers.
Comment 6 Drew Parsons 2006-03-31 17:51:29 UTC
Thanks, Daniel. Nice you caught the other BUILD_ -> XFONT_ updates too.
Comment 7 Daniel Stone 2006-04-01 18:20:17 UTC
*** Bug 6450 has been marked as a duplicate of this bug. ***
Comment 8 Donnie Berkholz 2006-06-24 11:19:27 UTC
Any reason this bug isn't marked fixed?
Comment 9 Ian Romanick 2006-07-21 16:17:07 UTC
The original bug is apparently gone / fixed.  If problems are seen here again,
please open a new bug.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.