shithub: freetype+ttf2subf

Download patch

ref: e7d42366f13b80025dc980a068cb84e9b0e756b8
parent: b03c4a0a3f033dc1477404193734b964b4647a35
author: Werner Lemberg <[email protected]>
date: Fri Jul 29 02:15:20 EDT 2011

[cff] Add some more tracing infos.

* src/cff/cffparse.c (cff_parse_font_matrix, cff_parse_font_bbox,
cff_parse_cid_ros): Add tracing.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-07-29  Werner Lemberg  <[email protected]>
+
+	[cff] Add some more tracing infos.
+
+	* src/cff/cffparse.c (cff_parse_font_matrix, cff_parse_font_bbox,
+	cff_parse_cid_ros): Add tracing.
+
 2011-07-22  Dirk Müller  <[email protected]>
 
 	[psaux, type1] Fix null pointer dereferences.
@@ -28,6 +35,12 @@
 
 	* src/truetype/ttdriver.c (tt_size_request): Fix copying metrics
 	from TT_Size to FT_Size if scalable font.
+
+	See
+
+	  http://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00049.html
+
+	for some comparison images.
 
 2011-07-14  Matthias Drochner  <[email protected]>.
 
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CFF token stream parser (body)                                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2007, 2008, 2009, 2010 by       */
+/*  Copyright 1996-2004, 2007-2011 by                                      */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -35,8 +35,6 @@
 #define FT_COMPONENT  trace_cffparse
 
 
-
-
   FT_LOCAL_DEF( void )
   cff_parser_init( CFF_Parser  parser,
                    FT_UInt     code,
@@ -475,6 +473,12 @@
       if ( scaling < 0 || scaling > 9 )
       {
         /* Return default matrix in case of unlikely values. */
+
+        FT_TRACE1(( "cff_parse_font_matrix:"
+                    " strange scaling value for xx element (%d),\n"
+                    "                      "
+                    " using default matrix\n", scaling ));
+
         matrix->xx = 0x10000L;
         matrix->yx = 0;
         matrix->yx = 0;
@@ -493,6 +497,12 @@
       offset->y  = cff_parse_fixed_scaled( data,   scaling );
 
       *upm = power_tens[scaling];
+
+      FT_TRACE4(( " font matrix: [%f %f %f %f]\n",
+                  (double)matrix->xx / *upm / 65536,
+                  (double)matrix->xy / *upm / 65536,
+                  (double)matrix->yx / *upm / 65536,
+                  (double)matrix->yy / *upm / 65536 ));
     }
 
   Exit:
@@ -518,6 +528,12 @@
       bbox->xMax = FT_RoundFix( cff_parse_fixed( data++ ) );
       bbox->yMax = FT_RoundFix( cff_parse_fixed( data   ) );
       error = CFF_Err_Ok;
+
+      FT_TRACE4(( " bbox: [%d %d %d %d]\n",
+                  bbox->xMin / 65536,
+                  bbox->yMin / 65536,
+                  bbox->xMax / 65536,
+                  bbox->yMax / 65536 ));
     }
 
     return error;
@@ -557,8 +573,8 @@
 
     if ( parser->top >= parser->stack + 3 )
     {
-      dict->cid_registry   = (FT_UInt)cff_parse_num ( data++ );
-      dict->cid_ordering   = (FT_UInt)cff_parse_num ( data++ );
+      dict->cid_registry   = (FT_UInt)cff_parse_num( data++ );
+      dict->cid_ordering   = (FT_UInt)cff_parse_num( data++ );
       if ( **data == 30 )
         FT_TRACE1(( "cff_parse_cid_ros: real supplement is rounded\n" ));
       dict->cid_supplement = cff_parse_num( data );
@@ -566,6 +582,11 @@
         FT_TRACE1(( "cff_parse_cid_ros: negative supplement %d is found\n",
                    dict->cid_supplement ));
       error = CFF_Err_Ok;
+
+      FT_TRACE4(( " ROS: registry sid %d, ordering sid %d, supplement %d\n",
+                  dict->cid_registry,
+                  dict->cid_ordering,
+                  dict->cid_supplement ));
     }
 
     return error;