Commit 8bb45ec8fb43d6a7c041473a6c192db07d8a6176

Werner Lemberg 2000-09-29T06:41:56

Fixing comment in unixddef.mk which caused a trailing blank. Adding a new error, FT_Err_Invalid_Pixel_Size (used in winfnt.c) Fixing FT_Read_Fields() which failed for ft_frame_{bytes,skip}. This bug disabled the Winfont driver. Minor formatting issues.

diff --git a/builds/unix/unixddef.mk b/builds/unix/unixddef.mk
index 6ef0cbc..6b78ca6 100644
--- a/builds/unix/unixddef.mk
+++ b/builds/unix/unixddef.mk
@@ -22,7 +22,8 @@ DELETE   := rm -f
 SEP      := /
 HOSTSEP  := $(SEP)
 BUILD    := $(TOP)/builds/unix/devel # we use a special devel ftoption.h
-PLATFORM := unixdev # do not set it to `unix', or libtool will trick you
+# do not set the platform to `unix', or libtool will trick you
+PLATFORM := unixdev
 
 
 # The directory where all object files are placed.
diff --git a/include/freetype/fterrors.h b/include/freetype/fterrors.h
index 94d3e97..2fa9489 100644
--- a/include/freetype/fterrors.h
+++ b/include/freetype/fterrors.h
@@ -97,6 +97,8 @@
                "invalid composite glyph" )
   FT_ERRORDEF( FT_Err_Too_Many_Hints,               0x0016, \
                "too many hints" )
+  FT_ERRORDEF( FT_Err_Invalid_Pixel_Size,           0x0017, \
+               "invalid pixel size" )
 
   /* handle errors */
 
diff --git a/src/base/ftstream.c b/src/base/ftstream.c
index aad4f33..5c40e15 100644
--- a/src/base/ftstream.c
+++ b/src/base/ftstream.c
@@ -674,7 +674,7 @@
           FT_UInt  len = fields->size;
 
 
-          if ( stream->cursor + len > stream->limit )
+          if ( cursor + len > stream->limit )
           {
             error = FT_Err_Invalid_Stream_Operation;
             goto Exit;
@@ -683,9 +683,9 @@
           if ( fields->value == ft_frame_bytes )
           {
             p = (FT_Byte*)structure + fields->offset;
-            MEM_Copy( p, stream->cursor, len );
+            MEM_Copy( p, cursor, len );
           }
-          stream->cursor += len;
+          cursor += len;
           fields++;
           continue;
         }
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index 8f264fc..0349f4f 100644
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -235,8 +235,8 @@
 
         root->bbox         = face->cid.font_bbox;
         root->units_per_EM = 1000;
-        root->ascender     =  (FT_Short)face->cid.font_bbox.yMax;
-        root->descender    =  (FT_Short)face->cid.font_bbox.yMin;
+        root->ascender     = (FT_Short)face->cid.font_bbox.yMax;
+        root->descender    = (FT_Short)face->cid.font_bbox.yMin;
         root->height       = ( ( root->ascender + root->descender ) * 12 )
                              / 10;
 
diff --git a/src/type1z/z1objs.c b/src/type1z/z1objs.c
index b29e767..8772692 100644
--- a/src/type1z/z1objs.c
+++ b/src/type1z/z1objs.c
@@ -264,8 +264,8 @@
 
       root->bbox         = face->type1.font_bbox;
       root->units_per_EM = 1000;
-      root->ascender     =  (FT_Short)face->type1.font_bbox.yMax;
-      root->descender    =  (FT_Short)face->type1.font_bbox.yMin;
+      root->ascender     = (FT_Short)face->type1.font_bbox.yMax;
+      root->descender    = (FT_Short)face->type1.font_bbox.yMin;
       root->height       = ( ( root->ascender + root->descender ) * 12 ) / 10;
 
       /* now compute the maximum advance width */
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index 7e467ed..aedbb81 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -50,9 +50,9 @@
 #define FT_STRUCTURE  WinMZ_Header
 
     FT_FRAME_START( 64 ),
-    FT_FRAME_USHORT_LE ( magic ),
-    FT_FRAME_SKIP_BYTES( 29 * 2 ),
-    FT_FRAME_ULONG_LE  ( lfanew ),
+      FT_FRAME_USHORT_LE ( magic ),
+      FT_FRAME_SKIP_BYTES( 29 * 2 ),
+      FT_FRAME_ULONG_LE  ( lfanew ),
     FT_FRAME_END
   };
 
@@ -63,10 +63,10 @@
 #define FT_STRUCTURE  WinNE_Header
 
     FT_FRAME_START( 40 ),
-    FT_FRAME_USHORT_LE ( magic ),
-    FT_FRAME_SKIP_BYTES( 34 ),
-    FT_FRAME_USHORT_LE ( resource_tab_offset ),
-    FT_FRAME_USHORT_LE ( rname_tab_offset ),
+      FT_FRAME_USHORT_LE ( magic ),
+      FT_FRAME_SKIP_BYTES( 34 ),
+      FT_FRAME_USHORT_LE ( resource_tab_offset ),
+      FT_FRAME_USHORT_LE ( rname_tab_offset ),
     FT_FRAME_END
   };
 
@@ -77,42 +77,42 @@
 #define FT_STRUCTURE  WinFNT_Header
 
     FT_FRAME_START( 134 ),
-    FT_FRAME_USHORT_LE( version ),
-    FT_FRAME_ULONG_LE ( file_size ),
-    FT_FRAME_BYTES    ( copyright, 60 ),
-    FT_FRAME_USHORT_LE( file_type ),
-    FT_FRAME_USHORT_LE( nominal_point_size ),
-    FT_FRAME_USHORT_LE( vertical_resolution ),
-    FT_FRAME_USHORT_LE( horizontal_resolution ),
-    FT_FRAME_USHORT_LE( ascent ),
-    FT_FRAME_USHORT_LE( internal_leading ),
-    FT_FRAME_USHORT_LE( external_leading ),
-    FT_FRAME_BYTE     ( italic ),
-    FT_FRAME_BYTE     ( underline ),
-    FT_FRAME_BYTE     ( strike_out ),
-    FT_FRAME_USHORT_LE( weight ),
-    FT_FRAME_BYTE     ( charset ),
-    FT_FRAME_USHORT_LE( pixel_width ),
-    FT_FRAME_USHORT_LE( pixel_height ),
-    FT_FRAME_BYTE     ( pitch_and_family ),
-    FT_FRAME_USHORT_LE( avg_width ),
-    FT_FRAME_USHORT_LE( max_width ),
-    FT_FRAME_BYTE     ( first_char ),
-    FT_FRAME_BYTE     ( last_char ),
-    FT_FRAME_BYTE     ( default_char ),
-    FT_FRAME_BYTE     ( break_char ),
-    FT_FRAME_USHORT_LE( bytes_per_row ),
-    FT_FRAME_ULONG_LE ( device_offset ),
-    FT_FRAME_ULONG_LE ( face_name_offset ),
-    FT_FRAME_ULONG_LE ( bits_pointer ),
-    FT_FRAME_ULONG_LE ( bits_offset ),
-    FT_FRAME_BYTE     ( reserved ),
-    FT_FRAME_ULONG_LE ( flags ),
-    FT_FRAME_USHORT_LE( A_space ),
-    FT_FRAME_USHORT_LE( B_space ),
-    FT_FRAME_USHORT_LE( C_space ),
-    FT_FRAME_USHORT_LE( color_table_offset ),
-    FT_FRAME_BYTES    ( reserved, 4 ),
+      FT_FRAME_USHORT_LE( version ),
+      FT_FRAME_ULONG_LE ( file_size ),
+      FT_FRAME_BYTES    ( copyright, 60 ),
+      FT_FRAME_USHORT_LE( file_type ),
+      FT_FRAME_USHORT_LE( nominal_point_size ),
+      FT_FRAME_USHORT_LE( vertical_resolution ),
+      FT_FRAME_USHORT_LE( horizontal_resolution ),
+      FT_FRAME_USHORT_LE( ascent ),
+      FT_FRAME_USHORT_LE( internal_leading ),
+      FT_FRAME_USHORT_LE( external_leading ),
+      FT_FRAME_BYTE     ( italic ),
+      FT_FRAME_BYTE     ( underline ),
+      FT_FRAME_BYTE     ( strike_out ),
+      FT_FRAME_USHORT_LE( weight ),
+      FT_FRAME_BYTE     ( charset ),
+      FT_FRAME_USHORT_LE( pixel_width ),
+      FT_FRAME_USHORT_LE( pixel_height ),
+      FT_FRAME_BYTE     ( pitch_and_family ),
+      FT_FRAME_USHORT_LE( avg_width ),
+      FT_FRAME_USHORT_LE( max_width ),
+      FT_FRAME_BYTE     ( first_char ),
+      FT_FRAME_BYTE     ( last_char ),
+      FT_FRAME_BYTE     ( default_char ),
+      FT_FRAME_BYTE     ( break_char ),
+      FT_FRAME_USHORT_LE( bytes_per_row ),
+      FT_FRAME_ULONG_LE ( device_offset ),
+      FT_FRAME_ULONG_LE ( face_name_offset ),
+      FT_FRAME_ULONG_LE ( bits_pointer ),
+      FT_FRAME_ULONG_LE ( bits_offset ),
+      FT_FRAME_BYTE     ( reserved ),
+      FT_FRAME_ULONG_LE ( flags ),
+      FT_FRAME_USHORT_LE( A_space ),
+      FT_FRAME_USHORT_LE( B_space ),
+      FT_FRAME_USHORT_LE( C_space ),
+      FT_FRAME_USHORT_LE( color_table_offset ),
+      FT_FRAME_BYTES    ( reserved, 4 ),
     FT_FRAME_END
   };
 
@@ -153,7 +153,7 @@
 
     if ( header->file_type & 1 )
     {
-      FT_TRACE2(( "can't handle vector FNT fonts\n" ));
+      FT_TRACE2(( "[can't handle vector FNT fonts]\n" ));
       error = FT_Err_Unknown_File_Format;
       goto Exit;
     }
@@ -188,6 +188,7 @@
     face->num_fonts = 0;
   }
 
+
   static
   FT_Error  fnt_get_dll_fonts( FNT_Face  face )
   {
@@ -470,7 +471,7 @@
       }
     }
 
-    return ( size->font ? FT_Err_Ok : FT_Err_Invalid_Argument );
+    return ( size->font ? FT_Err_Ok : FT_Err_Invalid_Pixel_Size );
   }