[xorg-commit-diffs] xc/extras/freetype2/src/truetype rules.mk, 1.1, 1.1.4.1 ttdriver.c, 1.1.4.1, 1.1.4.2 ttgload.c, 1.1.4.1, 1.1.4.2 ttgload.h, 1.1.4.1, 1.1.4.2 ttinterp.c, 1.1.4.1, 1.1.4.2 ttobjs.c, 1.1.4.1, 1.1.4.2 ttobjs.h, 1.1.4.1, 1.1.4.2

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


Committed by: eich

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

Modified Files:
      Tag: XORG-CURRENT
	rules.mk ttdriver.c ttgload.c ttgload.h ttinterp.c ttobjs.c 
	ttobjs.h 
Log Message:
2004-04-15  Egbert Eich  <eich at freedesktop.org>
        Merged changes from RELEASE-1 branch
	


Index: rules.mk
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/truetype/rules.mk,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -d -r1.1 -r1.1.4.1
--- a/rules.mk	14 Nov 2003 16:48:24 -0000	1.1
+++ b/rules.mk	15 Apr 2004 10:14:43 -0000	1.1.4.1
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2001 by
+# Copyright 1996-2000, 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,27 +15,26 @@
 
 # TrueType driver directory
 #
-TT_DIR  := $(SRC_)truetype
-TT_DIR_ := $(TT_DIR)$(SEP)
+TT_DIR := $(SRC_DIR)/truetype
 
 
 # compilation flags for the driver
 #
-TT_COMPILE := $(FT_COMPILE) $I$(TT_DIR)
+TT_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(TT_DIR))
 
 
 # TrueType driver sources (i.e., C files)
 #
-TT_DRV_SRC := $(TT_DIR_)ttobjs.c   \
-              $(TT_DIR_)ttpload.c  \
-              $(TT_DIR_)ttgload.c  \
-              $(TT_DIR_)ttinterp.c \
-              $(TT_DIR_)ttdriver.c
+TT_DRV_SRC := $(TT_DIR)/ttobjs.c   \
+              $(TT_DIR)/ttpload.c  \
+              $(TT_DIR)/ttgload.c  \
+              $(TT_DIR)/ttinterp.c \
+              $(TT_DIR)/ttdriver.c
 
 # TrueType driver headers
 #
 TT_DRV_H := $(TT_DRV_SRC:%.c=%.h) \
-            $(TT_DIR_)tterrors.h
+            $(TT_DIR)/tterrors.h
 
 
 # TrueType driver object(s)
@@ -43,24 +42,24 @@
 #   TT_DRV_OBJ_M is used during `multi' builds
 #   TT_DRV_OBJ_S is used during `single' builds
 #
-TT_DRV_OBJ_M := $(TT_DRV_SRC:$(TT_DIR_)%.c=$(OBJ_)%.$O)
-TT_DRV_OBJ_S := $(OBJ_)truetype.$O
+TT_DRV_OBJ_M := $(TT_DRV_SRC:$(TT_DIR)/%.c=$(OBJ_DIR)/%.$O)
+TT_DRV_OBJ_S := $(OBJ_DIR)/truetype.$O
 
 # TrueType driver source file for single build
 #
-TT_DRV_SRC_S := $(TT_DIR_)truetype.c
+TT_DRV_SRC_S := $(TT_DIR)/truetype.c
 
 
 # TrueType driver - single object
 #
 $(TT_DRV_OBJ_S): $(TT_DRV_SRC_S) $(TT_DRV_SRC) $(FREETYPE_H) $(TT_DRV_H)
-	$(TT_COMPILE) $T$@ $(TT_DRV_SRC_S)
+	$(TT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(TT_DRV_SRC_S))
 
 
 # driver - multiple objects
 #
-$(OBJ_)%.$O: $(TT_DIR_)%.c $(FREETYPE_H) $(TT_DRV_H)
-	$(TT_COMPILE) $T$@ $<
+$(OBJ_DIR)/%.$O: $(TT_DIR)/%.c $(FREETYPE_H) $(TT_DRV_H)
+	$(TT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
 
 
 # update main driver object lists
@@ -68,4 +67,5 @@
 DRV_OBJS_S += $(TT_DRV_OBJ_S)
 DRV_OBJS_M += $(TT_DRV_OBJ_M)
 
+
 # EOF

Index: ttdriver.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/truetype/ttdriver.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/ttdriver.c	26 Nov 2003 22:48:28 -0000	1.1.4.1
+++ b/ttdriver.c	15 Apr 2004 10:14:43 -0000	1.1.4.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType font driver implementation (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,       */
@@ -21,6 +21,7 @@
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_SFNT_H
 #include FT_TRUETYPE_IDS_H
+#include FT_SERVICE_XFREE86_NAME_H
 
 #include "ttdriver.h"
 #include "ttgload.h"
@@ -115,7 +116,7 @@
 
       while ( left <= right )
       {
-        FT_Int    middle = left + ( ( right - left ) >> 1 );
+        FT_Long   middle = left + ( ( right - left ) >> 1 );
         FT_ULong  cur_pair;
 
 
@@ -226,7 +227,7 @@
 
     size->ttmetrics.valid = FALSE;
 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-    size->strike_index    = 0xFFFF;
+    size->strike_index    = 0xFFFFU;
 #endif
 
     return tt_size_reset( size );
@@ -242,11 +243,6 @@
   /*    A driver method used to reset a size's character sizes (horizontal */
   /*    and vertical) expressed in integer pixels.                         */
   /*                                                                       */
-  /* <Input>                                                               */
-  /*    pixel_width  :: The character width expressed in integer pixels.   */
-  /*                                                                       */
-  /*    pixel_height :: The character height expressed in integer pixels.  */
-  /*                                                                       */
   /* <InOut>                                                               */
   /*    size         :: A handle to the target size object.                */
   /*                                                                       */
@@ -254,19 +250,14 @@
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   static FT_Error
-  Set_Pixel_Sizes( TT_Size  size,
-                   FT_UInt  pixel_width,
-                   FT_UInt  pixel_height )
+  Set_Pixel_Sizes( TT_Size  size )
   {
-    FT_UNUSED( pixel_width );
-    FT_UNUSED( pixel_height );
-
     /* many things have been pre-computed by the base layer */
 
     size->metrics         = size->root.metrics;
     size->ttmetrics.valid = FALSE;
 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-    size->strike_index    = 0xFFFF;
+    size->strike_index    = 0xFFFFU;
 #endif
 
     return tt_size_reset( size );
@@ -354,17 +345,27 @@
   /*************************************************************************/
   /*************************************************************************/
 
+  static const FT_ServiceDescRec  tt_services[] =
+  {
+    { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TRUETYPE },
+    { NULL, NULL }
+  };
 
   static FT_Module_Interface
   tt_get_interface( TT_Driver    driver,
                     const char*  tt_interface )
   {
-    FT_Module     sfntd = FT_Get_Module( driver->root.root.library,
-                                         "sfnt" );
-    SFNT_Service  sfnt;
+    FT_Module_Interface  result;
+    FT_Module            sfntd;
+    SFNT_Service         sfnt;
 
 
+    result = ft_service_list_lookup( tt_services, tt_interface );
+    if ( result != NULL )
+      return result;
+
     /* only return the default interface from the SFNT module */
+    sfntd = FT_Get_Module( driver->root.root.library, "sfnt" );
     if ( sfntd )
     {
       sfnt = (SFNT_Service)( sfntd->clazz->module_interface );
@@ -382,10 +383,10 @@
   const FT_Driver_ClassRec  tt_driver_class =
   {
     {
-      ft_module_font_driver     |
-      ft_module_driver_scalable |
+      FT_MODULE_FONT_DRIVER        |
+      FT_MODULE_DRIVER_SCALABLE    |
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
-      ft_module_driver_has_hinter,
+      FT_MODULE_DRIVER_HAS_HINTER,
 #else
       0,
 #endif
@@ -408,20 +409,20 @@
     sizeof ( FT_GlyphSlotRec ),
 
 
-    (FT_Face_InitFunc)        tt_face_init,
-    (FT_Face_DoneFunc)        tt_face_done,
-    (FT_Size_InitFunc)        tt_size_init,
-    (FT_Size_DoneFunc)        tt_size_done,
-    (FT_Slot_InitFunc)        0,
-    (FT_Slot_DoneFunc)        0,
+    (FT_Face_InitFunc)       tt_face_init,
+    (FT_Face_DoneFunc)       tt_face_done,
+    (FT_Size_InitFunc)       tt_size_init,
+    (FT_Size_DoneFunc)       tt_size_done,
+    (FT_Slot_InitFunc)       0,
+    (FT_Slot_DoneFunc)       0,
 
-    (FT_Size_ResetPointsFunc) Set_Char_Sizes,
-    (FT_Size_ResetPixelsFunc) Set_Pixel_Sizes,
-    (FT_Slot_LoadFunc)        Load_Glyph,
+    (FT_Size_ResetPointsFunc)Set_Char_Sizes,
+    (FT_Size_ResetPixelsFunc)Set_Pixel_Sizes,
+    (FT_Slot_LoadFunc)       Load_Glyph,
 
-    (FT_Face_GetKerningFunc)  Get_Kerning,
-    (FT_Face_AttachFunc)      0,
-    (FT_Face_GetAdvancesFunc) 0
+    (FT_Face_GetKerningFunc) Get_Kerning,
+    (FT_Face_AttachFunc)     0,
+    (FT_Face_GetAdvancesFunc)0
   };
 
 

Index: ttgload.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/truetype/ttgload.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/ttgload.c	26 Nov 2003 22:48:28 -0000	1.1.4.1
+++ b/ttgload.c	15 Apr 2004 10:14:43 -0000	1.1.4.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType Glyph Loader (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,       */
@@ -294,36 +294,39 @@
     FT_Int          n, n_points;
     FT_Int          byte_len   = load->byte_len;
 
+    FT_Byte         *flag, *flag_limit;
+    FT_Byte         c, count;
+    FT_Vector       *vec, *vec_limit;
+    FT_Pos          x;
+    FT_Short        *cont, *cont_limit;
 
-    /* reading the contours endpoints & number of points */
-    {
-      short*  cur   = gloader->current.outline.contours;
-      short*  limit = cur + n_contours;
 
+    /* reading the contours endpoints & number of points */
+    cont       = gloader->current.outline.contours;
+    cont_limit = cont + n_contours;
 
-      /* check space for contours array + instructions count */
-      byte_len -= 2 * ( n_contours + 1 );
-      if ( byte_len < 0 )
-        goto Invalid_Outline;
+    /* check space for contours array + instructions count */
+    byte_len -= 2 * ( n_contours + 1 );
+    if ( byte_len < 0 )
+      goto Invalid_Outline;
 
-      for ( ; cur < limit; cur++ )
-        cur[0] = FT_GET_USHORT();
+    for ( ; cont < cont_limit; cont++ )
+      cont[0] = FT_GET_USHORT();
 
-      n_points = 0;
-      if ( n_contours > 0 )
-        n_points = cur[-1] + 1;
+    n_points = 0;
+    if ( n_contours > 0 )
+      n_points = cont[-1] + 1;
 
-      error = FT_GlyphLoader_CheckPoints( gloader, n_points + 2, 0 );
-      if ( error )
-        goto Fail;
+    error = FT_GlyphLoader_CheckPoints( gloader, n_points + 2, 0 );
+    if ( error )
+      goto Fail;
 
-      /* we'd better check the contours table right now */
-      outline = &gloader->current.outline;
+    /* we'd better check the contours table right now */
+    outline = &gloader->current.outline;
 
-      for ( cur = outline->contours + 1; cur < limit; cur++ )
-        if ( cur[-1] >= cur[0] )
-          goto Invalid_Outline;
-    }
+    for ( cont = outline->contours + 1; cont < cont_limit; cont++ )
+      if ( cont[-1] >= cont[0] )
+        goto Invalid_Outline;
 
     /* reading the bytecode instructions */
     slot->control_len  = 0;
@@ -331,7 +334,7 @@
 
     n_ins = FT_GET_USHORT();
 
-    FT_TRACE5(( "  Instructions size: %d\n", n_ins ));
+    FT_TRACE5(( "  Instructions size: %u\n", n_ins ));
 
     if ( n_ins > face->max_profile.maxSizeOfInstructions )
     {
@@ -340,7 +343,7 @@
       goto Fail;
     }
 
-    byte_len -= n_ins;
+    byte_len -= (FT_Int)n_ins;
     if ( byte_len < 0 )
     {
       FT_TRACE0(( "TT_Load_Simple_Glyph: Instruction count mismatch!\n" ));
@@ -357,112 +360,102 @@
       slot->control_len  = n_ins;
       slot->control_data = load->instructions;
 
-      FT_MEM_COPY( load->instructions, stream->cursor, n_ins );
+      FT_MEM_COPY( load->instructions, stream->cursor, (FT_Long)n_ins );
     }
 
 #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
 
-    stream->cursor += n_ins;
+    stream->cursor += (FT_Int)n_ins;
 
     /* reading the point tags */
-    {
-      FT_Byte*  flag  = (FT_Byte*)outline->tags;
-      FT_Byte*  limit = flag + n_points;
-      FT_Byte   c, count;
+    flag       = (FT_Byte*)outline->tags;
+    flag_limit = flag + n_points;
 
+    while ( flag < flag_limit )
+    {
+      if ( --byte_len < 0 )
+        goto Invalid_Outline;
 
-      while ( flag < limit )
+      *flag++ = c = FT_GET_BYTE();
+      if ( c & 8 )
       {
         if ( --byte_len < 0 )
           goto Invalid_Outline;
 
-        *flag++ = c = FT_GET_BYTE();
-        if ( c & 8 )
-        {
-          if ( --byte_len < 0 )
-            goto Invalid_Outline;
-
-          count = FT_GET_BYTE();
-          if ( flag + count > limit )
-            goto Invalid_Outline;
+        count = FT_GET_BYTE();
+        if ( flag + (FT_Int)count > flag_limit )
+          goto Invalid_Outline;
 
-          for ( ; count > 0; count-- )
-            *flag++ = c;
-        }
+        for ( ; count > 0; count-- )
+          *flag++ = c;
       }
+    }
 
-      /* check that there is enough room to load the coordinates */
-      for ( flag = (FT_Byte*)outline->tags; flag < limit; flag++ )
-      {
-        if ( *flag & 2 )
-          byte_len -= 1;
-        else if ( ( *flag & 16 ) == 0 )
-          byte_len -= 2;
-
-        if ( *flag & 4 )
-          byte_len -= 1;
-        else if ( ( *flag & 32 ) == 0 )
-          byte_len -= 2;
-      }
+    /* check that there is enough room to load the coordinates */
+    for ( flag = (FT_Byte*)outline->tags; flag < flag_limit; flag++ )
+    {
+      if ( *flag & 2 )
+        byte_len -= 1;
+      else if ( ( *flag & 16 ) == 0 )
+        byte_len -= 2;
 
-      if ( byte_len < 0 )
-        goto Invalid_Outline;
+      if ( *flag & 4 )
+        byte_len -= 1;
+      else if ( ( *flag & 32 ) == 0 )
+        byte_len -= 2;
     }
 
+    if ( byte_len < 0 )
+      goto Invalid_Outline;
+
     /* reading the X coordinates */
 
+    vec       = outline->points;
+    vec_limit = vec + n_points;
+    flag      = (FT_Byte*)outline->tags;
+    x         = 0;
+
+    for ( ; vec < vec_limit; vec++, flag++ )
     {
-      FT_Vector*  vec   = outline->points;
-      FT_Vector*  limit = vec + n_points;
-      FT_Byte*    flag  = (FT_Byte*)outline->tags;
-      FT_Pos      x     = 0;
+      FT_Pos  y = 0;
 
 
-      for ( ; vec < limit; vec++, flag++ )
+      if ( *flag & 2 )
       {
-        FT_Pos  y = 0;
-
-
-        if ( *flag & 2 )
-        {
-          y = FT_GET_BYTE();
-          if ( ( *flag & 16 ) == 0 )
-            y = -y;
-        }
-        else if ( ( *flag & 16 ) == 0 )
-          y = FT_GET_SHORT();
-
-        x     += y;
-        vec->x = x;
+        y = (FT_Pos)FT_GET_BYTE();
+        if ( ( *flag & 16 ) == 0 )
+          y = -y;
       }
+      else if ( ( *flag & 16 ) == 0 )
+        y = (FT_Pos)FT_GET_SHORT();
+
+      x     += y;
+      vec->x = x;
     }
 
     /* reading the Y coordinates */
 
+    vec       = gloader->current.outline.points;
+    vec_limit = vec + n_points;
+    flag      = (FT_Byte*)outline->tags;
+    x         = 0;
+
+    for ( ; vec < vec_limit; vec++, flag++ )
     {
-      FT_Vector*  vec   = gloader->current.outline.points;
-      FT_Vector*  limit = vec + n_points;
-      FT_Byte*    flag  = (FT_Byte*)outline->tags;
-      FT_Pos      x     = 0;
+      FT_Pos  y = 0;
 
 
-      for ( ; vec < limit; vec++, flag++ )
+      if ( *flag & 4 )
       {
-        FT_Pos  y = 0;
-
-
-        if ( *flag & 4 )
-        {
-          y = FT_GET_BYTE();
-          if ( ( *flag & 32 ) == 0 )
-            y = -y;
-        }
-        else if ( ( *flag & 32 ) == 0 )
-          y = FT_GET_SHORT();
-
-        x     += y;
-        vec->y = x;
+        y = (FT_Pos)FT_GET_BYTE();
+        if ( ( *flag & 32 ) == 0 )
+          y = -y;
       }
+      else if ( ( *flag & 32 ) == 0 )
+        y = (FT_Pos)FT_GET_SHORT();
+
+      x     += y;
+      vec->y = x;
     }
 
     /* clear the touch tags */
@@ -779,6 +772,7 @@
     FT_Bool               glyph_data_loaded = 0;
 #endif
 
+
     if ( recurse_count >= TT_MAX_COMPOSITE_RECURSE )
     {
       error = TT_Err_Invalid_Composite;
@@ -823,9 +817,10 @@
       {
         FT_Incremental_MetricsRec  metrics;
 
-		metrics.bearing_x = left_bearing;
-		metrics.bearing_y = 0;
-		metrics.advance = advance_width;
+
+        metrics.bearing_x = left_bearing;
+        metrics.bearing_y = 0;
+        metrics.advance = advance_width;
         error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
                   face->root.internal->incremental_interface->object,
                   glyph_index, FALSE, &metrics );
@@ -884,7 +879,7 @@
       count  = 0;
 
       if ( glyph_index < (FT_UInt)face->num_locations - 1 )
-        count = face->glyph_locations[glyph_index + 1] - offset;
+        count = (FT_UInt)( face->glyph_locations[glyph_index + 1] - offset );
     }
 
     if ( count == 0 )
@@ -1066,7 +1061,7 @@
           num_base_points = gloader->base.outline.n_points;
 
           error = load_truetype_glyph( loader, subglyph->index,
-                                       recurse_count+1 );
+                                       recurse_count + 1 );
           if ( error )
             goto Fail;
 
@@ -1182,16 +1177,16 @@
   /*                                                                       */
   /* This algorithm is a guess and works much better than the above.       */
   /*                                                                       */
-              int  mac_xscale = FT_SqrtFixed(
-                                  FT_MulFix( subglyph->transform.xx,
-                                             subglyph->transform.xx ) +
-                                  FT_MulFix( subglyph->transform.xy,
-                                             subglyph->transform.xy) );
-              int  mac_yscale = FT_SqrtFixed(
-                                  FT_MulFix( subglyph->transform.yy,
-                                             subglyph->transform.yy ) +
-                                  FT_MulFix( subglyph->transform.yx,
-                                             subglyph->transform.yx ) );
+              FT_Fixed  mac_xscale = FT_SqrtFixed(
+                                       FT_MulFix( subglyph->transform.xx,
+                                                  subglyph->transform.xx ) +
+                                       FT_MulFix( subglyph->transform.xy,
+                                                  subglyph->transform.xy) );
+              FT_Fixed  mac_yscale = FT_SqrtFixed(
+                                       FT_MulFix( subglyph->transform.yy,
+                                                  subglyph->transform.yy ) +
+                                       FT_MulFix( subglyph->transform.yx,
+                                                  subglyph->transform.yx ) );
 
 
               x = FT_MulFix( x, mac_xscale );
@@ -1278,6 +1273,10 @@
           if ( error )
             goto Fail;
 
+          error = FT_GlyphLoader_CheckPoints( gloader, num_points + 2, 0 );
+          if ( error )
+            goto Fail;
+
           /* prepare the execution context */
           tt_prepare_zone( &exec->pts, &gloader->base,
                            start_point, start_contour );
@@ -1492,9 +1491,10 @@
         FT_Incremental_MetricsRec  metrics;
         FT_Error                   error = 0;
 
-		metrics.bearing_x = 0;
-		metrics.bearing_y = top_bearing;
-		metrics.advance = advance_height;
+
+        metrics.bearing_x = 0;
+        metrics.bearing_y = top_bearing;
+        metrics.advance = advance_height;
         error =
           face->root.internal->incremental_interface->funcs->get_glyph_metrics(
             face->root.internal->incremental_interface->object,
@@ -1640,9 +1640,9 @@
 
 
       error = sfnt->load_sbit_image( face,
-                                     size->strike_index,
-                                     glyph_index,
-                                     load_flags,
+                                     (FT_ULong)size->strike_index,
+                                     (FT_UInt)glyph_index,
+                                     (FT_Int)load_flags,
                                      stream,
                                      &glyph->bitmap,
                                      &metrics );
@@ -1681,7 +1681,7 @@
 
     /* return immediately if we only want the embedded bitmaps */
     if ( load_flags & FT_LOAD_SBITS_ONLY )
-      return FT_Err_Invalid_Argument;
+      return TT_Err_Invalid_Argument;
 
     /* seek to the beginning of the glyph table.  For Type 42 fonts      */
     /* the table might be accessed from a Postscript stream or something */

Index: ttgload.h
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/truetype/ttgload.h,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/ttgload.h	26 Nov 2003 22:48:28 -0000	1.1.4.1
+++ b/ttgload.h	15 Apr 2004 10:14:43 -0000	1.1.4.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType Glyph Loader (specification).                               */
 /*                                                                         */
-/*  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,       */
@@ -33,7 +33,7 @@
 
   FT_LOCAL( void )
   TT_Get_Metrics( TT_HoriHeader*  header,
-                  FT_UInt         index,
+                  FT_UInt         idx,
                   FT_Short*       bearing,
                   FT_UShort*      advance );
 

Index: ttinterp.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/truetype/ttinterp.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/ttinterp.c	26 Nov 2003 22:48:28 -0000	1.1.4.1
+++ b/ttinterp.c	15 Apr 2004 10:14:43 -0000	1.1.4.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType bytecode interpreter (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,       */
@@ -43,9 +43,6 @@
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_ttinterp
 
-#undef  NO_APPLE_PATENT
-#define APPLE_THRESHOLD  0x4000000L
-
   /*************************************************************************/
   /*                                                                       */
   /* In order to detect infinite loops in the code, we set up a counter    */
@@ -168,9 +165,6 @@
 #define CUR_Func_dualproj( x, y ) \
           CUR.func_dualproj( EXEC_ARG_ x, y )
 
-#define CUR_Func_freeProj( x, y ) \
-          CUR.func_freeProj( EXEC_ARG_ x, y )
-
 #define CUR_Func_round( d, c ) \
           CUR.func_round( EXEC_ARG_ d, c )
 
@@ -221,13 +215,22 @@
   /*                                                                       */
 #define BOUNDS( x, n )  ( (FT_UInt)(x) >= (FT_UInt)(n) )
 
-
 #undef  SUCCESS
 #define SUCCESS  0
 
 #undef  FAILURE
 #define FAILURE  1
 
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+#define GUESS_VECTOR( V )                                         \
+  if ( CUR.face->unpatented_hinting )                             \
+  {                                                               \
+    CUR.GS.V.x = (FT_F2Dot14)( CUR.GS.both_x_axis ? 0x4000 : 0 ); \
+    CUR.GS.V.y = (FT_F2Dot14)( CUR.GS.both_x_axis ? 0 : 0x4000 ); \
+  }
+#else
+#define GUESS_VECTOR( V )
+#endif
 
   /*************************************************************************/
   /*                                                                       */
@@ -719,6 +722,10 @@
     exec->GS.freeVector = exec->GS.projVector;
     exec->GS.dualVector = exec->GS.projVector;
 
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+    exec->GS.both_x_axis = TRUE;
+#endif
+
     exec->GS.round_state = 1;
     exec->GS.loop        = 1;
 
@@ -746,6 +753,11 @@
     { 0x4000, 0 },
     { 0x4000, 0 },
     { 0x4000, 0 },
+
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+    TRUE,
+#endif
+
     1, 64, 1,
     TRUE, 68, 0, 0, 9, 3,
     0, FALSE, 2, 1, 1, 1
@@ -1344,24 +1356,38 @@
   static FT_Long
   Current_Ratio( EXEC_OP )
   {
-    if ( CUR.tt_metrics.ratio )
-      return CUR.tt_metrics.ratio;
+    if ( !CUR.tt_metrics.ratio )
+    {
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+      if ( CUR.face->unpatented_hinting )
+      {
+        if ( CUR.GS.both_x_axis )
+          CUR.tt_metrics.ratio = CUR.tt_metrics.x_ratio;
+        else
+          CUR.tt_metrics.ratio = CUR.tt_metrics.y_ratio;
+      }
+      else
+#endif
+      {
+        if ( CUR.GS.projVector.y == 0 )
+          CUR.tt_metrics.ratio = CUR.tt_metrics.x_ratio;
 
-    if ( CUR.GS.projVector.y == 0 )
-      CUR.tt_metrics.ratio = CUR.tt_metrics.x_ratio;
+        else if ( CUR.GS.projVector.x == 0 )
+          CUR.tt_metrics.ratio = CUR.tt_metrics.y_ratio;
 
-    else if ( CUR.GS.projVector.x == 0 )
-      CUR.tt_metrics.ratio = CUR.tt_metrics.y_ratio;
+        else
+        {
+          FT_Long  x, y;
 
-    else
-    {
-      FT_Long  x, y;
 
-      x = TT_MULDIV( CUR.GS.projVector.x, CUR.tt_metrics.x_ratio, 0x4000 );
-      y = TT_MULDIV( CUR.GS.projVector.y, CUR.tt_metrics.y_ratio, 0x4000 );
-      CUR.tt_metrics.ratio = TT_VecLen( x, y );
+          x = TT_MULDIV( CUR.GS.projVector.x,
+                         CUR.tt_metrics.x_ratio, 0x4000 );
+          y = TT_MULDIV( CUR.GS.projVector.y,
+                         CUR.tt_metrics.y_ratio, 0x4000 );
+          CUR.tt_metrics.ratio = TT_VecLen( x, y );
+        }
+      }
     }
-
     return CUR.tt_metrics.ratio;
   }
 
@@ -1532,24 +1558,19 @@
     FT_F26Dot6  v;
 
 
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+    FT_ASSERT( !CUR.face->unpatented_hinting );
+#endif
+
     v = CUR.GS.freeVector.x;
 
     if ( v != 0 )
     {
 
-#ifdef NO_APPLE_PATENT
-
-      if ( ABS( CUR.F_dot_P ) > APPLE_THRESHOLD )
-        zone->cur[point].x += distance;
-
-#else
-
       zone->cur[point].x += TT_MULDIV( distance,
                                        v * 0x10000L,
                                        CUR.F_dot_P );
 
-#endif
-
       zone->tags[point] |= FT_CURVE_TAG_TOUCH_X;
     }
 
@@ -1558,19 +1579,10 @@
     if ( v != 0 )
     {
 
-#ifdef NO_APPLE_PATENT
-
-      if ( ABS( CUR.F_dot_P ) > APPLE_THRESHOLD )
-        zone->cur[point].y += distance;
-
-#else
-
       zone->cur[point].y += TT_MULDIV( distance,
                                        v * 0x10000L,
                                        CUR.F_dot_P );
 
-#endif
-
       zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y;
     }
   }
@@ -2075,7 +2087,7 @@
       break;
 
     case 0x30:
-      CUR.phase = GridPeriod * 3 / 4;
+      CUR.phase = CUR.period * 3 / 4;
       break;
     }
 
@@ -2110,13 +2122,16 @@
   Project( EXEC_OP_ FT_Vector*  v1,
                     FT_Vector*  v2 )
   {
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+    FT_ASSERT( !CUR.face->unpatented_hinting );
+#endif
+
     return TT_DotFix14( v1->x - v2->x,
                         v1->y - v2->y,
                         CUR.GS.projVector.x,
                         CUR.GS.projVector.y );
   }
 
-
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
@@ -2147,33 +2162,6 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
-  /*    Free_Project                                                       */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Computes the projection of the vector given by (v2-v1) along the   */
-  /*    current freedom vector.                                            */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    v1 :: First input vector.                                          */
-  /*    v2 :: Second input vector.                                         */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    The distance in F26dot6 format.                                    */
-  /*                                                                       */
-  static FT_F26Dot6
-  Free_Project( EXEC_OP_ FT_Vector*  v1,
-                         FT_Vector*  v2 )
-  {
-    return TT_DotFix14( v1->x - v2->x,
-                        v1->y - v2->y,
-                        CUR.GS.freeVector.x,
-                        CUR.GS.freeVector.y );
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
   /*    Project_x                                                          */
   /*                                                                       */
   /* <Description>                                                         */
@@ -2235,24 +2223,61 @@
   static void
   Compute_Funcs( EXEC_OP )
   {
-    if ( CUR.GS.freeVector.x == 0x4000 )
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+    if ( CUR.face->unpatented_hinting )
     {
-      CUR.func_freeProj = (TT_Project_Func)Project_x;
-      CUR.F_dot_P       = CUR.GS.projVector.x * 0x10000L;
+      /* If both vectors point rightwards along the x axis, set             */
+      /* `both-x-axis' true, otherwise set it false.  The x values only     */
+      /* need be tested because the vector has been normalised to a unit    */
+      /* vector of length 0x4000 = unity.                                   */
+      CUR.GS.both_x_axis = (FT_Bool)( CUR.GS.projVector.x == 0x4000 &&
+                                      CUR.GS.freeVector.x == 0x4000 );
+
+      /* Throw away projection and freedom vector information */
+      /* because the patents don't allow them to be stored.   */
+      /* The relevant US Patents are 5155805 and 5325479.     */
+      CUR.GS.projVector.x = 0;
+      CUR.GS.projVector.y = 0;
+      CUR.GS.freeVector.x = 0;
+      CUR.GS.freeVector.y = 0;
+
+      if ( CUR.GS.both_x_axis )
+      {
+        CUR.func_project  = Project_x;
+        CUR.func_move     = Direct_Move_X;
+      }
+      else
+      {
+        CUR.func_project  = Project_y;
+        CUR.func_move     = Direct_Move_Y;
+      }
+
+      if ( CUR.GS.dualVector.x == 0x4000 )
+        CUR.func_dualproj = Project_x;
+      else
+      {
+        if ( CUR.GS.dualVector.y == 0x4000 )
+          CUR.func_dualproj = Project_y;
+        else
+          CUR.func_dualproj = Dual_Project;
+      }
+
+      /* Force recalculation of cached aspect ratio */
+      CUR.tt_metrics.ratio = 0;
+
+      return;
     }
+#endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING */
+
+    if ( CUR.GS.freeVector.x == 0x4000 )
+      CUR.F_dot_P       = CUR.GS.projVector.x * 0x10000L;
     else
     {
       if ( CUR.GS.freeVector.y == 0x4000 )
-      {
-        CUR.func_freeProj = (TT_Project_Func)Project_y;
         CUR.F_dot_P       = CUR.GS.projVector.y * 0x10000L;
-      }
       else
-      {
-        CUR.func_freeProj = (TT_Project_Func)Free_Project;
         CUR.F_dot_P = (FT_Long)CUR.GS.projVector.x * CUR.GS.freeVector.x * 4 +
                       (FT_Long)CUR.GS.projVector.y * CUR.GS.freeVector.y * 4;
-      }
     }
 
     if ( CUR.GS.projVector.x == 0x4000 )
@@ -2503,6 +2528,8 @@
     CUR.GS.projVector.y = B;                \
     CUR.GS.dualVector.y = B;                \
                                             \
+    GUESS_VECTOR( freeVector );             \
+                                            \
     COMPUTE_Funcs();                        \
   }
 
@@ -2518,6 +2545,8 @@
     CUR.GS.freeVector.x = A;                \
     CUR.GS.freeVector.y = B;                \
                                             \
+    GUESS_VECTOR( projVector );             \
+                                            \
     COMPUTE_Funcs();                        \
   }
 
@@ -2529,6 +2558,7 @@
                     &CUR.GS.projVector ) == SUCCESS ) \
     {                                                 \
       CUR.GS.dualVector = CUR.GS.projVector;          \
+      GUESS_VECTOR( freeVector );                     \
       COMPUTE_Funcs();                                \
     }
 
@@ -2538,10 +2568,14 @@
                     (FT_UShort)args[0],               \
                     CUR.opcode,                       \
                     &CUR.GS.freeVector ) == SUCCESS ) \
-      COMPUTE_Funcs();
+    {                                                 \
+      GUESS_VECTOR( projVector );                     \
+      COMPUTE_Funcs();                                \
+    }
 
 
 #define DO_SFVTPV                          \
+    GUESS_VECTOR( projVector );            \
     CUR.GS.freeVector = CUR.GS.projVector; \
     COMPUTE_Funcs();
 
@@ -2561,6 +2595,7 @@
     NORMalize( X, Y, &CUR.GS.projVector );      \
                                                 \
     CUR.GS.dualVector = CUR.GS.projVector;      \
+    GUESS_VECTOR( freeVector );                 \
     COMPUTE_Funcs();                            \
   }
 
@@ -2578,18 +2613,47 @@
     X = S;                                      \
                                                 \
     NORMalize( X, Y, &CUR.GS.freeVector );      \
+    GUESS_VECTOR( projVector );                 \
     COMPUTE_Funcs();                            \
   }
 
 
-#define DO_GPV                     \
-    args[0] = CUR.GS.projVector.x; \
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+#define DO_GPV                                   \
+    if ( CUR.face->unpatented_hinting )          \
+    {                                            \
+      args[0] = CUR.GS.both_x_axis ? 0x4000 : 0; \
+      args[1] = CUR.GS.both_x_axis ? 0 : 0x4000; \
+    }                                            \
+    else                                         \
+    {                                            \
+      args[0] = CUR.GS.projVector.x;             \
+      args[1] = CUR.GS.projVector.y;             \
+    }
+#else
+#define DO_GPV                                   \
+    args[0] = CUR.GS.projVector.x;               \
     args[1] = CUR.GS.projVector.y;
+#endif
 
 
-#define DO_GFV                     \
-    args[0] = CUR.GS.freeVector.x; \
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+#define DO_GFV                                   \
+    if ( CUR.face->unpatented_hinting )          \
+    {                                            \
+      args[0] = CUR.GS.both_x_axis ? 0x4000 : 0; \
+      args[1] = CUR.GS.both_x_axis ? 0 : 0x4000; \
+    }                                            \
+    else                                         \
+    {                                            \
+      args[0] = CUR.GS.freeVector.x;             \
+      args[1] = CUR.GS.freeVector.y;             \
+    }
+#else
+#define DO_GFV                                   \
+    args[0] = CUR.GS.freeVector.x;               \
     args[1] = CUR.GS.freeVector.y;
+#endif
 
 
 #define DO_SRP0                      \
@@ -4750,6 +4814,8 @@
 
     NORMalize( A, B, &CUR.GS.projVector );
 
+    GUESS_VECTOR( freeVector );
+
     COMPUTE_Funcs();
   }
 
@@ -5123,21 +5189,30 @@
 
     d = CUR_Func_project( zp.cur + p, zp.org + p );
 
-#ifdef NO_APPLE_PATENT
-
-    *x = TT_MulFix14( d, CUR.GS.freeVector.x );
-    *y = TT_MulFix14( d, CUR.GS.freeVector.y );
-
-#else
-
-    *x = TT_MULDIV( d,
-                    (FT_Long)CUR.GS.freeVector.x * 0x10000L,
-                    CUR.F_dot_P );
-    *y = TT_MULDIV( d,
-                    (FT_Long)CUR.GS.freeVector.y * 0x10000L,
-                    CUR.F_dot_P );
-
-#endif /* NO_APPLE_PATENT */
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+    if ( CUR.face->unpatented_hinting )
+    {
+      if ( CUR.GS.both_x_axis )
+      {
+        *x = d;
+        *y = 0;
+      }
+      else
+      {
+        *x = 0;
+        *y = d;
+      }    
+    }
+    else
+#endif
+    {
+      *x = TT_MULDIV( d,
+                      (FT_Long)CUR.GS.freeVector.x * 0x10000L,
+                      CUR.F_dot_P );
+      *y = TT_MULDIV( d,
+                      (FT_Long)CUR.GS.freeVector.y * 0x10000L,
+                      CUR.F_dot_P );
+    }
 
     return SUCCESS;
   }
@@ -5149,6 +5224,25 @@
                            FT_F26Dot6  dy,
                            FT_Bool     touch )
   {
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+    if ( CUR.face->unpatented_hinting )
+    {
+      if ( CUR.GS.both_x_axis )
+      {
+        CUR.zp2.cur[point].x += dx;
+        if ( touch )
+          CUR.zp2.tags[point] |= FT_CURVE_TAG_TOUCH_X;
+      }
+      else
+      {
+        CUR.zp2.cur[point].y += dy;
+        if ( touch )
+          CUR.zp2.tags[point] |= FT_CURVE_TAG_TOUCH_Y;
+      }
+      return;
+    }
+#endif
+
     if ( CUR.GS.freeVector.x != 0 )
     {
       CUR.zp2.cur[point].x += dx;
@@ -5334,8 +5428,26 @@
       return;
     }
 
-    dx = TT_MulFix14( args[0], CUR.GS.freeVector.x );
-    dy = TT_MulFix14( args[0], CUR.GS.freeVector.y );
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+    if ( CUR.face->unpatented_hinting )
+    {
+      if ( CUR.GS.both_x_axis )
+      {
+        dx = TT_MulFix14( args[0], 0x4000 );
+        dy = 0;
+      }
+      else
+      {
+        dx = 0;
+        dy = TT_MulFix14( args[0], 0x4000 );
+      }
+    }
+    else
+#endif
+    {
+      dx = TT_MulFix14( args[0], CUR.GS.freeVector.x );
+      dy = TT_MulFix14( args[0], CUR.GS.freeVector.y );
+    }
 
     while ( CUR.GS.loop > 0 )
     {
@@ -5551,7 +5663,8 @@
 
     /* single width cutin test */
 
-    if ( ABS( org_dist ) < CUR.GS.single_width_cutin )
+    if ( ABS( org_dist - CUR.GS.single_width_value ) <
+         CUR.GS.single_width_cutin )
     {
       if ( org_dist >= 0 )
         org_dist = CUR.GS.single_width_value;
@@ -5640,7 +5753,8 @@
 
     /* single width test */
 
-    if ( ABS( cvt_dist ) < CUR.GS.single_width_cutin )
+    if ( ABS( cvt_dist - CUR.GS.single_width_value ) <
+         CUR.GS.single_width_cutin )
     {
       if ( cvt_dist >= 0 )
         cvt_dist =  CUR.GS.single_width_value;
@@ -6231,6 +6345,22 @@
     FT_ULong   C;
     FT_Long    B;
 
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+    /* Delta hinting is covered by US Patent 5159668. */
+    if ( CUR.face->unpatented_hinting )
+      {
+      FT_Long n = args[0] * 2;
+      if ( CUR.args < n )
+      {
+        CUR.error = TT_Err_Too_Few_Arguments;
+        return;
+      }
+
+      CUR.args -= n;
+      CUR.new_top = CUR.args;
+      return;
+    }
+#endif
 
     nump = (FT_ULong)args[0];   /* some points theoretically may occur more
                                    than once, thus UShort isn't enough */
@@ -6307,6 +6437,25 @@
     FT_Long   B;
 
 
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+    /* Delta hinting is covered by US Patent 5159668. */
+    if ( CUR.face->unpatented_hinting )
+    {
+      FT_Long  n = args[0] * 2;
+
+
+      if ( CUR.args < n )
+      {
+        CUR.error = TT_Err_Too_Few_Arguments;
+        return;
+      }
+
+      CUR.args -= n;
+      CUR.new_top = CUR.args;
+      return;
+    }
+#endif
+
     nump = (FT_ULong)args[0];
 
     for ( k = 1; k <= nump; k++ )
@@ -6870,12 +7019,20 @@
               CUR.GS.dualVector.x = AA;
               CUR.GS.dualVector.y = BB;
             }
+            else
+            {
+              GUESS_VECTOR( projVector );
+            }
 
             if ( ( opcode & 2 ) == 0 )
             {
               CUR.GS.freeVector.x = AA;
               CUR.GS.freeVector.y = BB;
             }
+            else
+            {
+              GUESS_VECTOR( freeVector );
+            }
 
             COMPUTE_Funcs();
           }

Index: ttobjs.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/truetype/ttobjs.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/ttobjs.c	26 Nov 2003 22:48:28 -0000	1.1.4.1
+++ b/ttobjs.c	15 Apr 2004 10:14:43 -0000	1.1.4.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Objects manager (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,       */
@@ -23,7 +23,6 @@
 #include FT_TRUETYPE_IDS_H
 #include FT_TRUETYPE_TAGS_H
 #include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
 
 #include "ttgload.h"
 #include "ttpload.h"
@@ -34,6 +33,9 @@
 #include "ttinterp.h"
 #endif
 
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+#include FT_TRUETYPE_UNPATENTED_H
+#endif
 
   /*************************************************************************/
   /*                                                                       */
@@ -70,6 +72,7 @@
   {
     FT_Memory  memory = zone->memory;
 
+
     if ( memory )
     {
       FT_FREE( zone->contours );
@@ -200,26 +203,43 @@
       goto Exit;
 
     if ( face->root.face_flags & FT_FACE_FLAG_SCALABLE )
-      {
+    {
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
 
-        if ( !face->root.internal->incremental_interface )
-          error = tt_face_load_loca( face, stream );
-        if ( !error )
-          error = tt_face_load_cvt      ( face, stream ) ||
-                  tt_face_load_fpgm ( face, stream );
+      if ( !face->root.internal->incremental_interface )
+        error = tt_face_load_loca( face, stream );
+      if ( !error )
+        error = tt_face_load_cvt( face, stream ) ||
+                tt_face_load_fpgm( face, stream );
 
 #else
 
-        if ( !error )
-          error = tt_face_load_loca( face, stream ) ||
-                  tt_face_load_cvt      ( face, stream ) ||
-                  tt_face_load_fpgm ( face, stream );
+      if ( !error )
+        error = tt_face_load_loca( face, stream ) ||
+                tt_face_load_cvt( face, stream )  ||
+                tt_face_load_fpgm( face, stream );
 
 #endif
 
-      }
+    }
+
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+
+    /* Determine whether unpatented hinting is to be used for this face. */
+    face->unpatented_hinting = FT_BOOL
+       ( library->debug_hooks[ FT_DEBUG_HOOK_UNPATENTED_HINTING ] != NULL );
+
+    {
+      int  i;
+
+
+      for ( i = 0; i < num_params && !face->unpatented_hinting; i++ )
+        if ( params[i].tag == FT_PARAM_TAG_UNPATENTED_HINTING )
+          face->unpatented_hinting = TRUE;
+    }
+
+#endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING */
 
     /* initialize standard glyph loading routines */
     TT_Init_Glyph_Loading( face );
@@ -569,7 +589,7 @@
       size->ttmetrics.y_ratio = 0x10000L;
     }
 
-    /* Compute root ascender, descender, test height, and max_advance */
+    /* Compute root ascender, descender, text height, and max_advance */
     metrics->ascender    = ( FT_MulFix( face->root.ascender,
                                         metrics->y_scale ) + 32 ) & -64;
     metrics->descender   = ( FT_MulFix( face->root.descender,
@@ -704,39 +724,38 @@
 
     sbit_metrics = &size->strike_metrics;
 
-    error = sfnt->set_sbit_strike(face,
-                                  metrics->x_ppem, metrics->y_ppem,
-                                  &strike_index);
+    error = sfnt->set_sbit_strike( face,
+                                   metrics->x_ppem, metrics->y_ppem,
+                                   &strike_index );
 
     if ( !error )
     {
       TT_SBit_Strike  strike = face->sbit_strikes + strike_index;
 
 
-      sbit_metrics->x_ppem      = metrics->x_ppem;
-      sbit_metrics->y_ppem      = metrics->y_ppem;
+      sbit_metrics->x_ppem = metrics->x_ppem;
+      sbit_metrics->y_ppem = metrics->y_ppem;
 #if 0
       /*
        * sbit_metrics->?_scale
        * are not used now.
        */
-      sbit_metrics->x_scale     = 1 << 16;
-      sbit_metrics->y_scale     = 1 << 16;
+      sbit_metrics->x_scale = 1 << 16;
+      sbit_metrics->y_scale = 1 << 16;
 #endif
 
-      sbit_metrics->ascender    = strike->hori.ascender  << 6;
-      sbit_metrics->descender   = strike->hori.descender << 6;
+      sbit_metrics->ascender  = strike->hori.ascender << 6;
+      sbit_metrics->descender = strike->hori.descender << 6;
 
       /* XXX: Is this correct? */
-      sbit_metrics->height      = sbit_metrics->ascender -
-                                  sbit_metrics->descender;
+      sbit_metrics->height = sbit_metrics->ascender - sbit_metrics->descender;
 
       /* XXX: Is this correct? */
       sbit_metrics->max_advance = ( strike->hori.min_origin_SB  +
                                     strike->hori.max_width      +
                                     strike->hori.min_advance_SB ) << 6;
 
-      size->strike_index = strike_index;
+      size->strike_index = (FT_UInt)strike_index;
     }
     else
     {

Index: ttobjs.h
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/truetype/ttobjs.h,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/ttobjs.h	26 Nov 2003 22:48:28 -0000	1.1.4.1
+++ b/ttobjs.h	15 Apr 2004 10:14:43 -0000	1.1.4.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Objects manager (specification).                                     */
 /*                                                                         */
-/*  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,       */
@@ -83,6 +83,10 @@
     FT_UnitVector  projVector;
     FT_UnitVector  freeVector;
 
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+    FT_Bool        both_x_axis;
+#endif
+
     FT_Long        loop;
     FT_F26Dot6     minimum_distance;
     FT_Int         round_state;
@@ -311,7 +315,7 @@
   {
     FT_SizeRec         root;
 
-    FT_Size_Metrics    metrics;    /* slightly different from the root metrics */
+    FT_Size_Metrics    metrics; /* slightly different from the root metrics */
     TT_Size_Metrics    ttmetrics;
 
 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS




More information about the xorg-commit-diffs mailing list