shithub: freetype+ttf2subf

Download patch

ref: 5158fbc03d99ef6fd699b453206cdda3205b7d34
parent: d6ec6eee78ef0d679e87df029638a0b153b297d5
author: David Turner <[email protected]>
date: Thu Mar 27 16:35:44 EST 2003

* README: udpated

   * README.UNX: removed (now replaced by docs/INSTALL.UNX)

   * src/pshinter/pshalgo3.c: the hinter now performs as in 2.1.3 and
   will ignore stem quantization only when FT_LOAD_TARGET_SMOOTH is used

   * src/base/ftobjs.c: changed the default computations to include rounding
   in all cases, this is required to provide accurate kerning data when
   native TrueType hinting is enabled.

   * src/type1/t1load.c: the Type 1 loader now accepts more general names
   according to the Postscript spec (the previous one was too restrictive)

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2003-03-27  David Turner  <[email protected]>
+
+   * README: udpated
+
+   * README.UNX: removed (now replaced by docs/INSTALL.UNX)
+
+   * src/pshinter/pshalgo3.c: the hinter now performs as in 2.1.3 and
+   will ignore stem quantization only when FT_LOAD_TARGET_SMOOTH is used
+
+   * src/base/ftobjs.c: changed the default computations to include rounding
+   in all cases, this is required to provide accurate kerning data when
+   native TrueType hinting is enabled.
+
+   * src/type1/t1load.c: the Type 1 loader now accepts more general names
+   according to the Postscript spec (the previous one was too restrictive)
+
 2003-03-20  David Turner  <[email protected]>
 
     * docs/*: serious rewriting of the documentation
--- a/README
+++ b/README
@@ -2,9 +2,9 @@
   Special notes to Unix users
   ===========================
 
-  Please   read  the  file   "README.UNX",  it   contains  important
-  information  regarding  the   installation  of  FreeType  on  Unix
-  systems, especially GNU based operating systems like GNU/Linux.
+  Please   read  the  file   "docs/UPGRADE.UNX",  it   contains  important
+  information  regarding  the  installation  of  FreeType on Unix systems,
+  especially GNU based operating systems like GNU/Linux.
 
   FreeType 2's library is called `libfreetype', FreeType 1's library
   is called `libttf'.  They are *not* compatible!
@@ -16,8 +16,7 @@
   Please   read  the  docs/CHANGES   file,  it   contains  IMPORTANT
   INFORMATION.
 
-  Read  the  files "docs/INSTALL"  or  "docs/BUILD" for installation
-  instructions.
+  Read  the  files "docs/INSTALL"  for installation instructions.
 
   Note  that the  FreeType 2  documentation  is now  available as  a
   separate package from our sites.  See:
--- a/README.UNX
+++ /dev/null
@@ -1,141 +1,0 @@
-
-SPECIAL NOTE FOR UNIX USERS
-===========================
-
-  If  you are installing  this release  of FreeType  on a  system that
-  already uses release  2.0.5 (or even an older  version), you have to
-  perform a few special steps to ensure that everything goes well.
-
-
-
-  I. Enable the TrueType bytecode hinter if you need it
-  -----------------------------------------------------
-
-    The  TrueType  bytecode  interpreter  is disabled  in  all  public
-    releases  of  the  FreeType  packages  for  patents  reasons  (see
-    http://www.freetype.org/patents.html for more details).
-
-    However, many Linux distributions do enable the interpreter in the
-    FreeType packages (DEB/RPM/etc.) they produce for their platforms.
-    If you are using TrueType  fonts on your system, you most probably
-    want to enable it manually by doing the following:
-
-      - open the file "include/freetype/config/ftoption.h"
-
-      - locate a line that says:
-
-          #undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
-
-      - change it to:
-
-          #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
-
-    of course, this must be done _before_ compiling the library
-
-
-
-  II. Determine the correct installation path
-  --------------------------------------------
-
-    By  default,  the  source  package  will install  the  library  in
-    "/usr/local".   However, many Unix  distributions now  install the
-    library in  "/usr", since FreeType  is becoming a  critical system
-    component.
-
-    If FreeType is already installed on your system, type
-
-      freetype-config --prefix
-
-    on the command line.  This  should return the installation path to
-    use below  (e.g. "/usr"  or "/usr/local").  Otherwise,  simply use
-    "/usr" (or what you think is adequate for your installation).
-
-
-
-  III. Ensure that you are using GNU Make
-  ---------------------------------------
-
-    The FreeType build system  _exclusively_ works with GNU Make.  You
-    will  not be  able to  compile the  library with  the instructions
-    below using any other alternative (including BSD Make).
-
-    Trying  to compile  the library  with a  different Make  tool will
-    print a message like:
-
-      Sorry, GNU make is required to build FreeType2.
-
-    and the build  process will be aborted.  If  this happens, install
-    GNU Make on your system,  and use the GNUMAKE environment variable
-    to name it.
-
-
-
-  IV. Build and install the library
-  ---------------------------------
-
-    The following  should work  on all Unix  systems where  the `make'
-    command invokes GNU Make:
-
-      ./configure --prefix=<yourprefix>
-      make
-      make install           (as root)
-
-    where "<yourprefix>"  must be replaced  by the prefix  returned by
-    the "freetype-config" command.
-
-    When using a different command to invoke GNU Make, use the GNUMAKE
-    variable.  For example,  if `gmake' is the command  to use on your
-    system, do something like:
-
-       GNUMAKE=gmake ./configure --prefix=<yourprefix>
-       gmake
-       gmake install            (as root)
-
-    If  this  still  doesn't   work,  read  the  detailed  compilation
-    procedure available in the file "docs/BUILD" for troubleshooting.
-
-
-  V. Take care of XFree86 version 4
-  ---------------------------------
-
-    Certain recent Linux distributions will install _several_ versions
-    of FreeType on your system.   For example, on a fresh Mandrake 8.1
-    system, you can find the following files:
-
-      /usr/lib/libfreetype.so             which links to
-      /usr/lib/libfreetype.6.1.0.so
-
-    and
-
-      /usr/X11R6/lib/libfreetype.so       which links to
-      /usr/X11R6/lib/libfreetype.6.0.so
-
-    Note that these  files correspond to two distinct  versions of the
-    library!   It seems  that  this  surprising issue  is  due to  the
-    install  scripts  of recent  XFree86  servers  (from 4.1.0)  which
-    irremediably install  their own (dated) version of  the library in
-    "/usr/X11R6/lib".
-
-    In certain _rare_  cases you may experience minor  problems if you
-    install this release  of the library in "/usr"  only, namely, that
-    certain  applications will  not  benefit from  the  bug fixes  and
-    rendering improvements you'd expect.
-
-    There are two good ways to deal with this situation:
-
-      - Install  the library  _twice_, in  "/usr" and  in "/usr/X11R6"
-        (you  have to do  that each  time you  install a  new FreeType
-        release though).
-
-      - Change the link in /usr/X11R6/lib/libfreetype.so to point to
-
-          /usr/lib/libfreetype.so,
-
-        and get rid of
-
-          /usr/X11R6/lib/libfreetype.6.0.so
-
-    The FreeType Team  is not responsible for this  problem, so please
-    contact  either  the  XFree86   development  team  or  your  Linux
-    distributor to help clear this issue in case the information given
-    here doesn't help.
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1425,20 +1425,13 @@
     if ( char_height < 1 * 64 )
       char_height = 1 * 64;
 
-    /* Compute pixel sizes in 26.6 units */
-#ifdef FT_CONFIG_CHESTER_BLUE_SCALE
-    dim_x = ( char_width  * horz_resolution ) / 72;
-    dim_y = ( char_height * vert_resolution ) / 72;
+   /* Compute pixel sizes in 26.6 units. we use rounding
+    */
+    dim_x = ( ( char_width  * horz_resolution + (36+32*72) ) / 72 ) & -64;
+    dim_y = ( ( char_height * vert_resolution + (36+32*72) ) / 72 ) & -64;
 
-    metrics->x_ppem = (FT_UShort)( (dim_x+32) >> 6 );
-    metrics->y_ppem = (FT_UShort)( (dim_y+32) >> 6 );
-#else
-    dim_x = ( ( ( char_width  * horz_resolution ) / 72 ) + 32 ) & -64;
-    dim_y = ( ( ( char_height * vert_resolution ) / 72 ) + 32 ) & -64;
-
     metrics->x_ppem  = (FT_UShort)( dim_x >> 6 );
     metrics->y_ppem  = (FT_UShort)( dim_y >> 6 );
-#endif
 
     metrics->x_scale = 0x10000L;
     metrics->y_scale = 0x10000L;
--- a/src/pshinter/pshalgo3.c
+++ b/src/pshinter/pshalgo3.c
@@ -332,7 +332,7 @@
   /*************************************************************************/
   /*************************************************************************/
 
-#if 0
+#if 1
   static FT_Pos
   psh3_dimension_quantize_len( PSH_Dimension  dim,
                                FT_Pos         len,
@@ -520,7 +520,6 @@
           hint->cur_pos = pos;
           hint->cur_len = fit_len;
 
-#if 0
          /* stem adjustment tries to snap stem widths to standard
           * ones. this is important to prevent unpleasant rounding
           * artefacts...
@@ -545,7 +544,6 @@
               len = psh3_dimension_quantize_len( dim, len, 0 );
             }
           }
-#endif /* 0 */
 
           /* now that we have a good hinted stem width, try to position */
           /* the stem along a pixel grid integer coordinate             */
@@ -602,6 +600,8 @@
   }
 
 
+#if 0  /* not used for now, experimental */
+
  /*
   *  A variant to perform "light" hinting (i.e. FT_RENDER_MODE_LIGHT)
   *  of stems
@@ -779,6 +779,8 @@
 #endif
     }
   }
+
+#endif /* 0 */
 
 
   static void
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -779,19 +779,27 @@
 
 
   static int
-  is_alpha( FT_Byte  c )
+  is_name_char( FT_Byte  c )
   {
-    /* Note: we must accept "+" as a valid character, as it is used in */
-    /*       embedded type1 fonts in PDF documents.                    */
-    /*                                                                 */
-    return ( ft_isalnum( c ) ||
-             c == '.'        ||
-             c == '_'        ||
-             c == '-'        ||
-             c == '+'        );
-  }
+    /* Note: PostScript allows any non-delimiting, non-whitespace      */
+    /*       in a name (PS Ref Manual, 3rd Ed, p31)                    */
+    /*       PostScript delimiters include (,),<,>,[,],{,},/ and %     */
 
+    return ( c != '(' &&
+             c != ')' &&
+             c != '<' &&
+             c != '>' &&
+             c != '[' &&
+             c != ']' &&
+             c != '{' &&
+             c != '}' &&
+             c != '/' &&
+             c != '%' &&
+             ! is_space( c ) 
+             );
+ }
 
+
   static int
   read_binary_data( T1_Parser  parser,
                     FT_Long*   size,
@@ -861,7 +869,7 @@
 
     cur++;
     cur2 = cur;
-    while ( cur2 < limit && is_alpha( *cur2 ) )
+    while ( cur2 < limit && is_name_char( *cur2 ) )
       cur2++;
 
     len = cur2 - cur;
@@ -1070,7 +1078,7 @@
             FT_PtrDist  len;
 
 
-            while ( cur2 < limit && is_alpha( *cur2 ) )
+            while ( cur2 < limit && is_name_char( *cur2 ) )
               cur2++;
 
             len = cur2 - cur - 1;
@@ -1312,7 +1320,7 @@
         FT_PtrDist  len;
 
 
-        while ( cur2 < limit && is_alpha( *cur2 ) )
+        while ( cur2 < limit && is_name_char( *cur2 ) )
           cur2++;
         len = cur2 - cur - 1;
 
@@ -1572,7 +1580,7 @@
 
           cur++;
           cur2 = cur;
-          while ( cur2 < limit && is_alpha( *cur2 ) )
+          while ( cur2 < limit && is_name_char( *cur2 ) )
             cur2++;
 
           len = cur2 - cur;