shithub: freetype+ttf2subf

Download patch

ref: 7fd201829a5306a802fd4c3c050a5e1813b3e964
parent: eba3eeecd9578bd6217d276cb1b715d77ecaab87
author: Werner Lemberg <[email protected]>
date: Mon Aug 4 14:46:37 EDT 2008

* src/type1/t1tokens.h: Handle `ForceBold' keyword.  This fixes
Savannah bug #23995.

* src/cid/cidload.c (parse_expansion_factor): New callback function.
(cid_field_records): Use it for `ExpansionFactor'.
* src/cod/cidtoken.h: Handle `ForceBold' keyword.
Don't handle `ExpansionFactor'.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-08-04  Werner Lemberg  <[email protected]>
+
+	* src/type1/t1tokens.h: Handle `ForceBold' keyword.  This fixes
+	Savannah bug #23995.
+
+	* src/cid/cidload.c (parse_expansion_factor): New callback function.
+	(cid_field_records): Use it for `ExpansionFactor'.
+	* src/cod/cidtoken.h: Handle `ForceBold' keyword.
+	Don't handle `ExpansionFactor'.
+
 2008-08-04  Bram Tassyns  <[email protected]>
 
 	* src/cff/cffparse.c (cff_parse_fixed_scaled): Fix thinko which
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -234,6 +234,29 @@
   }
 
 
+  /* by mistake, `expansion_factor' appears both in PS_PrivateRec */
+  /* and CID_FaceDictRec (both are public header files and can't  */
+  /* changed); we simply copy the value                           */
+
+  FT_CALLBACK_DEF( FT_Error )
+  parse_expansion_factor( CID_Face     face,
+                          CID_Parser*  parser )
+  {
+    CID_FaceDict  dict;
+
+
+    if ( parser->num_dict >= 0 )
+    {
+      dict = face->cid.font_dicts + parser->num_dict;
+
+      dict->expansion_factor              = cid_parser_to_fixed( parser, 0 );
+      dict->private_dict.expansion_factor = dict->expansion_factor;
+    }
+
+    return CID_Err_Ok;
+  }
+
+
   static
   const T1_FieldRec  cid_field_records[] =
   {
@@ -240,8 +263,9 @@
 
 #include "cidtoken.h"
 
-    T1_FIELD_CALLBACK( "FDArray",    parse_fd_array, 0 )
-    T1_FIELD_CALLBACK( "FontMatrix", parse_font_matrix, 0 )
+    T1_FIELD_CALLBACK( "FDArray",         parse_fd_array, 0 )
+    T1_FIELD_CALLBACK( "FontMatrix",      parse_font_matrix, 0 )
+    T1_FIELD_CALLBACK( "ExpansionFactor", parse_expansion_factor, 0 )
 
     { 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 }
   };
--- a/src/cid/cidtoken.h
+++ b/src/cid/cidtoken.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CID token definitions (specification only).                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2006 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2006, 2008 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -62,7 +62,6 @@
   T1_FIELD_NUM  ( "SubrCount",          num_subrs,           0 )
   T1_FIELD_NUM  ( "lenBuildCharArray",  len_buildchar,       0 )
   T1_FIELD_FIXED( "ForceBoldThreshold", forcebold_threshold, 0 )
-  T1_FIELD_FIXED( "ExpansionFactor",    expansion_factor,    0 )
   T1_FIELD_FIXED( "StrokeWidth",        stroke_width,        0 )
 
 
@@ -91,6 +90,9 @@
 
   T1_FIELD_NUM_TABLE ( "StemSnapH",        snap_widths,        12, 0 )
   T1_FIELD_NUM_TABLE ( "StemSnapV",        snap_heights,       12, 0 )
+
+  T1_FIELD_BOOL      ( "ForceBold",        force_bold,          0 )
+
 
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  FT_BBox
--- a/src/type1/t1tokens.h
+++ b/src/type1/t1tokens.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 tokenizer (specification).                                    */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2006 by                         */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008 by                   */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -87,7 +87,9 @@
 
   T1_FIELD_FIXED     ( "ExpansionFactor",  expansion_factor,
                        T1_FIELD_DICT_PRIVATE )
-
+  T1_FIELD_BOOL      ( "ForceBold",        force_bold,
+                       T1_FIELD_DICT_PRIVATE )
+                         
 
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  T1_FontRec