shithub: freetype+ttf2subf

Download patch

ref: 36af3ea62b665dee4a3408da2c657df06ab3a467
parent: 59a6a3649f63d053c2abf1ab778e7ee794b05759
author: Werner Lemberg <[email protected]>
date: Tue Jul 17 08:37:54 EDT 2001

* include/freetype/internal/psaux.h (PS_Table): Use FT_Offset for
`cursor' and `capacity'.
* src/psaux/psobjc.c (reallocate_t1_table): Use FT_Long for second
parameter.
(PS_Table_Add): Use FT_Offset for `new_size'.


* src/base/ftsynth.c: Include ftcalc.h unconditionally.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2001-07-17  Werner Lemberg  <[email protected]>
+
+	* include/freetype/internal/psaux.h (PS_Table): Use FT_Offset for
+	`cursor' and `capacity'.
+	* src/psaux/psobjc.c (reallocate_t1_table): Use FT_Long for second
+	parameter.
+	(PS_Table_Add): Use FT_Offset for `new_size'.
+
+2001-07-13  Werner Lemberg  <[email protected]>
+
+	* src/base/ftsynth.c: Include ftcalc.h unconditionally.
+
 2001-07-07  David Turner  <[email protected]>
 
 	* src/truetype/ttgload.c, src/truetype/ttinterp.c, src/pcf/pcfread:
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -115,8 +115,8 @@
   struct  PS_Table_
   {
     FT_Byte*        block;          /* current memory block           */
-    FT_Int          cursor;         /* current cursor in memory block */
-    FT_Int          capacity;       /* current size of memory block   */
+    FT_Offset       cursor;         /* current cursor in memory block */
+    FT_Offset       capacity;       /* current size of memory block   */
     FT_Long         init;
 
     FT_Int          max_elems;
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -101,7 +101,7 @@
 
   static FT_Error
   reallocate_t1_table( PS_Table*  table,
-                       FT_Int     new_size )
+                       FT_Long    new_size )
   {
     FT_Memory  memory   = table->memory;
     FT_Byte*   old_base = table->block;
@@ -163,8 +163,8 @@
     /* grow the base block if needed */
     if ( table->cursor + length > table->capacity )
     {
-      FT_Error  error;
-      FT_Int    new_size = table->capacity;
+      FT_Error   error;
+      FT_Offset  new_size = table->capacity;
 
 
       while ( new_size < table->cursor + length )
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -566,9 +566,15 @@
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  TT_MaxProfile
 
-      FT_FRAME_START( 32 ),
-        FT_FRAME_ULONG ( version ),
+      FT_FRAME_START( 6 ),
+        FT_FRAME_LONG  ( version ),
         FT_FRAME_USHORT( numGlyphs ),
+      FT_FRAME_END
+    };
+
+    const FT_Frame_Field  maxp_fields_extra[] =
+    {
+      FT_FRAME_START( 26 ),
         FT_FRAME_USHORT( maxPoints ),
         FT_FRAME_USHORT( maxContours ),
         FT_FRAME_USHORT( maxCompositePoints ),
@@ -582,7 +588,8 @@
         FT_FRAME_USHORT( maxSizeOfInstructions ),
         FT_FRAME_USHORT( maxComponentElements ),
         FT_FRAME_USHORT( maxComponentDepth ),
-      FT_FRAME_END };
+      FT_FRAME_END
+    };
 
 
     FT_TRACE2(( "Load_TT_MaxProfile: %08p\n", face ));
@@ -594,38 +601,58 @@
     if ( READ_Fields( maxp_fields, maxProfile ) )
       goto Exit;
 
-    /* XXX: an adjustment that is necessary to load certain */
-    /*      broken fonts like `Keystrokes MT' :-(           */
-    /*                                                      */
-    /*   We allocate 64 function entries by default when    */
-    /*   the maxFunctionDefs field is null.                 */
+    maxProfile->maxPoints             = 0;
+    maxProfile->maxContours           = 0;
+    maxProfile->maxCompositePoints    = 0;
+    maxProfile->maxCompositeContours  = 0;
+    maxProfile->maxZones              = 0;
+    maxProfile->maxTwilightPoints     = 0;
+    maxProfile->maxStorage            = 0;
+    maxProfile->maxFunctionDefs       = 0;
+    maxProfile->maxInstructionDefs    = 0;
+    maxProfile->maxStackElements      = 0;
+    maxProfile->maxSizeOfInstructions = 0;
+    maxProfile->maxComponentElements  = 0;
+    maxProfile->maxComponentDepth     = 0;
 
-    if ( maxProfile->maxFunctionDefs == 0 )
-      maxProfile->maxFunctionDefs = 64;
+    if ( maxProfile->version >= 0x10000L )
+    {
+      if ( READ_Fields( maxp_fields_extra, maxProfile ) )
+        goto Exit;
 
-    face->root.num_glyphs = maxProfile->numGlyphs;
+      /* XXX: an adjustment that is necessary to load certain */
+      /*      broken fonts like `Keystrokes MT' :-(           */
+      /*                                                      */
+      /*   We allocate 64 function entries by default when    */
+      /*   the maxFunctionDefs field is null.                 */
 
-    face->root.internal->max_points =
-      (FT_UShort)MAX( maxProfile->maxCompositePoints,
-                      maxProfile->maxPoints );
+      if ( maxProfile->maxFunctionDefs == 0 )
+        maxProfile->maxFunctionDefs = 64;
 
-    face->root.internal->max_contours =
-      (FT_Short)MAX( maxProfile->maxCompositeContours,
-                     maxProfile->maxContours );
+      face->root.num_glyphs = maxProfile->numGlyphs;
 
-    face->max_components = (FT_ULong)maxProfile->maxComponentElements +
-                           maxProfile->maxComponentDepth;
+      face->root.internal->max_points =
+        (FT_UShort)MAX( maxProfile->maxCompositePoints,
+                        maxProfile->maxPoints );
 
-    /* XXX: some fonts have maxComponents set to 0; we will */
-    /*      then use 16 of them by default.                 */
-    if ( face->max_components == 0 )
-      face->max_components = 16;
+      face->root.internal->max_contours =
+        (FT_Short)MAX( maxProfile->maxCompositeContours,
+                       maxProfile->maxContours );
 
-    /* We also increase maxPoints and maxContours in order to support */
-    /* some broken fonts.                                             */
-    face->root.internal->max_points   += 8;
-    face->root.internal->max_contours += 4;
+      face->max_components = (FT_ULong)maxProfile->maxComponentElements +
+                             maxProfile->maxComponentDepth;
 
+      /* XXX: some fonts have maxComponents set to 0; we will */
+      /*      then use 16 of them by default.                 */
+      if ( face->max_components == 0 )
+        face->max_components = 16;
+
+      /* We also increase maxPoints and maxContours in order to support */
+      /* some broken fonts.                                             */
+      face->root.internal->max_points   += 8;
+      face->root.internal->max_contours += 4;
+    }
+
     FT_TRACE2(( "MAXP loaded.\n" ));
 
   Exit:
@@ -1211,11 +1238,11 @@
     FT_Error  error;
     TT_OS2*   os2;
 
+    const FT_Frame_Field  os2_fields[] =
+    {
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  TT_OS2
 
-    const FT_Frame_Field  os2_fields[] =
-    {
       FT_FRAME_START( 78 ),
         FT_FRAME_USHORT( version ),
         FT_FRAME_SHORT ( xAvgCharWidth ),
@@ -1304,6 +1331,11 @@
 
     os2->ulCodePageRange1 = 0;
     os2->ulCodePageRange2 = 0;
+    os2->sxHeight         = 0;
+    os2->sCapHeight       = 0;
+    os2->usDefaultChar    = 0;
+    os2->usBreakChar      = 0;
+    os2->usMaxContext     = 0;
 
     if ( os2->version >= 0x0001 )
     {