shithub: freetype+ttf2subf

Download patch

ref: bf7c8321f253d7e040fb4e2dca56a163fd6ad63c
parent: 73861976779a754cc9b808760cc8e6cf98d52549
author: Werner Lemberg <[email protected]>
date: Fri Jun 6 01:07:53 EDT 2003

* include/freetype/internal/psaux.h (T1_FieldType): Add
T1_FIELD_TYPE_FIXED_1000 and T1_FIELD_TYPE_FIXED_1000_P.
(T1_FIELD_FIXED_1000, T1_FIELD_FIXED_1000_P): New macros.
* src/psaux/psobjs.c (ps_parser_load_field): Handle
T1_FIELD_TYPE_FIXED_1000 and T1_FIELD_TYPE_FIXED_1000_P.

* src/cff/cffparse.c (cff_kind_fixed_thousand): New enumeration.
(CFF_FIELD_FIXED_1000): New macro.
(cff_parser_run): Handle cff_kind_fixed_thousand.
* src/cff/cfftoken.h: Use CFF_FIELD_FIXED_1000 for blue_scale.
* src/cff/cffload (cff_subfont_load): Fix default values of
expansion_factor and blue_scale.

* src/cif/cidtoken.h, src/type1/t1tokens.h: Use T1_FIELD_FIXED_1000
for blue_scale.

* src/pshinter/pshglob.c (psh_globals_new): Fix default value of
blue_scale.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2003-06-05  Werner Lemberg  <[email protected]>
+
+	* include/freetype/internal/psaux.h (T1_FieldType): Add
+	T1_FIELD_TYPE_FIXED_1000 and T1_FIELD_TYPE_FIXED_1000_P.
+	(T1_FIELD_FIXED_1000, T1_FIELD_FIXED_1000_P): New macros.
+	* src/psaux/psobjs.c (ps_parser_load_field): Handle
+	T1_FIELD_TYPE_FIXED_1000 and T1_FIELD_TYPE_FIXED_1000_P.
+
+	* src/cff/cffparse.c (cff_kind_fixed_thousand): New enumeration.
+	(CFF_FIELD_FIXED_1000): New macro.
+	(cff_parser_run): Handle cff_kind_fixed_thousand.
+	* src/cff/cfftoken.h: Use CFF_FIELD_FIXED_1000 for blue_scale.
+	* src/cff/cffload (cff_subfont_load): Fix default values of
+	expansion_factor and blue_scale.
+
+	* src/cif/cidtoken.h, src/type1/t1tokens.h: Use T1_FIELD_FIXED_1000
+	for blue_scale.
+
+	* src/pshinter/pshglob.c (psh_globals_new): Fix default value of
+	blue_scale.
+
 2003-06-04  Wolfgang Domr�se  <[email protected]>
 
 	* include/freetype/internal/ftdriver.h,
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -180,6 +180,8 @@
     T1_FIELD_TYPE_INTEGER_P,
     T1_FIELD_TYPE_FIXED,
     T1_FIELD_TYPE_FIXED_P,
+    T1_FIELD_TYPE_FIXED_1000,
+    T1_FIELD_TYPE_FIXED_1000_P,
     T1_FIELD_TYPE_STRING,
     T1_FIELD_TYPE_BBOX,
     T1_FIELD_TYPE_INTEGER_ARRAY,
@@ -281,6 +283,12 @@
 
 #define T1_FIELD_FIXED_P( _ident, _fname )                             \
           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_P, _fname )
+
+#define T1_FIELD_FIXED_1000( _ident, _fname )                             \
+          T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_1000, _fname )
+
+#define T1_FIELD_FIXED_1000_P( _ident, _fname )                             \
+          T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_1000_P, _fname )
 
 #define T1_FIELD_STRING( _ident, _fname )                             \
           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname )
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -1990,8 +1990,8 @@
       priv->blue_shift       = 7;
       priv->blue_fuzz        = 1;
       priv->lenIV            = -1;
-      priv->expansion_factor = (FT_Fixed)0.06 * 0x10000L;
-      priv->blue_scale       = (FT_Fixed)0.039625 * 0x10000L;
+      priv->expansion_factor = (FT_Fixed)( 0.06 * 0x10000L );
+      priv->blue_scale       = (FT_Fixed)( 0.039625 * 0x10000L * 1000 );
 
       cff_parser_init( &parser, CFF_CODE_PRIVATE, priv );
 
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CFF token stream parser (body)                                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -38,6 +38,7 @@
     cff_kind_none = 0,
     cff_kind_num,
     cff_kind_fixed,
+    cff_kind_fixed_thousand,
     cff_kind_string,
     cff_kind_bool,
     cff_kind_delta,
@@ -429,6 +430,8 @@
           CFF_FIELD( code, name, cff_kind_num )
 #define CFF_FIELD_FIXED( code, name ) \
           CFF_FIELD( code, name, cff_kind_fixed )
+#define CFF_FIELD_FIXED_1000( code, name ) \
+          CFF_FIELD( code, name, cff_kind_fixed_thousand )
 #define CFF_FIELD_STRING( code, name ) \
           CFF_FIELD( code, name, cff_kind_string )
 #define CFF_FIELD_BOOL( code, name ) \
@@ -579,6 +582,10 @@
 
             case cff_kind_fixed:
               val = cff_parse_fixed( parser->stack );
+              goto Store_Number;
+
+            case cff_kind_fixed_thousand:
+              val = cff_parse_fixed_thousand( parser->stack );
 
             Store_Number:
               switch ( field->size )
--- a/src/cff/cfftoken.h
+++ b/src/cff/cfftoken.h
@@ -72,26 +72,26 @@
 #undef  CFFCODE
 #define CFFCODE       CFFCODE_PRIVATE
 
-  CFF_FIELD_DELTA( 6,     blue_values, 14 )
-  CFF_FIELD_DELTA( 7,     other_blues, 10 )
-  CFF_FIELD_DELTA( 8,     family_blues, 14 )
-  CFF_FIELD_DELTA( 9,     family_other_blues, 10 )
-  CFF_FIELD_FIXED( 0x109, blue_scale )
-  CFF_FIELD_NUM  ( 0x10A, blue_shift )
-  CFF_FIELD_NUM  ( 0x10B, blue_fuzz )
-  CFF_FIELD_NUM  ( 10,    standard_width )
-  CFF_FIELD_NUM  ( 11,    standard_height )
-  CFF_FIELD_DELTA( 0x10C, snap_widths, 13 )
-  CFF_FIELD_DELTA( 0x10D, snap_heights, 13 )
-  CFF_FIELD_BOOL ( 0x10E, force_bold )
-  CFF_FIELD_FIXED( 0x10F, force_bold_threshold )
-  CFF_FIELD_NUM  ( 0x110, lenIV )
-  CFF_FIELD_NUM  ( 0x111, language_group )
-  CFF_FIELD_FIXED( 0x112, expansion_factor )
-  CFF_FIELD_NUM  ( 0x113, initial_random_seed )
-  CFF_FIELD_NUM  ( 19,    local_subrs_offset )
-  CFF_FIELD_NUM  ( 20,    default_width )
-  CFF_FIELD_NUM  ( 21,    nominal_width )
+  CFF_FIELD_DELTA     ( 6,     blue_values, 14 )
+  CFF_FIELD_DELTA     ( 7,     other_blues, 10 )
+  CFF_FIELD_DELTA     ( 8,     family_blues, 14 )
+  CFF_FIELD_DELTA     ( 9,     family_other_blues, 10 )
+  CFF_FIELD_FIXED_1000( 0x109, blue_scale )
+  CFF_FIELD_NUM       ( 0x10A, blue_shift )
+  CFF_FIELD_NUM       ( 0x10B, blue_fuzz )
+  CFF_FIELD_NUM       ( 10,    standard_width )
+  CFF_FIELD_NUM       ( 11,    standard_height )
+  CFF_FIELD_DELTA     ( 0x10C, snap_widths, 13 )
+  CFF_FIELD_DELTA     ( 0x10D, snap_heights, 13 )
+  CFF_FIELD_BOOL      ( 0x10E, force_bold )
+  CFF_FIELD_FIXED     ( 0x10F, force_bold_threshold )
+  CFF_FIELD_NUM       ( 0x110, lenIV )
+  CFF_FIELD_NUM       ( 0x111, language_group )
+  CFF_FIELD_FIXED     ( 0x112, expansion_factor )
+  CFF_FIELD_NUM       ( 0x113, initial_random_seed )
+  CFF_FIELD_NUM       ( 19,    local_subrs_offset )
+  CFF_FIELD_NUM       ( 20,    default_width )
+  CFF_FIELD_NUM       ( 21,    nominal_width )
 
 
 /* END */
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -147,9 +147,10 @@
     if ( keyword->type == T1_FIELD_TYPE_INTEGER_ARRAY ||
          keyword->type == T1_FIELD_TYPE_FIXED_ARRAY   )
       error = cid_parser_load_field_table( &loader->parser, keyword,
-                                    &dummy_object );
+                                           &dummy_object );
     else
-      error = cid_parser_load_field( &loader->parser, keyword, &dummy_object );
+      error = cid_parser_load_field( &loader->parser,
+                                     keyword, &dummy_object );
   Exit:
     return error;
   }
--- a/src/cid/cidtoken.h
+++ b/src/cid/cidtoken.h
@@ -76,7 +76,7 @@
   T1_FIELD_NUM       ( "LanguageGroup", language_group )
   T1_FIELD_NUM       ( "password", password )
 
-  T1_FIELD_FIXED     ( "BlueScale", blue_scale )
+  T1_FIELD_FIXED_1000( "BlueScale", blue_scale )
   T1_FIELD_NUM       ( "BlueShift", blue_shift )
   T1_FIELD_NUM       ( "BlueFuzz",  blue_fuzz )
 
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -907,10 +907,18 @@
         goto Store_Integer_P;
 
       case T1_FIELD_TYPE_FIXED:
-        val = t1_tofixed( &cur, limit, 3 );
+        val = t1_tofixed( &cur, limit, 0 );
         goto Store_Integer;
 
       case T1_FIELD_TYPE_FIXED_P:
+        val = t1_tofixed( &cur, limit, 0 );
+        goto Store_Integer_P;
+
+      case T1_FIELD_TYPE_FIXED_1000:
+        val = t1_tofixed( &cur, limit, 3 );
+        goto Store_Integer;
+
+      case T1_FIELD_TYPE_FIXED_1000_P:
         val = t1_tofixed( &cur, limit, 3 );
         goto Store_Integer_P;
 
--- a/src/pshinter/pshglob.c
+++ b/src/pshinter/pshglob.c
@@ -677,7 +677,7 @@
 
       globals->blues.blue_scale = priv->blue_scale
                                   ? priv->blue_scale
-                                  : 0x28937L;   /* 0.039625 * 0x400000L */
+                                  : 0x27A000L; /* 0.039625 * 0x10000 * 1000 */
 
       globals->blues.blue_shift = priv->blue_shift
                                   ? priv->blue_shift
--- a/src/type1/t1tokens.h
+++ b/src/type1/t1tokens.h
@@ -44,7 +44,7 @@
   T1_FIELD_NUM       ( "LanguageGroup", language_group )
   T1_FIELD_NUM       ( "password", password )
 
-  T1_FIELD_FIXED     ( "BlueScale", blue_scale )
+  T1_FIELD_FIXED_1000( "BlueScale", blue_scale )
   T1_FIELD_NUM       ( "BlueShift", blue_shift )
   T1_FIELD_NUM       ( "BlueFuzz",  blue_fuzz )