[xorg-commit-diffs] xc/extras/freetype2/src/base ftstroke.c, NONE, 1.1.6.1 Jamfile, 1.1.4.1, 1.1.4.2 descrip.mms, 1.1.4.1, 1.1.4.2 ftbase.c, 1.1, 1.1.4.1 ftbbox.c, 1.1.4.1, 1.1.4.2 ftbdf.c, 1.1.4.1, 1.1.4.2 ftcalc.c, 1.1, 1.1.4.1 ftdbgmem.c, 1.1.4.1, 1.1.4.2 ftglyph.c, 1.1.4.1, 1.1.4.2 ftmac.c, 1.1.4.2, 1.1.4.3 ftmm.c, 1.1, 1.1.4.1 ftobjs.c, 1.1.4.1, 1.1.4.2 ftoutln.c, 1.1.4.1, 1.1.4.2 ftpfr.c, 1.1, 1.1.4.1 ftsynth.c, 1.1.4.1, 1.1.4.2 fttrigon.c, 1.1.4.1, 1.1.4.2 fttype1.c, 1.1.4.1, 1.1.4.2 ftwinfnt.c, 1.1, 1.1.4.1 ftxf86.c, 1.1, 1.1.4.1 rules.mk, 1.1.4.1, 1.1.4.2 ftstroker.c, 1.1.4.1, NONE

Egbert Eich xorg-commit at pdx.freedesktop.org
Thu Apr 15 03:14:35 PDT 2004


Committed by: eich

Update of /cvs/xorg/xc/extras/freetype2/src/base
In directory pdx:/home/eich/tstbuild/xc/extras/freetype2/src/base

Modified Files:
      Tag: XORG-CURRENT
	Jamfile descrip.mms ftbase.c ftbbox.c ftbdf.c ftcalc.c 
	ftdbgmem.c ftglyph.c ftmac.c ftmm.c ftobjs.c ftoutln.c ftpfr.c 
	ftsynth.c fttrigon.c fttype1.c ftwinfnt.c ftxf86.c rules.mk 
Added Files:
      Tag: XORG-CURRENT
	ftstroke.c 
Removed Files:
      Tag: XORG-CURRENT
	ftstroker.c 
Log Message:
2004-04-15  Egbert Eich  <eich at freedesktop.org>
        Merged changes from RELEASE-1 branch
	


--- NEW FILE: ftstroke.c ---
/***************************************************************************/
/*                                                                         */
/*  ftstroke.c                                                             */
/*                                                                         */
/*    FreeType path stroker (body).                                        */
/*                                                                         */
/*  Copyright 2002, 2003 by                                                */
/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
/*                                                                         */
/*  This file is part of the FreeType project, and may only be used,       */
/*  modified, and distributed under the terms of the FreeType project      */
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
/*  this file you indicate that you have read the license and              */
/*  understand and accept it fully.                                        */
/*                                                                         */
/***************************************************************************/


#include <ft2build.h>
[...1628 lines suppressed...]
        goto Exit;

      error = FT_Stroker_EndSubPath( stroker );
      if ( error )
        goto Exit;

      first = last + 1;
    }

    return 0;

  Exit:
    return error;

  Invalid_Outline:
    return FT_Err_Invalid_Outline;
  }


/* END */

Index: Jamfile
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/Jamfile,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/Jamfile	26 Nov 2003 22:48:25 -0000	1.1.4.1
+++ b/Jamfile	15 Apr 2004 10:14:31 -0000	1.1.4.2
@@ -1,4 +1,4 @@
-# FreeType 2 src/base Jamfile (c) 2001, 2002 David Turner
+# FreeType 2 src/base Jamfile (c) 2001, 2002, 2003 David Turner
 #
 
 SubDir  FT2_TOP $(FT2_SRC_DIR) base ;
@@ -24,7 +24,7 @@
 #
 Library  $(FT2_LIB) : ftsystem.c   ftinit.c    ftglyph.c  ftmm.c     ftbdf.c
                       ftbbox.c     ftdebug.c   ftxf86.c   fttype1.c  ftpfr.c
-                      ftstroker.c  ftwinfnt.c
+                      ftstroke.c   ftwinfnt.c
                       ;
 
 # Add Macintosh-specific file to the library when necessary.

Index: descrip.mms
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/descrip.mms,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/descrip.mms	26 Nov 2003 22:48:25 -0000	1.1.4.1
+++ b/descrip.mms	15 Apr 2004 10:14:31 -0000	1.1.4.2
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 2001 by
+# Copyright 2001, 2003 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -15,7 +15,7 @@
 
 CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.builds.vms],[--.include],[--.src.base])
 
-OBJS=ftbase.obj,ftinit.obj,ftglyph.obj,ftdebug.obj,ftbdf.obj,ftmm.obj,fttype1.obj,ftxf86.obj,ftpfr.obj,ftstroker.obj,ftwinfnt.obj
+OBJS=ftbase.obj,ftinit.obj,ftglyph.obj,ftdebug.obj,ftbdf.obj,ftmm.obj,fttype1.obj,ftxf86.obj,ftpfr.obj,ftstroke.obj,ftwinfnt.obj
 
 all : $(OBJS)
         library [--.lib]freetype.olb $(OBJS)

Index: ftbase.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftbase.c,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -d -r1.1 -r1.1.4.1
--- a/ftbase.c	14 Nov 2003 16:48:24 -0000	1.1
+++ b/ftbase.c	15 Apr 2004 10:14:31 -0000	1.1.4.1
@@ -30,5 +30,8 @@
 #include "ftobjs.c"
 #include "ftnames.c"
 
+#if defined( __APPLE__ ) && !defined ( DARWIN_NO_CARBON )
+#include "ftmac.c"
+#endif
 
 /* END */

Index: ftbbox.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftbbox.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/ftbbox.c	26 Nov 2003 22:48:25 -0000	1.1.4.1
+++ b/ftbbox.c	15 Apr 2004 10:14:31 -0000	1.1.4.2
@@ -98,9 +98,9 @@
   static void
   BBox_Conic_Check( FT_Pos   y1,
                     FT_Pos   y2,
-                          FT_Pos   y3,
-                          FT_Pos*  min,
-                          FT_Pos*  max )
+                    FT_Pos   y3,
+                    FT_Pos*  min,
+                    FT_Pos*  max )
   {
     if ( y1 <= y3 )
     {

Index: ftbdf.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftbdf.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/ftbdf.c	26 Nov 2003 22:48:25 -0000	1.1.4.1
+++ b/ftbdf.c	15 Apr 2004 10:14:31 -0000	1.1.4.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType API for accessing BDF-specific strings (body).              */
 /*                                                                         */
-/*  Copyright 2002 by                                                      */
+/*  Copyright 2002, 2003 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -17,24 +17,8 @@
 
 
 #include <ft2build.h>
-#include FT_INTERNAL_BDF_TYPES_H
 #include FT_INTERNAL_OBJECTS_H
-
-  static FT_Bool
-  test_font_type( FT_Face face, const char*  name )
-  {
-    if ( face && face->driver )
-    {
-      FT_Module  driver = (FT_Module)face->driver;
-
-      if ( driver->clazz && driver->clazz->module_name )
-      {
-        if ( ft_strcmp( driver->clazz->module_name, name ) == 0 )
-          return 1;
-      }
-    }
-    return 0;
-  }
+#include FT_SERVICE_BDF_H
 
 
   FT_EXPORT_DEF( FT_Error )
@@ -49,14 +33,15 @@
 
     error = FT_Err_Invalid_Argument;
 
-    if ( test_font_type( face, "bdf" ) )
+    if ( face )
     {
-      BDF_Public_Face  bdf_face = (BDF_Public_Face)face;
+      FT_Service_BDF  service;
 
 
-      encoding = (const char*) bdf_face->charset_encoding;
-      registry = (const char*) bdf_face->charset_registry;
-      error    = 0;
+      FT_FACE_FIND_SERVICE( face, service, BDF );
+
+      if ( service && service->get_charset_id )
+        error = service->get_charset_id( face, &encoding, &registry );
     }
 
     if ( acharset_encoding )
@@ -74,23 +59,26 @@
                        const char*       prop_name,
                        BDF_PropertyRec  *aproperty )
   {
-    FT_Error   error;
+    FT_Error  error;
+
 
     error = FT_Err_Invalid_Argument;
 
     aproperty->type = BDF_PROPERTY_TYPE_NONE;
 
-    if ( face != NULL && face->driver != NULL )
+    if ( face )
     {
-      FT_Driver              driver = face->driver;
-      BDF_GetPropertyFunc    func;
+      FT_Service_BDF  service;
 
-      func = (BDF_GetPropertyFunc) driver->root.clazz->get_interface(
-                             FT_MODULE( driver ), "get_bdf_property" );
-      if ( func )
-        error = func( face, prop_name, aproperty );
+
+      FT_FACE_FIND_SERVICE( face, service, BDF );
+
+      if ( service && service->get_property )
+        error = service->get_property( face, prop_name, aproperty );
     }
-    return error;
+
+    return  error;
   }
 
+
 /* END */

Index: ftcalc.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftcalc.c,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -d -r1.1 -r1.1.4.1
--- a/ftcalc.c	14 Nov 2003 16:48:24 -0000	1.1
+++ b/ftcalc.c	15 Apr 2004 10:14:31 -0000	1.1.4.1
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Arithmetic computations (body).                                      */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -168,7 +168,7 @@
     if ( a < 0 ) { a = -a; s = -1; }
     if ( b < 0 ) { b = -b; s = -s; }
 
-    c = (FT_Long)( ( (FT_Int64)a * b + 0x8000 ) >> 16 );
+    c = (FT_Long)( ( (FT_Int64)a * b + 0x8000L ) >> 16 );
     return ( s > 0 ) ? c : -c ;
   }
 
@@ -346,15 +346,15 @@
 
     if ( ua <= 2048 && ub <= 1048576L )
     {
-      ua = ( ua * ub + 0x8000 ) >> 16;
+      ua = ( ua * ub + 0x8000L ) >> 16;
     }
     else
     {
-      FT_ULong  al = ua & 0xFFFF;
+      FT_ULong  al = ua & 0xFFFFL;
 
 
       ua = ( ua >> 16 ) * ub +  al * ( ub >> 16 ) +
-           ( ( al * ( ub & 0xFFFF ) + 0x8000 ) >> 16 );
+           ( ( al * ( ub & 0xFFFFL ) + 0x8000L ) >> 16 );
     }
 
     return ( s < 0 ? -(FT_Long)ua : (FT_Long)ua );

Index: ftdbgmem.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftdbgmem.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/ftdbgmem.c	26 Nov 2003 22:48:25 -0000	1.1.4.1
+++ b/ftdbgmem.c	15 Apr 2004 10:14:31 -0000	1.1.4.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Memory debugger (body).                                              */
 /*                                                                         */
-/*  Copyright 2001, 2002 by                                                */
+/*  Copyright 2001, 2002, 2003 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */

Index: ftglyph.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftglyph.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/ftglyph.c	26 Nov 2003 22:48:25 -0000	1.1.4.1
+++ b/ftglyph.c	15 Apr 2004 10:14:31 -0000	1.1.4.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType convenience functions to handle glyphs (body).              */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -57,7 +57,7 @@
 
   FT_EXPORT_DEF( void )
   FT_Matrix_Multiply( const FT_Matrix*  a,
-                      FT_Matrix*  b )
+                      FT_Matrix        *b )
   {
     FT_Fixed  xx, xy, yx, yy;
 
@@ -158,8 +158,8 @@
     glyph->left   = slot->bitmap_left;
     glyph->top    = slot->bitmap_top;
 
-    if ( slot->flags & FT_GLYPH_OWN_BITMAP )
-      slot->flags &= ~FT_GLYPH_OWN_BITMAP;
+    if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
+      slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
     else
     {
       /* copy the bitmap into a new buffer */
@@ -254,13 +254,13 @@
 
     /* copy it */
     FT_MEM_COPY( target->points, source->points,
-              source->n_points * sizeof ( FT_Vector ) );
+                 source->n_points * sizeof ( FT_Vector ) );
 
     FT_MEM_COPY( target->tags, source->tags,
-              source->n_points * sizeof ( FT_Byte ) );
+                 source->n_points * sizeof ( FT_Byte ) );
 
     FT_MEM_COPY( target->contours, source->contours,
-              source->n_contours * sizeof ( FT_Short ) );
+                 source->n_contours * sizeof ( FT_Short ) );
 
     /* copy all flags, except the `FT_OUTLINE_OWNER' one */
     target->flags = source->flags | FT_OUTLINE_OWNER;
@@ -421,7 +421,7 @@
   FT_Get_Glyph( FT_GlyphSlot  slot,
                 FT_Glyph     *aglyph )
   {
-    FT_Library  library = slot->library;
+    FT_Library  library;
     FT_Error    error;
     FT_Glyph    glyph;
 
@@ -431,6 +431,8 @@
     if ( !slot )
       return FT_Err_Invalid_Slot_Handle;
 
+    library = slot->library;
+
     if ( !aglyph )
       return FT_Err_Invalid_Argument;
 
@@ -541,7 +543,8 @@
         clazz->glyph_bbox( glyph, acbox );
 
         /* perform grid fitting if needed */
-        if ( bbox_mode & ft_glyph_bbox_gridfit )
+        if ( bbox_mode == FT_GLYPH_BBOX_GRIDFIT ||
+             bbox_mode == FT_GLYPH_BBOX_PIXELS  )
         {
           acbox->xMin &= -64;
           acbox->yMin &= -64;
@@ -550,7 +553,8 @@
         }
 
         /* convert to integer pixels if needed */
-        if ( bbox_mode & ft_glyph_bbox_truncate )
+        if ( bbox_mode == FT_GLYPH_BBOX_TRUNCATE ||
+             bbox_mode == FT_GLYPH_BBOX_PIXELS   )
         {
           acbox->xMin >>= 6;
           acbox->yMin >>= 6;
@@ -571,12 +575,13 @@
                       FT_Vector*      origin,
                       FT_Bool         destroy )
   {
-    FT_GlyphSlotRec  dummy;
-    FT_Error         error = FT_Err_Ok;
-    FT_Glyph         glyph;
-    FT_BitmapGlyph   bitmap = NULL;
+    FT_GlyphSlotRec           dummy;
+    FT_GlyphSlot_InternalRec  dummy_internal;
+    FT_Error                  error = FT_Err_Ok;
+    FT_Glyph                  glyph;
+    FT_BitmapGlyph            bitmap = NULL;
 
-    const FT_Glyph_Class*  clazz;
+    const FT_Glyph_Class*     clazz;
 
 
     /* check argument */
@@ -592,7 +597,7 @@
 
     clazz = glyph->clazz;
 
-    /* when called with a bitmap glyph, do nothing and return succesfully */
+    /* when called with a bitmap glyph, do nothing and return successfully */
     if ( clazz == &ft_bitmap_glyph_class )
       goto Exit;
 
@@ -600,8 +605,10 @@
       goto Bad;
 
     FT_MEM_ZERO( &dummy, sizeof ( dummy ) );
-    dummy.library = glyph->library;
-    dummy.format  = clazz->glyph_format;
+    FT_MEM_ZERO( &dummy_internal, sizeof ( dummy_internal ) );
+    dummy.internal = &dummy_internal;
+    dummy.library  = glyph->library;
+    dummy.format   = clazz->glyph_format;
 
     /* create result bitmap glyph */
     error = ft_new_glyph( glyph->library, &ft_bitmap_glyph_class,
@@ -609,7 +616,7 @@
     if ( error )
       goto Exit;
 
-#if 0
+#if 1
     /* if `origin' is set, translate the glyph image */
     if ( origin )
       FT_Glyph_Transform( glyph, 0, origin );
@@ -622,7 +629,7 @@
     if ( !error )
       error = FT_Render_Glyph_Internal( glyph->library, &dummy, render_mode );
 
-#if 0
+#if 1
     if ( !destroy && origin )
     {
       FT_Vector  v;

Index: ftmac.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftmac.c,v
retrieving revision 1.1.4.2
retrieving revision 1.1.4.3
diff -u -d -r1.1.4.2 -r1.1.4.3
--- a/ftmac.c	5 Mar 2004 13:38:42 -0000	1.1.4.2
+++ b/ftmac.c	15 Apr 2004 10:14:31 -0000	1.1.4.3
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Mac FOND support.  Written by just at letterror.com.                    */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.     */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -14,7 +14,6 @@
 /*  understand and accept it fully.                                        */
 /*                                                                         */
 /***************************************************************************/
-/* $XFree86: xc/extras/freetype2/src/base/ftmac.c,v 1.4 2003/05/09 01:38:00 tsi Exp $ */
 
   /*
     Notes
@@ -62,12 +61,14 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 #include FT_INTERNAL_STREAM_H
-#include "truetype/ttobjs.h"
-#include "type1/t1objs.h"
 
 #ifdef __GNUC__
+#include "../truetype/ttobjs.h"
+#include "../type1/t1objs.h"
 #include <Carbon/Carbon.h>
 #else
+#include "truetype/ttobjs.h"
+#include "type1/t1objs.h"
 #include <Resources.h>
 #include <Fonts.h>
 #include <Errors.h>
@@ -75,7 +76,6 @@
 #include <TextUtils.h>
 #endif
 
-
 #include FT_MAC_H
 
 
@@ -91,7 +91,7 @@
   file_spec_from_path( const char*  pathname,
                        FSSpec*      spec )
   {
-#if TARGET_API_MAC_CARBON
+#if defined( TARGET_API_MAC_CARBON ) && !defined( __MWERKS__ )
 
     OSErr  e;
     FSRef  ref;
@@ -139,7 +139,7 @@
   }
 
 
-#if TARGET_API_MAC_CARBON
+#ifdef TARGET_API_MAC_CARBON
 
   /* is this a Mac OS X .dfont file */
   static Boolean
@@ -148,8 +148,8 @@
     int  nameLen = spec->name[0];
 
 
-    return nameLen >= 6                                   &&
-           !memcmp( spec->name + nameLen - 5, ".dfont", 6 );
+    return nameLen >= 6                                      &&
+           !ft_memcmp( spec->name + nameLen - 5, ".dfont", 6 );
   }
 
 #endif
@@ -169,7 +169,7 @@
 
     while ( *q )
     {
-      if ( isupper( *q ) )
+      if ( ft_isupper( *q ) )
       {
         if ( count )
           max = 3;
@@ -308,7 +308,7 @@
 
         if ( ps_name_len != 0 )
         {
-          memcpy(ps_name, names[0] + 1, ps_name_len);
+          ft_memcpy(ps_name, names[0] + 1, ps_name_len);
           ps_name[ps_name_len] = 0;
         }
         if ( style->indexes[0] > 1 )
@@ -316,7 +316,7 @@
           unsigned char*  suffixes = names[style->indexes[0] - 1];
 
 
-          for ( i = 1; i < suffixes[0]; i++ )
+          for ( i = 1; i <= suffixes[0]; i++ )
           {
             unsigned char*  s;
             size_t          j = suffixes[i] - 1;
@@ -329,7 +329,7 @@
 
               if ( s_len != 0 && ps_name_len + s_len < sizeof ( ps_name ) )
               {
-                memcpy( ps_name + ps_name_len, s + 1, s_len );
+                ft_memcpy( ps_name + ps_name_len, s + 1, s_len );
                 ps_name_len += s_len;
                 ps_name[ps_name_len] = 0;
               }
@@ -587,6 +587,7 @@
     size_t     sfnt_size;
     FT_Error   error = 0;
     FT_Memory  memory = library->memory;
+    int        is_cff;
 
 
     sfnt = GetResource( 'sfnt', sfnt_id );
@@ -605,11 +606,16 @@
     HUnlock( sfnt );
     ReleaseResource( sfnt );
 
+    is_cff = sfnt_size > 4 && sfnt_data[0] == 'O' &&
+                              sfnt_data[1] == 'T' &&
+                              sfnt_data[2] == 'T' &&
+                              sfnt_data[3] == 'O';
+
     return open_face_from_buffer( library,
                                   sfnt_data,
                                   sfnt_size,
                                   face_index,
-                                  "truetype",
+                                  is_cff ? "cff" : "truetype",
                                   aface );
   }
 
@@ -655,7 +661,7 @@
   }
 
 
-#if TARGET_API_MAC_CARBON
+#ifdef TARGET_API_MAC_CARBON
 
   /* Create a new FT_Face from a file spec to a suitcase file. */
   static FT_Error
@@ -901,7 +907,7 @@
         return FT_New_Face_From_LWFN( library, &spec, face_index, aface );
     }
 
-#if TARGET_API_MAC_CARBON
+#ifdef TARGET_API_MAC_CARBON
 
     if ( is_dfont( &spec ) )
       return FT_New_Face_From_dfont( library, &spec, face_index, aface );

Index: ftmm.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftmm.c,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -d -r1.1 -r1.1.4.1
--- a/ftmm.c	14 Nov 2003 16:48:24 -0000	1.1
+++ b/ftmm.c	15 Apr 2004 10:14:31 -0000	1.1.4.1
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Multiple Master font support (body).                                 */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2003 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -19,6 +19,7 @@
 #include <ft2build.h>
 #include FT_MULTIPLE_MASTERS_H
 #include FT_INTERNAL_OBJECTS_H
+#include FT_SERVICE_MULTIPLE_MASTERS_H
 
 
   /*************************************************************************/
@@ -31,15 +32,15 @@
 #define FT_COMPONENT  trace_mm
 
 
-  /* documentation is in ftmm.h */
-
-  FT_EXPORT_DEF( FT_Error )
-  FT_Get_Multi_Master( FT_Face           face,
-                       FT_Multi_Master  *amaster )
+  static FT_Error
+  ft_face_get_mm_service( FT_Face                   face,
+                          FT_Service_MultiMasters  *aservice )
   {
     FT_Error  error;
 
 
+    *aservice = NULL;
+
     if ( !face )
       return FT_Err_Invalid_Face_Handle;
 
@@ -47,14 +48,34 @@
 
     if ( FT_HAS_MULTIPLE_MASTERS( face ) )
     {
-      FT_Driver       driver = face->driver;
-      FT_Get_MM_Func  func;
+      FT_FACE_LOOKUP_SERVICE( face,
+                              *aservice,
+                              MULTI_MASTERS );
 
+      if ( aservice )
+        error = FT_Err_Ok;
+    }
 
-      func = (FT_Get_MM_Func)driver->root.clazz->get_interface(
-                               FT_MODULE( driver ), "get_mm" );
-      if ( func )
-        error = func( face, amaster );
+    return error;
+  }
+
+
+  /* documentation is in ftmm.h */
+
+  FT_EXPORT_DEF( FT_Error )
+  FT_Get_Multi_Master( FT_Face           face,
+                       FT_Multi_Master  *amaster )
+  {
+    FT_Error                 error;
+    FT_Service_MultiMasters  service;
+
+
+    error = ft_face_get_mm_service( face, &service );
+    if ( !error )
+    {
+      error = FT_Err_Invalid_Argument;
+      if ( service->get_mm )
+        error = service->get_mm( face, amaster );
     }
 
     return error;
@@ -68,24 +89,16 @@
                                 FT_UInt   num_coords,
                                 FT_Long*  coords )
   {
-    FT_Error  error;
-
-
-    if ( !face )
-      return FT_Err_Invalid_Face_Handle;
+    FT_Error                 error;
+    FT_Service_MultiMasters  service;
 
-    error = FT_Err_Invalid_Argument;
 
-    if ( FT_HAS_MULTIPLE_MASTERS( face ) )
+    error = ft_face_get_mm_service( face, &service );
+    if ( !error )
     {
-      FT_Driver              driver = face->driver;
-      FT_Set_MM_Design_Func  func;
-
-
-      func = (FT_Set_MM_Design_Func)driver->root.clazz->get_interface(
-                                      FT_MODULE( driver ), "set_mm_design" );
-      if ( func )
-        error = func( face, num_coords, coords );
+      error = FT_Err_Invalid_Argument;
+      if ( service->set_mm_design )
+        error = service->set_mm_design( face, num_coords, coords );
     }
 
     return error;
@@ -99,24 +112,16 @@
                                FT_UInt    num_coords,
                                FT_Fixed*  coords )
   {
-    FT_Error  error;
-
-
-    if ( !face )
-      return FT_Err_Invalid_Face_Handle;
+    FT_Error                 error;
+    FT_Service_MultiMasters  service;
 
-    error = FT_Err_Invalid_Argument;
 
-    if ( FT_HAS_MULTIPLE_MASTERS( face ) )
+    error = ft_face_get_mm_service( face, &service );
+    if ( !error )
     {
-      FT_Driver             driver = face->driver;
-      FT_Set_MM_Blend_Func  func;
-
-
-      func = (FT_Set_MM_Blend_Func)driver->root.clazz->get_interface(
-                                     FT_MODULE( driver ), "set_mm_blend" );
-      if ( func )
-        error = func( face, num_coords, coords );
+      error = FT_Err_Invalid_Argument;
+      if ( service->set_mm_blend )
+         error = service->set_mm_blend( face, num_coords, coords );
     }
 
     return error;

Index: ftobjs.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftobjs.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/ftobjs.c	26 Nov 2003 22:48:25 -0000	1.1.4.1
+++ b/ftobjs.c	15 Apr 2004 10:14:31 -0000	1.1.4.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType private base classes (body).                            */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -27,6 +27,34 @@
 #include FT_TRUETYPE_IDS_H
 #include FT_OUTLINE_H
[...1179 lines suppressed...]
+            FT_ASSERT( cur[0]->clazz );
+
+            if ( cur[0]->clazz->get_interface )
+            {
+              result = cur[0]->clazz->get_interface( cur[0], service_id );
+              if ( result != NULL )
+                break;
+            }
+          }
+        }
+      }
+    }
+
+    return result;
+  }
+
+
   /* documentation is in ftmodule.h */
 
   FT_EXPORT_DEF( FT_Error )

Index: ftoutln.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftoutln.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/ftoutln.c	26 Nov 2003 22:48:25 -0000	1.1.4.1
+++ b/ftoutln.c	15 Apr 2004 10:14:31 -0000	1.1.4.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType outline management (body).                                  */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -26,6 +26,7 @@
 #include <ft2build.h>
 #include FT_OUTLINE_H
 #include FT_INTERNAL_OBJECTS_H
+#include FT_TRIGONOMETRY_H
 
 
   /*************************************************************************/
@@ -655,4 +656,142 @@
   }
 
 
+  typedef struct  FT_OrientationExtremumRec_
+  {
+    FT_Int  index;
+    FT_Int  pos;
+    FT_Int  first;
+    FT_Int  last;
+  
+  } FT_OrientationExtremumRec;
+
+ 
+  static FT_Orientation
+  ft_orientation_extremum_compute( FT_OrientationExtremumRec*  extremum,
+                                   FT_Outline*                 outline )
+  {
+    FT_Vector  *point, *first, *last, *prev, *next;
+    FT_Vector*  points = outline->points;
+    FT_Angle    angle_in, angle_out;
+    
+
+    /* compute the previous and next points in the same contour */
+    point = points + extremum->index;
+    first = points + extremum->first;
+    last  = points + extremum->last;
+   
+    do
+    {
+      prev = ( point == first ) ? last : point - 1;
+     
+      if ( prev == point )
+        return FT_ORIENTATION_TRUETYPE;  /* degenerate case */
+      
+    } while ( prev->x != point->x || prev->y != point->y );
+    
+    do
+    {
+      next = ( point == last ) ? first : point + 1;
+      
+      if ( next == point )
+        return FT_ORIENTATION_TRUETYPE;  /* shouldn't happen */
+        
+    } while ( next->x != point->x || next->y != point->y );
+    
+    /* now compute the orientation of the `out' vector relative */
+    /* to the `in' vector.                                      */
+    angle_in  = FT_Atan2( point->x - prev->x,  point->y - prev->y );
+    angle_out = FT_Atan2( next->x  - point->x, next->y  - point->y );
+    
+    return ( FT_Angle_Diff( angle_in, angle_out ) >= 0 )
+             ? FT_ORIENTATION_TRUETYPE
+             : FT_ORIENTATION_POSTSCRIPT;
+  }
+
+
+  FT_EXPORT_DEF( FT_Orientation )
+  FT_Outline_Get_Orientation( FT_Outline*  outline )
+  {
+    FT_Orientation  result = FT_ORIENTATION_TRUETYPE;
+    
+
+    if ( outline && outline->n_points > 0 )
+    {
+      FT_OrientationExtremumRec  xmin, ymin, xmax, ymax;
+      FT_Int                     n;
+      FT_Int                     first, last;
+      FT_Vector*                 points = outline->points;
+      
+
+      xmin.pos = ymin.pos = +32768L;
+      xmax.pos = ymax.pos = -32768L;
+      
+      xmin.index = ymin.index = xmax.index = ymax.index = -1;
+
+      first = 0;
+      for ( n = 0; n < outline->n_contours; n++, first = last + 1 )
+      {
+        last = outline->contours[n];
+
+        /* skip single-point contours; these are degenerated cases */
+        if ( last > first + 1 )
+        {
+          FT_Int  i;
+          
+
+          for ( i = first; i < last; i++ )
+          {
+            FT_Pos  x = points[i].x;
+            FT_Pos  y = points[i].y;
+            
+
+            if ( x < xmin.pos )
+            {
+              xmin.pos   = x;
+              xmin.index = i;
+              xmin.first = first;
+              xmin.last  = last;
+            }
+            if ( x > xmax.pos )
+            {
+              xmax.pos   = x;
+              xmax.index = i;
+              xmax.first = first;
+              xmax.last  = last;
+            }
+            if ( y < ymin.pos )
+            {
+              ymin.pos   = y;
+              ymin.index = i;
+              ymin.first = first;
+              ymin.last  = last;
+            }
+            if ( y > ymax.pos )
+            {
+              ymax.pos   = y;
+              ymax.index = i;
+              ymax.first = first;
+              ymax.last  = last;
+            }
+          }
+        }
+        
+        if ( xmin.index >= 0 )
+          result = ft_orientation_extremum_compute( &xmin, outline );
+          
+        else if ( xmax.index >= 0 )
+          result = ft_orientation_extremum_compute( &xmax, outline );
+          
+        else if ( ymin.index >= 0 )
+          result = ft_orientation_extremum_compute( &ymin, outline );
+          
+        else if ( ymax.index >= 0 )
+          result = ft_orientation_extremum_compute( &ymax, outline );
+      }
+    }
+    
+    return result;
+  }
+
+
 /* END */

Index: ftpfr.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftpfr.c,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -d -r1.1 -r1.1.4.1
--- a/ftpfr.c	25 Nov 2003 19:27:19 -0000	1.1
+++ b/ftpfr.c	15 Apr 2004 10:14:31 -0000	1.1.4.1
@@ -2,9 +2,9 @@
 /*                                                                         */
 /*  ftpfr.c                                                                */
 /*                                                                         */
-/*    FreeType API for accessing PFR-specific data                         */
+/*    FreeType API for accessing PFR-specific data (body).                 */
 /*                                                                         */
-/*  Copyright 2002 by                                                      */
+/*  Copyright 2002, 2003 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -16,48 +16,36 @@
 /***************************************************************************/
 
 #include <ft2build.h>
-#include FT_INTERNAL_PFR_H
 #include FT_INTERNAL_OBJECTS_H
+#include FT_SERVICE_PFR_H
 
 
- /* check the format */
-  static FT_Error
-  ft_pfr_check( FT_Face           face,
-                FT_PFR_Service   *aservice )
+  /* check the format */
+  static FT_Service_PfrMetrics
+  ft_pfr_check( FT_Face  face )
   {
-    FT_Error  error = FT_Err_Bad_Argument;
+    FT_Service_PfrMetrics  service;
 
-    if ( face && face->driver )
-    {
-      FT_Module    module = (FT_Module) face->driver;
-      const char*  name   = module->clazz->module_name;
 
-      if ( name[0] == 'p' &&
-           name[1] == 'f' &&
-           name[2] == 'r' &&
-           name[4] == 0   )
-      {
-        *aservice = (FT_PFR_Service) module->clazz->module_interface;
-        error = 0;
-      }
-    }
-    return error;
-  }
+    FT_FACE_LOOKUP_SERVICE( face, service, PFR_METRICS );
 
+    return service;
+  }
 
 
   FT_EXPORT_DEF( FT_Error )
-  FT_Get_PFR_Metrics( FT_Face     face,
-                      FT_UInt    *aoutline_resolution,
-                      FT_UInt    *ametrics_resolution,
-                      FT_Fixed   *ametrics_x_scale,
-                      FT_Fixed   *ametrics_y_scale )
+  FT_Get_PFR_Metrics( FT_Face    face,
+                      FT_UInt   *aoutline_resolution,
+                      FT_UInt   *ametrics_resolution,
+                      FT_Fixed  *ametrics_x_scale,
+                      FT_Fixed  *ametrics_y_scale )
   {
-    FT_Error        error;
-    FT_PFR_Service  service;
+    FT_Error               error = FT_Err_Ok;
+    FT_Service_PfrMetrics  service;
 
-    error = ft_pfr_check( face, &service );
-    if ( !error )
+
+    service = ft_pfr_check( face );
+    if ( service )
     {
       error = service->get_metrics( face,
                                     aoutline_resolution,
@@ -65,41 +53,74 @@
                                     ametrics_x_scale,
                                     ametrics_y_scale );
     }
+    else if ( face )
+    {
+      FT_Fixed  x_scale, y_scale;
+
+
+      /* this is not a PFR font */
+      *aoutline_resolution = face->units_per_EM;
+      *ametrics_resolution = face->units_per_EM;
+
+      x_scale = y_scale = 0x10000L;
+      if ( face->size )
+      {
+        x_scale = face->size->metrics.x_scale;
+        y_scale = face->size->metrics.y_scale;
+      }
+      *ametrics_x_scale = x_scale;
+      *ametrics_y_scale = y_scale;
+    }
+    else
+      error = FT_Err_Invalid_Argument;
+
     return error;
   }
 
+
   FT_EXPORT_DEF( FT_Error )
   FT_Get_PFR_Kerning( FT_Face     face,
                       FT_UInt     left,
                       FT_UInt     right,
                       FT_Vector  *avector )
   {
-    FT_Error        error;
-    FT_PFR_Service  service;
+    FT_Error               error;
+    FT_Service_PfrMetrics  service;
 
-    error = ft_pfr_check( face, &service );
-    if ( !error )
-    {
+
+    service = ft_pfr_check( face );
+    if ( service )
       error = service->get_kerning( face, left, right, avector );
-    }
+    else if ( face )
+      error = FT_Get_Kerning( face, left, right,
+                              FT_KERNING_UNSCALED, avector );
+    else
+      error = FT_Err_Invalid_Argument;
+
     return error;
   }
 
 
   FT_EXPORT_DEF( FT_Error )
-  FT_Get_PFR_Advance( FT_Face    face,
-                      FT_UInt    gindex,
-                      FT_Pos    *aadvance )
+  FT_Get_PFR_Advance( FT_Face   face,
+                      FT_UInt   gindex,
+                      FT_Pos   *aadvance )
   {
-    FT_Error        error;
-    FT_PFR_Service  service;
+    FT_Error               error;
+    FT_Service_PfrMetrics  service;
 
-    error = ft_pfr_check( face, &service );
-    if ( !error )
+
+    service = ft_pfr_check( face );
+    if ( service )
     {
       error = service->get_advance( face, gindex, aadvance );
     }
+    else
+      /* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */
+      error = FT_Err_Invalid_Argument;
+
     return error;
   }
 
+
 /* END */

Index: ftsynth.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftsynth.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/ftsynth.c	26 Nov 2003 22:48:25 -0000	1.1.4.1
+++ b/ftsynth.c	15 Apr 2004 10:14:31 -0000	1.1.4.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType synthesizing code for emboldening and slanting (body).      */
 /*                                                                         */
-/*  Copyright 2000-2001 by                                                 */
+/*  Copyright 2000-2001, 2002 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -82,14 +82,14 @@
 
     /* we need to compute the `previous' and `next' point */
     /* for these extrema.                                 */
-    cur   = outline->points + n;
-    prev  = cur - 1;
-    next  = cur + 1;
+    cur  = outline->points + n;
+    prev = cur - 1;
+    next = cur + 1;
 
     first = 0;
     for ( c = 0; c < outline->n_contours; c++ )
     {
-      last  = outline->contours[c];
+      last = outline->contours[c];
 
       if ( n == first )
         prev = outline->points + last;

Index: fttrigon.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/fttrigon.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/fttrigon.c	26 Nov 2003 22:48:25 -0000	1.1.4.1
+++ b/fttrigon.c	15 Apr 2004 10:14:31 -0000	1.1.4.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType trigonometric functions (body).                             */
 /*                                                                         */
-/*  Copyright 2001 by                                                      */
+/*  Copyright 2001, 2002, 2003 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -71,10 +71,10 @@
     val = ( val >= 0 ) ? val : -val;
 
     v1 = (FT_UInt32)val >> 16;
-    v2 = (FT_UInt32)val & 0xFFFF;
+    v2 = (FT_UInt32)val & 0xFFFFL;
 
     k1 = FT_TRIG_SCALE >> 16;       /* constant */
-    k2 = FT_TRIG_SCALE & 0xFFFF;    /* constant */
+    k2 = FT_TRIG_SCALE & 0xFFFFL;   /* constant */
 
     hi   = k1 * v1;
     lo1  = k1 * v2 + k2 * v1;       /* can't overflow */
@@ -356,6 +356,14 @@
   }
 
 
+  /* these macros return 0 for positive numbers,
+     and -1 for negative ones */
+#define FT_SIGN_LONG( x )   ( (x) >> ( FT_SIZEOF_LONG * 8 - 1 ) )
+#define FT_SIGN_INT( x )    ( (x) >> ( FT_SIZEOF_INT * 8 - 1 ) )
+#define FT_SIGN_INT32( x )  ( (x) >> 31 )
+#define FT_SIGN_INT16( x )  ( (x) >> 15 )
+
+
   /* documentation is in fttrigon.h */
 
   FT_EXPORT_DEF( void )
@@ -376,10 +384,13 @@
       v.x = ft_trig_downscale( v.x );
       v.y = ft_trig_downscale( v.y );
 
-      if ( shift >= 0 )
+      if ( shift > 0 )
       {
-        vec->x = v.x >> shift;
-        vec->y = v.y >> shift;
+        FT_Int32  half = 1L << ( shift - 1 );
+
+
+        vec->x = ( v.x + half + FT_SIGN_LONG( v.x ) ) >> shift;
+        vec->y = ( v.y + half + FT_SIGN_LONG( v.y ) ) >> shift;
       }
       else
       {

Index: fttype1.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/fttype1.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/fttype1.c	26 Nov 2003 22:48:25 -0000	1.1.4.1
+++ b/fttype1.c	15 Apr 2004 10:14:31 -0000	1.1.4.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType utility file for PS names support (body).                   */
 /*                                                                         */
-/*  Copyright 2002 by                                                      */
+/*  Copyright 2002, 2003 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -17,9 +17,9 @@
 
 
 #include <ft2build.h>
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_TYPE42_TYPES_H
 #include FT_INTERNAL_OBJECTS_H
+#include FT_INTERNAL_SERVICE_H
+#include FT_SERVICE_POSTSCRIPT_INFO_H
 
 
   /* documentation is in t1tables.h */
@@ -28,56 +28,39 @@
   FT_Get_PS_Font_Info( FT_Face          face,
                        PS_FontInfoRec*  afont_info )
   {
-    PS_FontInfo  font_info = NULL;
-    FT_Error     error     = FT_Err_Invalid_Argument;
-    const char*  driver_name;
+    FT_Error  error = FT_Err_Invalid_Argument;
 
 
-    if ( face && face->driver && face->driver->root.clazz )
-    {
-      driver_name = face->driver->root.clazz->module_name;
-      if ( ft_strcmp( driver_name, "type1" ) == 0 )
-        font_info = &((T1_Face)face)->type1.font_info;
-      else if ( ft_strcmp( driver_name, "t1cid" ) == 0 )
-        font_info = &((CID_Face)face)->cid.font_info;
-      else if ( ft_strcmp( driver_name, "type42" ) == 0 )
-        font_info = &((T42_Face)face)->type1.font_info;
-    }
-    if ( font_info != NULL )
+    if ( face )
     {
-      *afont_info = *font_info;
-      error = FT_Err_Ok;
+      FT_Service_PsInfo  service = NULL;
+
+
+      FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
+
+      if ( service && service->ps_get_font_info )
+        error = service->ps_get_font_info( face, afont_info );
     }
 
     return error;
   }
 
 
-  /* XXX: Bad hack, but I didn't want to change several drivers here. */
-
   /* documentation is in t1tables.h */
 
   FT_EXPORT_DEF( FT_Int )
   FT_Has_PS_Glyph_Names( FT_Face  face )
   {
-    FT_Int       result = 0;
-    const char*  driver_name;
+    FT_Int             result  = 0;
+    FT_Service_PsInfo  service = NULL;
 
 
-    if ( face && face->driver && face->driver->root.clazz )
+    if ( face )
     {
-      /* Currently, only the type1, type42, and cff drivers provide */
-      /* reliable glyph names...                                    */
-
-      /* We could probably hack the TrueType driver to recognize    */
-      /* certain cases where the glyph names are most certainly     */
-      /* correct (e.g. using a 20 or 22 format `post' table), but   */
-      /* this will probably happen later...                         */
+      FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
 
-      driver_name = face->driver->root.clazz->module_name;
-      result      = ( ft_strcmp( driver_name, "type1"  ) == 0 ||
-                      ft_strcmp( driver_name, "type42" ) == 0 ||
-                      ft_strcmp( driver_name, "cff"    ) == 0 );
+      if ( service && service->ps_has_glyph_names )
+        result = service->ps_has_glyph_names( face );
     }
 
     return result;

Index: ftwinfnt.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftwinfnt.c,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -d -r1.1 -r1.1.4.1
--- a/ftwinfnt.c	25 Nov 2003 19:27:19 -0000	1.1
+++ b/ftwinfnt.c	15 Apr 2004 10:14:31 -0000	1.1.4.1
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType API for accessing Windows FNT specific info (body).         */
 /*                                                                         */
-/*  Copyright 2002 by                                                      */
+/*  Copyright 2003 by                                                      */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -18,36 +18,30 @@
 
 #include <ft2build.h>
 #include FT_WINFONTS_H
-#include FT_INTERNAL_FNT_TYPES_H
 #include FT_INTERNAL_OBJECTS_H
+#include FT_SERVICE_WINFNT_H
 
 
   FT_EXPORT_DEF( FT_Error )
-  FT_Get_WinFNT_Header( FT_Face              face,
-                        FT_WinFNT_HeaderRec *header )
+  FT_Get_WinFNT_Header( FT_Face               face,
+                        FT_WinFNT_HeaderRec  *header )
   {
-    FT_Error     error;
+    FT_Service_WinFnt  service;
+    FT_Error           error;
+
 
     error = FT_Err_Invalid_Argument;
 
-    if ( face != NULL && face->driver != NULL )
+    if ( face != NULL )
     {
-      FT_Module  driver = (FT_Module) face->driver;
-
+      FT_FACE_LOOKUP_SERVICE( face, service, WINFNT );
 
-      if ( driver->clazz && driver->clazz->module_name              &&
-           ft_strcmp( driver->clazz->module_name, "winfonts" ) == 0 )
+      if ( service != NULL )
       {
-        FNT_Size  size = (FNT_Size)face->size;
-        FNT_Font  font = size->font;
-
-        if (font)
-        {
-          FT_MEM_COPY( header, &font->header, sizeof(*header) );
-          error    = 0;
-        }
+        error = service->get_header( face, header );
       }
     }
+
     return error;
   }
 

Index: ftxf86.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftxf86.c,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -d -r1.1 -r1.1.4.1
--- a/ftxf86.c	14 Nov 2003 16:48:24 -0000	1.1
+++ b/ftxf86.c	15 Apr 2004 10:14:31 -0000	1.1.4.1
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType utility file for X11 support (body).                        */
 /*                                                                         */
-/*  Copyright 2002 by                                                      */
+/*  Copyright 2002, 2003 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -19,59 +19,16 @@
 #include <ft2build.h>
 #include FT_XFREE86_H
 #include FT_INTERNAL_OBJECTS_H
-
-  /* XXX: This really is a sad hack, but I didn't want to change every     */
-  /*      driver just to support this at the moment, since other important */
-  /*      changes are coming anyway.                                       */
-
-  typedef struct  FT_FontFormatRec_
-  {
-    const char*  driver_name;
-    const char*  format_name;
-
-  } FT_FontFormatRec;
-
+#include FT_SERVICE_XFREE86_NAME_H
 
   FT_EXPORT_DEF( const char* )
   FT_Get_X11_Font_Format( FT_Face  face )
   {
-    static const FT_FontFormatRec  font_formats[] =
-    {
-      { "type1",    "Type 1" },
-      { "truetype", "TrueType" },
-      { "bdf",      "BDF" },
-      { "pcf",      "PCF" },
-      { "type42",   "Type 42" },
-      { "cidtype1", "CID Type 1" },
-      { "cff",      "CFF" },
-      { "pfr",      "PFR" },
-      { "winfonts",   "Windows FNT" }
-    };
-
     const char*  result = NULL;
 
 
-    if ( face && face->driver )
-    {
-      FT_Module  driver = (FT_Module)face->driver;
-
-
-      if ( driver->clazz && driver->clazz->module_name )
-      {
-        FT_Int  n;
-        FT_Int  count = sizeof( font_formats ) / sizeof ( font_formats[0] );
-
-
-        result = driver->clazz->module_name;
-
-        for ( n = 0; n < count; n++ )
-          if ( ft_strcmp( result, font_formats[n].driver_name ) == 0 )
-          {
-            result = font_formats[n].format_name;
-            break;
-          }
-      }
-    }
+    if ( face )
+      FT_FACE_FIND_SERVICE( face, result, XF86_NAME );
 
     return result;
   }

Index: rules.mk
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/base/rules.mk,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/rules.mk	26 Nov 2003 22:48:26 -0000	1.1.4.1
+++ b/rules.mk	15 Apr 2004 10:14:31 -0000	1.1.4.2
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2002 by
+# Copyright 1996-2000, 2002, 2003 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -25,23 +25,23 @@
 # BASE_H is defined in freetype.mk to simplify the dependency rules.
 
 
-BASE_COMPILE := $(FT_COMPILE) $I$(SRC_)base
+BASE_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SRC_DIR)/base)
 
 
 # Base layer sources
 #
 #   ftsystem, ftinit, and ftdebug are handled by freetype.mk
 #
-BASE_SRC := $(BASE_)ftcalc.c   \
-            $(BASE_)fttrigon.c \
-            $(BASE_)ftutil.c   \
-            $(BASE_)ftstream.c \
-            $(BASE_)ftgloadr.c \
-            $(BASE_)ftoutln.c  \
-            $(BASE_)ftobjs.c   \
-            $(BASE_)ftapi.c    \
-            $(BASE_)ftnames.c  \
-            $(BASE_)ftdbgmem.c
+BASE_SRC := $(BASE_DIR)/ftcalc.c   \
+            $(BASE_DIR)/fttrigon.c \
+            $(BASE_DIR)/ftutil.c   \
+            $(BASE_DIR)/ftstream.c \
+            $(BASE_DIR)/ftgloadr.c \
+            $(BASE_DIR)/ftoutln.c  \
+            $(BASE_DIR)/ftobjs.c   \
+            $(BASE_DIR)/ftapi.c    \
+            $(BASE_DIR)/ftnames.c  \
+            $(BASE_DIR)/ftdbgmem.c
 
 # Base layer `extensions' sources
 #
@@ -49,19 +49,19 @@
 # object.  It will then be linked to the final executable only if one of its
 # symbols is used by the application.
 #
-BASE_EXT_SRC := $(BASE_)ftglyph.c   \
-                $(BASE_)ftmm.c      \
-                $(BASE_)ftbdf.c     \
-                $(BASE_)fttype1.c   \
-                $(BASE_)ftxf86.c    \
-                $(BASE_)ftpfr.c     \
-                $(BASE_)ftstroker.c \
-                $(BASE_)ftwinfnt.c  \
-                $(BASE_)ftbbox.c
+BASE_EXT_SRC := $(BASE_DIR)/ftglyph.c  \
+                $(BASE_DIR)/ftmm.c     \
+                $(BASE_DIR)/ftbdf.c    \
+                $(BASE_DIR)/fttype1.c  \
+                $(BASE_DIR)/ftxf86.c   \
+                $(BASE_DIR)/ftpfr.c    \
+                $(BASE_DIR)/ftstroke.c \
+                $(BASE_DIR)/ftwinfnt.c \
+                $(BASE_DIR)/ftbbox.c
 
 # Default extensions objects
 #
-BASE_EXT_OBJ := $(BASE_EXT_SRC:$(BASE_)%.c=$(OBJ_)%.$O)
+BASE_EXT_OBJ := $(BASE_EXT_SRC:$(BASE_DIR)/%.c=$(OBJ_DIR)/%.$O)
 
 
 # Base layer object(s)
@@ -72,23 +72,24 @@
 #   BASE_OBJ_S is used during `single' builds (the whole base layer is
 #   compiled as a single object file using ftbase.c).
 #
-BASE_OBJ_M := $(BASE_SRC:$(BASE_)%.c=$(OBJ_)%.$O)
-BASE_OBJ_S := $(OBJ_)ftbase.$O
+BASE_OBJ_M := $(BASE_SRC:$(BASE_DIR)/%.c=$(OBJ_DIR)/%.$O)
+BASE_OBJ_S := $(OBJ_DIR)/ftbase.$O
 
 # Base layer root source file for single build
 #
-BASE_SRC_S := $(BASE_)ftbase.c
+BASE_SRC_S := $(BASE_DIR)/ftbase.c
 
 
 # Base layer - single object build
 #
 $(BASE_OBJ_S): $(BASE_SRC_S) $(BASE_SRC) $(FREETYPE_H)
-	$(BASE_COMPILE) $T$@ $(BASE_SRC_S)
+	$(BASE_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(BASE_SRC_S))
 
 
 # Multiple objects build + extensions
 #
-$(OBJ_)%.$O: $(BASE_)%.c $(FREETYPE_H)
-	$(BASE_COMPILE) $T$@ $<
+$(OBJ_DIR)/%.$O: $(BASE_DIR)/%.c $(FREETYPE_H)
+	$(BASE_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
+
 
 # EOF

--- ftstroker.c DELETED ---




More information about the xorg-commit-diffs mailing list