Re: [ft-devel] A few tiny patches

2011-08-16 Thread Werner LEMBERG

 Here's a small set of patches I'd like to get in to the official
 tree. [...]

Thanks!

 Let me know if you have any questions or need more info.

Please send me the broken fonts privately which trigger the problems.
I collect such beasts :-)


Werner

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


[ft-devel] A few tiny patches

2011-08-15 Thread Dirck Blaskey

Hi Werner  Co.

Here's a small set of patches I'd like to get in to the official tree.

#1 a broken glyph in a font file that Acrobat allows, but
freetype doesn't:  allow for a trailing empty contour

diff -u base/ftoutln.c s:\l\cdoc\src\ftype/ftoutln.c
--- base/ftoutln.c Mon Jul 18 23:20:00 2011
+++ s:\l\cdoc\src\ftype/ftoutln.c   Mon Aug 23 20:25:28 2010
@@ -366,7 +366,9 @@
 end = outline-contours[n];

 /* note that we don't accept empty contours */
-if ( end = end0 || end = n_points )
+/* Acrobat allows this broken glyph, trailing empty contour */
+
+if ( /*end = end0 ||*/ end = n_points )
   goto Bad;

 end0 = end;

#2 cff font with a funky matrix, running scaling logic where scaling == 0 is 
bad news

diff -u cff/cffparse.c s:\l\cdoc\src\ftype/cffparse.c
--- cff/cffparse.cMon Aug 15 20:20:34 2011
+++ s:\l\cdoc\src\ftype/cffparse.c  Mon Aug 15 20:27:51 2011
@@ -470,7 +470,9 @@

   scaling = -scaling;

-  if ( scaling  0 || scaling  9 )
+  /* scaling == 0 is bad */
+
+  if ( scaling = 0 || scaling  9 )
   {
 /* Return default matrix in case of unlikely values. */

#3 The host software uses the incremental interface, and in one case
can stomp on itself due to convolutions in the font.  Save  restore the stream:

diff -u truetype/ttgload.c s:\l\cdoc\src\ftype/ttgload.c
--- truetype/ttgload.c Mon Jul 18 23:20:00 2011
+++ s:\l\cdoc\src\ftype/ttgload.c   Tue Jul 19 00:35:38 2011
@@ -1231,6 +1231,7 @@
 FT_StreamRecinc_stream;
 FT_Data glyph_data;
 FT_Bool glyph_data_loaded = 0;
+FT_Stream   saved_stream = 0;   /* saverestore */
 #endif


@@ -1290,6 +1291,7 @@
   FT_Stream_OpenMemory( inc_stream,
 glyph_data.pointer, glyph_data.length );

+  saved_stream = loader-stream;/* saverestore */
   loader-stream = inc_stream;
 }
 else
@@ -1610,6 +1612,9 @@
   face-root.internal-incremental_interface-funcs-free_glyph_data(
 face-root.internal-incremental_interface-object,
glyph_data );
+
+if ( face-root.internal-incremental_interface  saved_stream )
+  loader-stream = saved_stream;/* saverestore */

 #endif

Let me know if you have any questions or need more info.

Thanks!


___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel