rpms/freetype/devel freetype-2.2.1-fix-get-orientation.patch, NONE, 1.1 freetype-2.2.1-ttcmap.patch, NONE, 1.1 freetype-2.2.1-zero-item-size.patch, NONE, 1.1 freetype.spec, 1.45, 1.46

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue Jan 9 21:32:19 UTC 2007


Author: besfahbo

Update of /cvs/dist/rpms/freetype/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv29604

Modified Files:
	freetype.spec 
Added Files:
	freetype-2.2.1-fix-get-orientation.patch 
	freetype-2.2.1-ttcmap.patch 
	freetype-2.2.1-zero-item-size.patch 
Log Message:
* Tue Jan 09 2007 Behdad Esfahbod <besfahbo at redhat.com> 2.2.1-16
- Backport binary-search fixes from HEAD
- Add freetype-2.2.1-ttcmap.patch
- Resolves: #208734

- Fix rendering issue with some Asian fonts.
- Add freetype-2.2.1-fix-get-orientation.patch
- Resolves: #207261

- Copy non-X demos even if not compiling with_xfree86.

- Add freetype-2.2.1-zero-item-size.patch, to fix crasher.
- Resolves #214048

- Add X11_PATH=/usr to "make"s, to find modern X.
- Resolves #212199



freetype-2.2.1-fix-get-orientation.patch:
 ftoutln.c |  143 ++++++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 103 insertions(+), 40 deletions(-)

--- NEW FILE freetype-2.2.1-fix-get-orientation.patch ---
2006-10-23  Zhe Su  <zsu at novell.com>

        * src/base/ftoutln.c (FT_Outline_Get_Orientation): Re-implement to
        better deal with broken Asian fonts with strange glyphs, having
        self-intersections and other peculiarities.  The used algorithm is
        based on the nonzero winding rule.

Index: src/base/ftoutln.c
===================================================================
RCS file: /sources/freetype/freetype2/src/base/ftoutln.c,v
retrieving revision 1.68
retrieving revision 1.72
diff -u -r1.68 -r1.72
--- src/base/ftoutln.c	21 Mar 2006 21:36:33 -0000	1.68
+++ src/base/ftoutln.c	24 Oct 2006 05:28:45 -0000	1.72
@@ -934,7 +934,8 @@
   FT_Outline_Get_Orientation( FT_Outline*  outline )
   {
     FT_Pos      xmin       = 32768L;
-    FT_Vector*  xmin_point = NULL;
+    FT_Pos      xmin_ymin  = 32768L;
+    FT_Pos      xmin_ymax  = -32768L;
     FT_Vector*  xmin_first = NULL;
     FT_Vector*  xmin_last  = NULL;
 
@@ -943,22 +944,31 @@
     FT_Vector*  first;
     FT_Vector*  last;
     FT_Vector*  prev;
-    FT_Vector*  next;
+    FT_Vector*  point;
+
+    int         i;
+    FT_Pos      ray_y[3];
+    int         result[3];
 
 
     if ( !outline || outline->n_points <= 0 )
       return FT_ORIENTATION_TRUETYPE;
 
+    /* We use the nonzero winding rule to find the orientation.       */
+    /* Since glyph outlines behave much more `regular' than arbitrary */
+    /* cubic or quadratic curves, this test deals with the polygon    */
+    /* only which is spanned up by the control points.                */
+
     first = outline->points;
     for ( contour = outline->contours;
           contour < outline->contours + outline->n_contours;
           contour++, first = last + 1 )
     {
-      FT_Vector*  point;
-      FT_Int      on_curve;
-      FT_Int      on_curve_count = 0;
-      FT_Pos      tmp_xmin       = 32768L;
-      FT_Vector*  tmp_xmin_point = NULL;
+      FT_Pos  contour_xmin = 32768L;
+      FT_Pos  contour_xmax = -32768L;
+      FT_Pos  contour_ymin = 32768L;
+      FT_Pos  contour_ymax = -32768L;
+
 
       last = outline->points + *contour;
 
@@ -968,55 +978,108 @@
 
       for ( point = first; point <= last; ++point )
       {
-        /* Count on-curve points.  If there are less than 3 on-curve */
-        /* points, just bypass this contour.                         */
-        on_curve        = outline->tags[point - outline->points] & 1;
-        on_curve_count += on_curve;
+        if ( point->x < contour_xmin )
+          contour_xmin = point->x;
 
-        if ( point->x < tmp_xmin && on_curve )
-        {
-          tmp_xmin       = point->x;
-          tmp_xmin_point = point;
-        }
+        if ( point->x > contour_xmax )
+          contour_xmax = point->x;
+
+        if ( point->y < contour_ymin )
+          contour_ymin = point->y;
+
+        if ( point->y > contour_ymax )
+          contour_ymax = point->y;
       }
 
-      if ( on_curve_count > 2 && tmp_xmin < xmin )
+      if ( contour_xmin < xmin          &&
+           contour_xmin != contour_xmax &&
+           contour_ymin != contour_ymax )
       {
-        xmin       = tmp_xmin;
-        xmin_point = tmp_xmin_point;
+        xmin       = contour_xmin;
+        xmin_ymin  = contour_ymin;
+        xmin_ymax  = contour_ymax;
         xmin_first = first;
         xmin_last  = last;
       }
     }
 
-    if ( !xmin_point )
+    if ( xmin == 32768 )
       return FT_ORIENTATION_TRUETYPE;
 
-    prev = ( xmin_point == xmin_first ) ? xmin_last : xmin_point - 1;
-    next = ( xmin_point == xmin_last ) ? xmin_first : xmin_point + 1;
+    ray_y[0] = ( xmin_ymin * 3 + xmin_ymax     ) >> 2;
+    ray_y[1] = ( xmin_ymin     + xmin_ymax     ) >> 1;
+    ray_y[2] = ( xmin_ymin     + xmin_ymax * 3 ) >> 2;
 
-    /* Skip off-curve points */
-    while ( ( outline->tags[prev - outline->points] & 1 ) == 0 )
+    for ( i = 0; i < 3; i++ )
     {
-      if ( prev == xmin_first )
-        prev = xmin_last;
-      else
-        --prev;
-    }
+      FT_Pos      left_x;
+      FT_Pos      right_x;
+      FT_Vector*  left1;
+      FT_Vector*  left2;
+      FT_Vector*  right1;
+      FT_Vector*  right2;
+
+
+    RedoRay:
+      left_x  = 32768L;
+      right_x = -32768L;
 
-    while ( ( outline->tags[next - outline->points] & 1 ) == 0 )
-    {
-      if ( next == xmin_last )
-        next = xmin_first;
-      else
-        ++next;
+      left1 = left2 = right1 = right2 = NULL;
+
+      prev = xmin_last;
+      for ( point = xmin_first; point <= xmin_last; prev = point, ++point )
+      {
+        FT_Pos  tmp_x;
+
+
+        if ( point->y == ray_y[i] || prev->y == ray_y[i] )
+        {
+          ray_y[i]++;
+          goto RedoRay;
+        }
+
+        if ( ( point->y < ray_y[i] && prev->y < ray_y[i] ) ||
+             ( point->y > ray_y[i] && prev->y > ray_y[i] ) )
+          continue;
+
+        tmp_x = FT_MulDiv( point->x - prev->x,
+                           ray_y[i] - prev->y,
+                           point->y - prev->y ) + prev->x;
+
+        if ( tmp_x < left_x )
+        {
+          left_x = tmp_x;
+          left1  = prev;
+          left2  = point;
+        }
+
+        if ( tmp_x > right_x )
+        {
+          right_x = tmp_x;
+          right1  = prev;
+          right2  = point;
+        }
+      }
+
+      if ( left1 && right1 )
+      {
+        if ( left1->y < left2->y && right1->y > right2->y )
+          result[i] = FT_ORIENTATION_TRUETYPE;
+        else if ( left1->y > left2->y && right1->y < right2->y )
+          result[i] = FT_ORIENTATION_POSTSCRIPT;
+        else
+          result[i] = FT_ORIENTATION_NONE;
+      }
     }
 
-    if ( FT_Atan2( prev->x - xmin_point->x, prev->y - xmin_point->y ) >
-         FT_Atan2( next->x - xmin_point->x, next->y - xmin_point->y ) )
-      return FT_ORIENTATION_POSTSCRIPT;
-    else
-      return FT_ORIENTATION_TRUETYPE;
+    if ( result[0] != FT_ORIENTATION_NONE                     &&
+         ( result[0] == result[1] || result[0] == result[2] ) )
+      return result[0];
+
+    if ( result[1] != FT_ORIENTATION_NONE && result[1] == result[2] )
+      return result[1];
+
+    return FT_ORIENTATION_TRUETYPE;
   }
 
 

freetype-2.2.1-ttcmap.patch:
 ttcmap.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

--- NEW FILE freetype-2.2.1-ttcmap.patch ---
--- freetype-2.2.1/src/sfnt/ttcmap.c.orig	2006-04-21 21:05:29.000000000 -0700
+++ freetype-2.2.1/src/sfnt/ttcmap.c	2006-09-30 22:30:24.000000000 -0700
@@ -1095,13 +1095,17 @@
           for ( i = max ; i > 0; i-- )
           {
             FT_UInt  prev_end;
+	    FT_Byte*  old_p;
 
-
+	    old_p    = p;
             p = cmap->data + 14 + ( i - 1 ) * 2;
             prev_end = TT_PEEK_USHORT( p );
 
             if ( charcode > prev_end )
+	    {
+	      p = old_p;
               break;
+	    }
 
             end    = prev_end;
             p     += 2 + num_segs2;
@@ -2273,7 +2277,7 @@
 
       if ( offset && offset <= face->cmap_size - 2 )
       {
-        FT_Byte*                       cmap   = table + offset;
+        FT_Byte* volatile              cmap   = table + offset;
         volatile FT_UInt               format = TT_PEEK_USHORT( cmap );
         const TT_CMap_Class* volatile  pclazz = tt_cmap_classes;
         TT_CMap_Class volatile         clazz;

freetype-2.2.1-zero-item-size.patch:
 ftutil.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

--- NEW FILE freetype-2.2.1-zero-item-size.patch ---
--- freetype-2.2.1/src/base/ftutil.c.zero-size	2006-05-02 14:47:14.000000000 -0700
+++ freetype-2.2.1/src/base/ftutil.c	2006-11-04 19:44:36.000000000 -0800
@@ -120,12 +120,16 @@
     FT_Error  error = FT_Err_Ok;
 
 
-    if ( cur_count < 0 || new_count < 0 || item_size <= 0 )
+    /* Note that we now accept `item_size == 0' as a valid parameter, in
+     * order to cover very weird cases where an ALLOC_MULT macro would be
+     * called.
+     */
+    if ( cur_count < 0 || new_count < 0 || item_size < 0 )
     {
       /* may help catch/prevent nasty security issues */
       error = FT_Err_Invalid_Argument;
     }
-    else if ( new_count == 0 )
+    else if ( new_count == 0 || item_size == 0 )
     {
       ft_mem_free( memory, block );
       block = NULL;


Index: freetype.spec
===================================================================
RCS file: /cvs/dist/rpms/freetype/devel/freetype.spec,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- freetype.spec	11 Sep 2006 18:32:02 -0000	1.45
+++ freetype.spec	9 Jan 2007 21:32:17 -0000	1.46
@@ -7,7 +7,7 @@
 Summary: A free and portable font rendering engine
 Name: freetype
 Version: 2.2.1
-Release: 10%{?dist}
+Release: 16%{?dist}
 License: BSD/GPL dual license
 Group: System Environment/Libraries
 URL: http://www.freetype.org
@@ -31,8 +31,11 @@
 # Upstream patches
 Patch100: freetype-composite.patch
 Patch101: freetype-more-composite.patch
+Patch102: freetype-2.2.1-zero-item-size.patch
+Patch103: freetype-2.2.1-fix-get-orientation.patch
+Patch104: freetype-2.2.1-ttcmap.patch
 
-Buildroot: %{_tmppath}/%{name}-%{version}-root
+Buildroot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
 
 BuildRequires: libX11-devel
 
@@ -90,6 +93,9 @@
 
 %patch100 -p1 -b .composite
 %patch101 -p1 -b .more-composite
+%patch102 -p1 -b .zero-item-size
+%patch103 -p0 -b .fix-get-orientation
+%patch104 -p1 -b .ttcmap
 
 %build
 # Work around code generation problem with strict-aliasing
@@ -101,14 +107,14 @@
 # Build Freetype 2
 {
   %configure --disable-static
-  make %{?_smp_mflags}
+  make X11_PATH=/usr %{?_smp_mflags}
 }
 
 %if %{with_xfree86}
 # Build freetype 2 demos
 {
   pushd ft2demos-%{version}
-  make TOP_DIR=".."
+  make X11_PATH=/usr TOP_DIR=".."
   popd
 }
 %endif
@@ -120,10 +126,15 @@
 # Install Freetype 2
 %makeinstall gnulocaledir=$RPM_BUILD_ROOT%{_datadir}/locale
 
+{
+  for ftdemo in ftbench ftchkwd ftdump ftlint ftmemchk ftvalid ; do
+      builds/unix/libtool --mode=install install -m 755 ft2demos-%{version}/bin/$ftdemo $RPM_BUILD_ROOT/%{_bindir}
+  done
+}
 %if %{with_xfree86}
 # Install freetype 2 demos
 {
-  for ftdemo in ftbench ftchkwd ftdump ftgamma ftlint ftmemchk ftmulti ftstring fttimer ftvalid ftview ; do
+  for ftdemo in ftgamma ftmulti ftstring fttimer ftview ; do
       builds/unix/libtool --mode=install install -m 755 ft2demos-%{version}/bin/$ftdemo $RPM_BUILD_ROOT/%{_bindir}
   done
 }
@@ -207,6 +218,23 @@
 %{_libdir}/pkgconfig/
 
 %changelog
+* Tue Jan 09 2007 Behdad Esfahbod <besfahbo at redhat.com> 2.2.1-16
+- Backport binary-search fixes from HEAD
+- Add freetype-2.2.1-ttcmap.patch
+- Resolves: #208734
+
+- Fix rendering issue with some Asian fonts.
+- Add freetype-2.2.1-fix-get-orientation.patch
+- Resolves: #207261
+
+- Copy non-X demos even if not compiling with_xfree86.
+
+- Add freetype-2.2.1-zero-item-size.patch, to fix crasher.
+- Resolves #214048
+
+- Add X11_PATH=/usr to "make"s, to find modern X.
+- Resolves #212199
+
 * Mon Sep 11 2006 Behdad Esfahbod <besfahbo at redhat.com> 2.2.1-10
 - Fix crasher https://bugs.freedesktop.org/show_bug.cgi?id=6841
 - Add freetype-2.2.1-memcpy-fix.patch




More information about the fedora-cvs-commits mailing list