Commit 675431bec1b265da5b1d01cc2a6b1bd9f71656a3

Werner Lemberg 2004-02-25T21:17:49

* include/freetype/t1tables.h (PS_PrivateRec): Add `expansion_factor'. * src/pshinter/pshglob (psh_blues_scale_zones): Fix computation of blues->no_overshoots -- `blues_scale' is stored with a magnification of 1000, and `scale' returns fractional pixels. * src/type1/t1load.c (T1_Open_Face): Initialize `blue_shift', `blue_fuzz', `expansion_factor', and `blue_scale' according to the Type 1 specification. * src/type1/t1tokens.h: Handle `ExpansionFactor'. * docs/CHANGES: Updated.

diff --git a/ChangeLog b/ChangeLog
index eb598ab..271e040 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,21 @@
-2004-02-17  Masatake YAMATO  <jet@gyve.org>
+2004-02-24  Werner Lemberg  <wl@gnu.org>
+
+	* include/freetype/t1tables.h (PS_PrivateRec): Add
+	`expansion_factor'.
+
+	* src/pshinter/pshglob (psh_blues_scale_zones): Fix computation
+	of blues->no_overshoots -- `blues_scale' is stored with a
+	magnification of 1000, and `scale' returns fractional pixels.
+
+	* src/type1/t1load.c (T1_Open_Face): Initialize `blue_shift',
+	`blue_fuzz', `expansion_factor', and `blue_scale' according to the
+	Type 1 specification.
+
+	* src/type1/t1tokens.h: Handle `ExpansionFactor'.
+
+	* docs/CHANGES: Updated.
+
+2004-02-24  Masatake YAMATO  <jet@gyve.org>
 
 	Provide generic access to MacOS resource forks.
 
diff --git a/docs/CHANGES b/docs/CHANGES
index 3353442..77e815f 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -63,6 +63,10 @@ LATEST CHANGES BETWEEN 2.1.8 and 2.1.7
       mechanism if compiled  with FT_DEBUG_LEVEL_TRACE.   See the file
       `ftdebug.h' for more details.
 
+    - YAMATO Masatake contributed improved  handling of MacOS resource
+      forks on non-MacOS platforms (for example, Linux can mount MacOS
+      file systems).
+
     - The cache sub-system has been rewritten.
 
       - There is now support for deinstallation of faces.
diff --git a/include/freetype/t1tables.h b/include/freetype/t1tables.h
index af8c416..1b89c5f 100644
--- a/include/freetype/t1tables.h
+++ b/include/freetype/t1tables.h
@@ -5,7 +5,7 @@
 /*    Basic Type 1/Type 2 tables definitions and interface (specification  */
 /*    only).                                                               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -135,6 +135,8 @@ FT_BEGIN_HEADER
     FT_Short   snap_widths [13];  /* including std width  */
     FT_Short   snap_heights[13];  /* including std height */
 
+    FT_Fixed   expansion_factor;
+
     FT_Long    language_group;
     FT_Long    password;
 
@@ -163,7 +165,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Description>                                                         */
   /*    A set of flags used to indicate which fields are present in a      */
-  /*    given blen dictionary (font info or private).  Used to support     */
+  /*    given blend dictionary (font info or private).  Used to support    */
   /*    Multiple Masters fonts.                                            */
   /*                                                                       */
   typedef enum
diff --git a/src/pshinter/pshglob.c b/src/pshinter/pshglob.c
index 3971c59..a2edd0c 100644
--- a/src/pshinter/pshglob.c
+++ b/src/pshinter/pshglob.c
@@ -5,7 +5,7 @@
 /*    PostScript hinter global hinting management (body).                  */
 /*    Inspired by the new auto-hinter module.                              */
 /*                                                                         */
-/*  Copyright 2001, 2002, 2003 by                                          */
+/*  Copyright 2001, 2002, 2003, 2004 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used        */
@@ -377,7 +377,7 @@
     /* parameter to the raw bluescale value.  Here is why:    */
     /*                                                        */
     /*   We need to suppress overshoots for all pointsizes.   */
-    /*   At 300dpi that satisfy:                              */
+    /*   At 300dpi that satisfies:                            */
     /*                                                        */
     /*      pointsize < 240*bluescale + 0.49                  */
     /*                                                        */
@@ -396,7 +396,16 @@
     /*                                                        */
     /*      "scale < bluescale"                               */
     /*                                                        */
-    blues->no_overshoots = FT_BOOL( scale < blues->blue_scale );
+    /* Note that `blue_scale' is stored 1000 times its real   */
+    /* real value, and that `scale' converts from font units  */
+    /* to fractional pixels.                                  */
+    /*                                                        */
+
+    /* 1000 / 64 = 125 / 8 */
+    if ( scale >= 0x20C49BAL )
+      blues->no_overshoots = FT_BOOL( scale < blues->blue_scale * 8 / 125 );
+    else
+      blues->no_overshoots = FT_BOOL( scale * 125 < blues->blue_scale * 8 );
 
     /*                                                        */
     /*  The blue threshold is the font units distance under   */
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index 3065443..6b33b68 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -1736,6 +1736,7 @@
     T1_LoaderRec   loader;
     T1_Parser      parser;
     T1_Font        type1 = &face->type1;
+    PS_Private     priv  = &type1->private_dict;
     FT_Error       error;
     FT_Byte        keyword_flags[T1_FIELD_COUNT];
 
@@ -1744,11 +1745,12 @@
 
     t1_init_loader( &loader, face );
 
-    /* default lenIV */
-    type1->private_dict.lenIV = 4;
-
-    /* default blue fuzz, we put it there since 0 is a valid value */
-    type1->private_dict.blue_fuzz = 1;
+    /* default values */
+    priv->blue_shift       = 7;
+    priv->blue_fuzz        = 1;
+    priv->lenIV            = 4;
+    priv->expansion_factor = (FT_Fixed)( 0.06 * 0x10000L );
+    priv->blue_scale       = (FT_Fixed)( 0.039625 * 0x10000L * 1000 );
 
     parser = &loader.parser;
     error  = T1_New_Parser( parser,
diff --git a/src/type1/t1tokens.h b/src/type1/t1tokens.h
index 23e0411..a3cc952 100644
--- a/src/type1/t1tokens.h
+++ b/src/type1/t1tokens.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 tokenizer (specification).                                    */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -60,6 +60,8 @@
   T1_FIELD_NUM_TABLE ( "StemSnapH", snap_widths, 12 )
   T1_FIELD_NUM_TABLE ( "StemSnapV", snap_heights, 12 )
 
+  T1_FIELD_FIXED     ( "ExpansionFactor", expansion_factor )
+
 
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  T1_FontRec