shithub: freetype+ttf2subf

Download patch

ref: 675431bec1b265da5b1d01cc2a6b1bd9f71656a3
parent: 754353343ecd27582ed86cd9fd07d31ab1df883c
author: Werner Lemberg <[email protected]>
date: Wed Feb 25 16:17:49 EST 2004

* 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.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,21 @@
-2004-02-17  Masatake YAMATO  <[email protected]>
+2004-02-24  Werner Lemberg  <[email protected]>
+
+	* 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  <[email protected]>
 
 	Provide generic access to MacOS resource forks.
 
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -63,6 +63,10 @@
       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.
--- 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_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 @@
   /*                                                                       */
   /* <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
--- 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   */
--- 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,
--- 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,       */
@@ -59,6 +59,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