shithub: freetype+ttf2subf

Download patch

ref: 32b85e67cbfd1fe2824af80be296a0c263d42455
parent: cc809bcbe6970515833971e725f510012d9f04e6
author: David Turner <[email protected]>
date: Thu Jun 29 17:48:58 EDT 2000

various bug fixes in the postscript font drivers (mainly they
added one un-necessary point to each contour..)

git/fs: mount .git/fs: mount/attach disallowed
--- a/src/cff/t2gload.c
+++ b/src/cff/t2gload.c
@@ -485,6 +485,23 @@
   {
     FT_Outline*  outline = builder->current;
 
+    /* XXXX : we must not include the last point in the path if it */
+    /*        is located on the first point..                      */
+    if (outline->n_points > 1)
+    {
+      FT_Int      first = 0;
+      FT_Vector*  p1    = outline->points + first;
+      FT_Vector*  p2    = outline->points + outline->n_points-1;
+      
+      if (outline->n_contours > 1)
+      {
+        first = outline->contours[outline->n_contours-2]+1;
+        p1    = outline->points + first;
+      }
+        
+      if ( p1->x == p2->x && p1->y == p2->y )
+        outline->n_points--;
+    }
 
     if ( outline->n_contours > 0 )
       outline->contours[outline->n_contours - 1] = outline->n_points - 1;
@@ -1676,8 +1693,13 @@
     if ( load_flags & FT_LOAD_NO_RECURSE )
       load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
 
-    glyph->x_scale = size->metrics.x_scale;
-    glyph->y_scale = size->metrics.y_scale;
+    glyph->x_scale = 0x10000;
+    glyph->y_scale = 0x10000;
+    if (size)
+    {
+      glyph->x_scale = size->metrics.x_scale;
+      glyph->y_scale = size->metrics.y_scale;
+    }
 
     glyph->root.outline.n_points   = 0;
     glyph->root.outline.n_contours = 0;
@@ -1685,7 +1707,7 @@
     hinting = ( load_flags & FT_LOAD_NO_SCALE   ) == 0 &&
               ( load_flags & FT_LOAD_NO_HINTING ) == 0;
 
-    glyph->root.format = ft_glyph_format_none;
+    glyph->root.format = ft_glyph_format_outline;  /* by default */
 
     {
       FT_Byte*  charstring;
@@ -1719,15 +1741,10 @@
     {
       /* for composite glyphs, return only the left side bearing and the */
       /* advance width..                                                 */
-      if ( load_flags & FT_LOAD_NO_RECURSE )
+      if ( glyph->root.format == ft_glyph_format_composite )
       {
-#if 0
         glyph->root.metrics.horiBearingX = decoder.builder.left_bearing.x;
-        glyph->root.metrics.horiAdvance  = decoder.builder.advance.x;
-#else
-        glyph->root.metrics.horiBearingX = decoder.builder.left_bearing.x;
         glyph->root.metrics.horiAdvance  = decoder.glyph_width;
-#endif /* 0 */
       }
       else
       {
@@ -1736,11 +1753,7 @@
 
 
         /* copy the _unscaled_ advance width */
-#if 0
-        metrics->horiAdvance  = decoder.builder.advance.x;
-#else
         metrics->horiAdvance  = decoder.glyph_width;
-#endif /* 0 */
 
         /* make up vertical metrics */
         metrics->vertBearingX = 0;
@@ -1749,17 +1762,11 @@
 
         glyph->root.format = ft_glyph_format_outline;
 
-        glyph->root.outline.flags &= ft_outline_owner;
+        glyph->root.outline.flags = 0;
         if ( size && size->metrics.y_ppem < 24 )
           glyph->root.outline.flags |= ft_outline_high_precision;
 
         glyph->root.outline.flags |= ft_outline_reverse_fill;
-
-#if 0
-        glyph->root.outline.second_pass    = TRUE;
-        glyph->root.outline.high_precision = size->root.metrics.y_ppem < 24;
-        glyph->root.outline.dropout_mode   = 2;
-#endif
 
         if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )
         {
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -335,6 +335,23 @@
   {
     FT_Outline*  outline = builder->current;
 
+    /* XXXX : we must not include the last point in the path if it */
+    /*        is located on the first point..                      */
+    if (outline->n_points > 1)
+    {
+      FT_Int      first = 0;
+      FT_Vector*  p1    = outline->points + first;
+      FT_Vector*  p2    = outline->points + outline->n_points-1;
+      
+      if (outline->n_contours > 1)
+      {
+        first = outline->contours[outline->n_contours-2]+1;
+        p1    = outline->points + first;
+      }
+        
+      if ( p1->x == p2->x && p1->y == p2->y )
+        outline->n_points--;
+    }
 
     if ( outline->n_contours > 0 )
       outline->contours[outline->n_contours - 1] = outline->n_points - 1;
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -276,7 +276,7 @@
     if ( LOAD_( hdmx )          ||
          LOAD_( gasp )          ||
          LOAD_( kerning )       ||
-		 LOAD_( pclt )          )
+	 LOAD_( pclt )          )
       goto Exit;
 
 #ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -1235,6 +1235,23 @@
   {
     FT_Outline*  cur = builder->current;
 
+    /* XXXX : we must not include the last point in the path if it */
+    /*        is located on the first point..                      */
+    if (cur->n_points > 1)
+    {
+      FT_Int      first = 0;
+      FT_Vector*  p1    = cur->points + first;
+      FT_Vector*  p2    = cur->points + cur->n_points-1;
+      
+      if (cur->n_contours > 1)
+      {
+        first = cur->contours[cur->n_contours-2]+1;
+        p1    = cur->points + first;
+      }
+        
+      if ( p1->x == p2->x && p1->y == p2->y )
+        cur->n_points--;
+    }
 
     /* save current contour, if any */
     if ( cur->n_contours > 0 )
@@ -1686,7 +1703,7 @@
     {
       /* for composite glyphs, return only the left side bearing and the */
       /* advance width                                                   */
-      if ( load_flags & FT_LOAD_NO_RECURSE )
+      if ( glyph->root.format == ft_glyph_format_composite )
       {
         glyph->root.metrics.horiBearingX = decoder.builder.left_bearing.x;
         glyph->root.metrics.horiAdvance  = decoder.builder.advance.x;
@@ -1728,18 +1745,12 @@
 
         glyph->root.format = ft_glyph_format_outline;
 
-        glyph->root.outline.flags &= ft_outline_owner;
+        glyph->root.outline.flags = 0;
 
         if ( size->root.metrics.y_ppem < 24 )
           glyph->root.outline.flags |= ft_outline_high_precision;
 
         glyph->root.outline.flags |= ft_outline_reverse_fill;
-
-#if 0
-        glyph->root.outline.second_pass    = TRUE;
-        glyph->root.outline.high_precision = size->root.metrics.y_ppem < 24;
-        glyph->root.outline.dropout_mode   = 2;
-#endif
 
         if ( hinting )
         {
--- a/src/type1z/z1gload.c
+++ b/src/type1z/z1gload.c
@@ -308,6 +308,24 @@
   {
     FT_Outline*  outline = builder->current;
 
+    /* XXXX : we must not include the last point in the path if it */
+    /*        is located on the first point..                      */
+    if (outline->n_points > 1)
+    {
+      FT_Int      first = 0;
+      FT_Vector*  p1    = outline->points + first;
+      FT_Vector*  p2    = outline->points + outline->n_points-1;
+      
+      if (outline->n_contours > 1)
+      {
+        first = outline->contours[outline->n_contours-2]+1;
+        p1    = outline->points + first;
+      }
+        
+      if ( p1->x == p2->x && p1->y == p2->y )
+        outline->n_points--;
+    }
+    
     if ( outline->n_contours > 0 )
       outline->contours[outline->n_contours-1] = outline->n_points-1;
   }