shithub: freetype+ttf2subf

Download patch

ref: 5225402a527e9f35283a3b3db595d41df1c67e1d
parent: 3dc00181747d197690c69b45b821fb2b719dac69
author: Werner Lemberg <[email protected]>
date: Wed Feb 15 01:05:52 EST 2006

* include/freetype/ftoutln.h (FT_Outline_Embolden): Mention in
documentation that negative strength values are possible.
Give an example call.

* include/freetype/freetype.h (FT_GlyphSlotRec): Improve
documentation of `outline' field.

* src/sfnt/sfobjc.s: Inckude FT_INTERNAL_DEBUG_H.
* src/sfnt/sfdriver.c: Include ttmtx.h.

* src/autofit/afcjk.c: Include aftypes.h and aflatin.h.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2006-02-14  Werner Lemberg  <[email protected]>
+
+	* include/freetype/ftoutln.h (FT_Outline_Embolden): Mention in
+	documentation that negative strength values are possible.
+	Give an example call.
+
+	* include/freetype/freetype.h (FT_GlyphSlotRec): Improve
+	documentation of `outline' field.
+
+	* src/sfnt/sfobjc.s: Inckude FT_INTERNAL_DEBUG_H.
+	* src/sfnt/sfdriver.c: Include ttmtx.h.
+
+	* src/autofit/afcjk.c: Include aftypes.h and aflatin.h.
+
 2006-02-14  Chia-I Wu  <[email protected]>
 
 	* src/sfnt/ttmtx.c (tt_face_get_metrics): Typo.
@@ -9,11 +23,11 @@
 	Check table length in non-FT_OPTIMIZE_MEMORY'ed `tt_face_load_hmtx'.
 
 	* src/sfnt/sfobjs.c (sfnt_load_face): Take care of missing metrics
-	tables.  The last change makes Mac bitmap-only font not load and this
-	fixes it.
+	tables.  The last change makes Mac bitmap-only font not load and
+	this fixes it.
 
-	* src/truetype/ttgload.c (load_truetype_glyph): Fix compilation error
-	when FT_CONFIG_OPTION_INCREMENTAL is defined.
+	* src/truetype/ttgload.c (load_truetype_glyph): Fix compilation
+	error when FT_CONFIG_OPTION_INCREMENTAL is defined.
 
 2006-02-13  Chia-I Wu  <[email protected]>
 
@@ -32,10 +46,10 @@
 
 2006-02-13  Chia-I Wu  <[email protected]>
 
-	Clean up the SFNT_Interface.  In this pass, we want to treat the font
-	directory (offset table and table directory) as a normal table like
-	the others.  This also means that TTC is no longer recognized there,
-	but in `init_face'.
+	Clean up the SFNT_Interface.  In this pass, we want to treat the
+	font directory (offset table and table directory) as a normal table
+	like the others.  This also means that TTCs are no longer recognized
+	there but in `init_face'.
 
 	* include/freetype/internal/sfnt.h (SFNT_Interface),
 	src/sfnt/sfdriver.c: `load_sfnt_header' and `load_directory' are
@@ -52,9 +66,10 @@
 2006-02-13  Chia-I Wu  <[email protected]>
 
 	Clean up the SFNT_Interface.  Table loading functions are now named
-	after the tables' tags;  `hdmx' is TrueType-specific and thus the code
-	is moved to the truetype module; `get_metrics' is moved here from the
-	truetype module so that the code can be shared with the cff module.
+	after the tables' tags; `hdmx' is TrueType-specific and thus the
+	code is moved to the truetype module; `get_metrics' is moved here
+	from the truetype module so that the code can be shared with the cff
+	module.
 
 	This pass involves no real changes.  That is, the code is moved
 	verbatim mostly.  The only exception is the return value of
@@ -65,10 +80,10 @@
 	src/sfnt/ttload.c, src/sfnt/ttload.h, src/sfnt/ttsbit.c,
 	src/sfnt/ttsbit.h, src/sfnt/ttsbit0.c: Clean up the SFNT_Interface.
 	
-	* src/sfnt/ttmtx.c, src/sfnt/ttmtx.h: Metrics-related tables' loading
-	and parsing code is moved here.
-	Move `tt_face_get_metrics' here from the truetype module.  The return
-	value is changed from `void' to `FT_Error'.
+	* src/sfnt/ttmtx.c, src/sfnt/ttmtx.h: New files.  Metrics-related
+	tables' loading and parsing code is moved to here.
+	Move `tt_face_get_metrics' here from the truetype module.  The
+	return value is changed from `void' to `FT_Error'.
 
 	* include/freetype/internal/fttrace.h: New trace: ttmtx.
 
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -1428,7 +1428,10 @@
   /*                                                                       */
   /*    outline           :: The outline descriptor for the current glyph  */
   /*                         image if its format is                        */
-  /*                         FT_GLYPH_FORMAT_OUTLINE.                      */
+  /*                         FT_GLYPH_FORMAT_OUTLINE.  Once a glyph is     */
+  /*                         loaded, `outline' can be transformed,         */
+  /*                         distorted, embolded, etc.  However, it must   */
+  /*                         not be freed.                                 */
   /*                                                                       */
   /*    num_subglyphs     :: The number of subglyphs in a composite glyph. */
   /*                         This field is only valid for the composite    */
--- a/include/freetype/ftoutln.h
+++ b/include/freetype/ftoutln.h
@@ -5,7 +5,7 @@
 /*    Support for the FT_Outline type used to store glyph shapes of        */
 /*    most scalable font formats (specification).                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2005 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2005, 2006 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -314,6 +314,9 @@
   /*    `strength' pixels wider and higher.  You may think of the left and */
   /*    bottom borders as unchanged.                                       */
   /*                                                                       */
+  /*    Negative `strength' values to reduce the outline thickness are     */
+  /*    possible also.                                                     */
+  /*                                                                       */
   /* <InOut>                                                               */
   /*    outline  :: A handle to the target outline.                        */
   /*                                                                       */
@@ -323,6 +326,18 @@
   /*                                                                       */
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    The used algorithm to increase or decrease the thickness of the    */
+  /*    glyph doesn't change the number of points; this means that certain */
+  /*    situations like acute angles or intersections are sometimes        */
+  /*    handled incorrectly.                                               */
+  /*                                                                       */
+  /*    Example call:                                                      */
+  /*                                                                       */
+  /*      FT_Load_Glyph( face, index, FT_LOAD_DEFAULT );                   */
+  /*      if ( face->slot->format == FT_GLYPH_FORMAT_OUTLINE )             */
+  /*        FT_Outline_Embolden( &face->slot->outline, strength );         */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Outline_Embolden( FT_Outline*  outline,
--- a/include/freetype/internal/fttrace.h
+++ b/include/freetype/internal/fttrace.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Tracing handling (specification only).                               */
 /*                                                                         */
-/*  Copyright 2002, 2004, 2005 by                                          */
+/*  Copyright 2002, 2004, 2005, 2006 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
--- a/include/freetype/internal/sfnt.h
+++ b/include/freetype/internal/sfnt.h
@@ -34,7 +34,7 @@
   /*    TT_Init_Face_Func                                                  */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    First part of the SFNT face object initialization.  This will find */
+  /*    First part of the SFNT face object initialization.  This finds     */
   /*    the face in a SFNT file or collection, and load its format tag in  */
   /*    face->format_tag.                                                  */
   /*                                                                       */
@@ -77,9 +77,9 @@
   /*    TT_Load_Face_Func                                                  */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Second part of the SFNT face object initialization.  This will     */
-  /*    load the common SFNT tables (head, OS/2, maxp, metrics, etc.) in   */
-  /*    the face object.                                                   */
+  /*    Second part of the SFNT face object initialization.  This loads    */
+  /*    the common SFNT tables (head, OS/2, maxp, metrics, etc.) in the    */
+  /*    face object.                                                       */
   /*                                                                       */
   /* <Input>                                                               */
   /*    stream     :: The input stream.                                    */
@@ -375,8 +375,8 @@
   /*    TT_Load_Metrics_Func                                               */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Load a metrics table, which is a table comes with a horizontal     */
-  /*    and a vertical version.                                            */
+  /*    Load a metrics table, which is a table with a horizontal and a     */
+  /*    vertical version.                                                  */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face     :: A handle to the target face object.                    */
@@ -437,8 +437,8 @@
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
-  /*    The function will use `face->goto_table' to seek the stream to     */
-  /*    the start of the table, except in loading font directory.          */
+  /*    The function uses `face->goto_table' to seek the stream to the     */
+  /*    start of the table, except while loading the font directory.       */
   /*                                                                       */
   typedef FT_Error
   (*TT_Load_Table_Func)( TT_Face    face,
@@ -504,8 +504,8 @@
 
     TT_Load_Any_Func             load_any;
 
-    /* load the font directory, i.e. the offset table and */
-    /* the table directory                                */
+    /* load the font directory, i.e., the offset table and */
+    /* the table directory                                 */
     TT_Load_Table_Func           load_font_dir;
 
     /* these functions are called by `load_face' but they can also  */
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -22,6 +22,10 @@
    *
    */
 
+#include "aftypes.h"
+#include "aflatin.h"
+
+
 #ifdef AF_CONFIG_OPTION_CJK
 
 #include "afcjk.h"
--- a/src/sfnt/rules.mk
+++ b/src/sfnt/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2002, 2003, 2004, 2005 by
+# Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -41,6 +41,7 @@
 
 #include "ttcmap.h"
 #include "ttkern.h"
+#include "ttmtx.h"
 
 #include FT_SERVICE_GLYPH_DICT_H
 #include FT_SERVICE_POSTSCRIPT_NAME_H
--- a/src/sfnt/sfnt.c
+++ b/src/sfnt/sfnt.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Single object library component.                                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by                   */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -22,6 +22,7 @@
 #include "ttcmap.h"
 #include "ttkern.h"
 #include FT_INTERNAL_SFNT_H
+#include FT_INTERNAL_DEBUG_H
 #include FT_TRUETYPE_IDS_H
 #include FT_TRUETYPE_TAGS_H
 #include FT_SERVICE_POSTSCRIPT_CMAPS_H
@@ -588,7 +589,7 @@
         /* No `hhea' table necessary for SFNT Mac fonts. */
         if ( face->format_tag == TTAG_true )
         {
-          FT_TRACE2(( "This is an SFNT Mac font.\n"));
+          FT_TRACE2(( "This is an SFNT Mac font.\n" ));
           error = SFNT_Err_Ok;
         }
         else
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -5,7 +5,7 @@
 /*    Load the basic TrueType tables, i.e., tables that can be either in   */
 /*    TTF or OTF fonts (body).                                             */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by                   */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -259,8 +259,8 @@
   /*    The stream cursor must be at the beginning of the font directory.  */
   /*                                                                       */
   FT_LOCAL_DEF( FT_Error )
-  tt_face_load_font_dir( TT_Face      face,
-                         FT_Stream    stream )
+  tt_face_load_font_dir( TT_Face    face,
+                         FT_Stream  stream )
   {
     SFNT_HeaderRec  sfnt;
     FT_Error        error;
@@ -294,7 +294,7 @@
 
     /* many fonts don't have these fields set correctly */
 #if 0
-    if ( sfnt.search_range != 1 << ( sfnt.entry_selector + 4 )         ||
+    if ( sfnt.search_range != 1 << ( sfnt.entry_selector + 4 )        ||
          sfnt.search_range + sfnt.range_shift != sfnt.num_tables << 4 )
       return SFNT_Err_Unknown_File_Format;
 #endif
--- a/src/sfnt/ttload.h
+++ b/src/sfnt/ttload.h
@@ -5,7 +5,7 @@
 /*    Load the basic TrueType tables, i.e., tables that can be either in   */
 /*    TTF or OTF fonts (specification).                                    */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2005 by                                     */
+/*  Copyright 1996-2001, 2002, 2005, 2006 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -41,8 +41,8 @@
 
 
   FT_LOCAL( FT_Error )
-  tt_face_load_font_dir( TT_Face      face,
-                         FT_Stream    stream );
+  tt_face_load_font_dir( TT_Face    face,
+                         FT_Stream  stream );
 
 
   FT_LOCAL( FT_Error )
--- a/src/sfnt/ttmtx.c
+++ b/src/sfnt/ttmtx.c
@@ -140,8 +140,8 @@
         face->vertical.number_Of_VMetrics = num_longs;
       }
 
-      longs     = (TT_LongMetrics *)&face->vertical.long_metrics;
-      shorts    = (TT_ShortMetrics**)&face->vertical.short_metrics;
+      longs  = (TT_LongMetrics *) &face->vertical.long_metrics;
+      shorts = (TT_ShortMetrics**)&face->vertical.short_metrics;
     }
     else
     {
@@ -160,8 +160,8 @@
         face->horizontal.number_Of_HMetrics = num_longs;
       }
 
-      longs     = (TT_LongMetrics *)&face->horizontal.long_metrics;
-      shorts    = (TT_ShortMetrics**)&face->horizontal.short_metrics;
+      longs  = (TT_LongMetrics *) &face->horizontal.long_metrics;
+      shorts = (TT_ShortMetrics**)&face->horizontal.short_metrics;
     }
 
     /* never trust derived values */
@@ -358,10 +358,6 @@
   /*                                                                       */
   /*    advance :: The advance width resp. advance height.                 */
   /*                                                                       */
-  /* <Note>                                                                */
-  /*    This function will much probably move to another component in the  */
-  /*    near future, but I haven't decided which yet.                      */
-  /*                                                                       */
 #ifdef FT_OPTIMIZE_MEMORY
 
   FT_LOCAL_DEF( FT_Error )
@@ -439,7 +435,7 @@
     TT_HoriHeader*  header = vertical ? (TT_HoriHeader*)&face->vertical
                                       :                 &face->horizontal;
     TT_LongMetrics  longs_m;
-    FT_UShort       k      = header->number_Of_HMetrics;
+    FT_UShort       k = header->number_Of_HMetrics;
 
 
     if ( k == 0 || gindex >= (FT_UInt)face->max_profile.numGlyphs )
--- a/src/truetype/ttpload.c
+++ b/src/truetype/ttpload.c
@@ -47,7 +47,7 @@
   /*    tt_face_load_loca                                                  */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Loads the locations table.                                         */
+  /*    Load the locations table.                                          */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    face   :: A handle to the target face object.                      */
@@ -319,7 +319,7 @@
   /*    tt_face_load_cvt                                                   */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Loads the control value table into a face object.                  */
+  /*    Load the control value table into a face object.                   */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    face   :: A handle to the target face object.                      */
@@ -400,7 +400,7 @@
   /*    tt_face_load_fpgm                                                  */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Loads the font program.                                            */
+  /*    Load the font program.                                             */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    face   :: A handle to the target face object.                      */
@@ -417,8 +417,8 @@
   {
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
 
-    FT_Error   error;
-    FT_ULong   table_len;
+    FT_Error  error;
+    FT_ULong  table_len;
 
 
     FT_TRACE2(( "Font program " ));
@@ -462,7 +462,7 @@
   /*    tt_face_load_prep                                                  */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Loads the cvt program.                                             */
+  /*    Load the cvt program.                                              */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    face   :: A handle to the target face object.                      */
@@ -479,8 +479,8 @@
   {
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
 
-    FT_Error   error;
-    FT_ULong   table_len;
+    FT_Error  error;
+    FT_ULong  table_len;
 
 
     FT_TRACE2(( "Prep program " ));
@@ -523,7 +523,7 @@
   /*    tt_face_load_hdmx                                                  */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Loads the `hdmx' table into the face object.                       */
+  /*    Load the `hdmx' table into the face object.                        */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face   :: A handle to the target face object.                      */
@@ -699,9 +699,10 @@
 
 #endif /* !OPTIMIZE_MEMORY */
 
+
   /*************************************************************************/
   /*                                                                       */
-  /* Returns the advance width table for a given pixel size if it is found */
+  /* Return the advance width table for a given pixel size if it is found  */
   /* in the font's `hdmx' table (if any).                                  */
   /*                                                                       */
   FT_LOCAL_DEF( FT_Byte* )
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -1856,9 +1856,9 @@
               /* field to deal adequately with synthetic  */
               /* fonts; /Subrs and /CharStrings are       */
               /* handled specially.                       */
-              if ( keyword_flag[0] == 0                              ||
-                   ft_strcmp( (const char*)name, "Subrs" ) == 0      ||
-                   ft_strcmp( (const char*)name, "CharStrings") == 0 )
+              if ( keyword_flag[0] == 0                               ||
+                   ft_strcmp( (const char*)name, "Subrs" ) == 0       ||
+                   ft_strcmp( (const char*)name, "CharStrings" ) == 0 )
               {
                 parser->root.error = t1_load_keyword( face,
                                                       loader,