shithub: freetype+ttf2subf

Download patch

ref: 12d09050f59d0733e9b0caacc246823f9ee92d2a
parent: cad11476fe5b30302edaa4574c24f9d36d4c3437
author: David Turner <[email protected]>
date: Wed Jan 15 17:48:27 EST 2003

* include/freetype/config/ftheader.h, include/freetype/internal/fnttypes.h,
    include/freetype/ftwinfnt.h, src/base/winfnt.c, src/winfonts/winfnt.c,
    src/base/Jamfile, src/base/rules.mk, src/base/descrip.mms:

      added a Windows .FNT specific API (mostly for Wine). Also fixed a nasty
      bug in the header loader which would cause invalid memory overwrites

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,19 @@
+2003-01-15  Huw D M Davies <[email protected]>
+
+    * include/freetype/config/ftheader.h, include/freetype/internal/fnttypes.h,
+    include/freetype/ftwinfnt.h, src/base/winfnt.c, src/winfonts/winfnt.c,
+    src/base/Jamfile, src/base/rules.mk, src/base/descrip.mms:
+
+      added a Windows .FNT specific API (mostly for Wine). Also fixed a nasty
+      bug in the header loader which would cause invalid memory overwrites
+
 2003-01-14  Graham Asher  <[email protected]>
-    * /include/freetype/ftglyph.h, /src/base/ftglyph.c
+
+    * include/freetype/ftglyph.h, src/base/ftglyph.c:
     Added 'const' to the type of the first argument to FT_Matrix_Multiply,
     which isn't changed - this adds documentation and convenience.
 
+
 2003-01-13  Graham Asher  <[email protected]>
 
     * src/sfnt/ttload.c (tt_face_load_metrics)
@@ -11,6 +22,7 @@
     incremental interface has been specified that has a get_glyph_metrics
     function, implying that metrics will be supplied from outside.
     This happens for certain Type 42 fonts passed from GhostScript.
+
 
 2003-01-11  David Chester  <[email protected]>
 
--- a/include/freetype/config/ftheader.h
+++ b/include/freetype/config/ftheader.h
@@ -376,6 +376,17 @@
   /*************************************************************************/
   /*                                                                       */
   /* @macro:                                                               */
+  /*    FT_WINFONTS_H                                                      */
+  /*                                                                       */
+  /* @description:                                                         */
+  /*    A macro used in #include statements to name the file containing    */
+  /*    the definitions of an API to support Windows .FNT files            */
+  /*                                                                       */
+#define FT_WINFONTS_H   <freetype/ftwinfnt.h>
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* @macro:                                                               */
   /*    FT_GLYPH_H                                                         */
   /*                                                                       */
   /* @description:                                                         */
--- a/include/freetype/internal/fnttypes.h
+++ b/include/freetype/internal/fnttypes.h
@@ -23,6 +23,7 @@
 
 #include <ft2build.h>
 #include FT_FREETYPE_H
+#include FT_WINFONTS_H
 
 
 FT_BEGIN_HEADER
@@ -71,57 +72,15 @@
 #define WINFNT_NE_MAGIC  0x454E
 
 
-  typedef struct  WinFNT_HeaderRec_
-  {
-    FT_UShort  version;
-    FT_ULong   file_size;
-    FT_Byte    copyright[60];
-    FT_UShort  file_type;
-    FT_UShort  nominal_point_size;
-    FT_UShort  vertical_resolution;
-    FT_UShort  horizontal_resolution;
-    FT_UShort  ascent;
-    FT_UShort  internal_leading;
-    FT_UShort  external_leading;
-    FT_Byte    italic;
-    FT_Byte    underline;
-    FT_Byte    strike_out;
-    FT_UShort  weight;
-    FT_Byte    charset;
-    FT_UShort  pixel_width;
-    FT_UShort  pixel_height;
-    FT_Byte    pitch_and_family;
-    FT_UShort  avg_width;
-    FT_UShort  max_width;
-    FT_Byte    first_char;
-    FT_Byte    last_char;
-    FT_Byte    default_char;
-    FT_Byte    break_char;
-    FT_UShort  bytes_per_row;
-    FT_ULong   device_offset;
-    FT_ULong   face_name_offset;
-    FT_ULong   bits_pointer;
-    FT_ULong   bits_offset;
-    FT_Byte    reserved;
-    FT_ULong   flags;
-    FT_UShort  A_space;
-    FT_UShort  B_space;
-    FT_UShort  C_space;
-    FT_UShort  color_table_offset;
-    FT_Byte    reserved2[16];
-
-  } WinFNT_HeaderRec, *WinFNT_Header;
-
-
   typedef struct  FNT_FontRec_
   {
-    FT_ULong          offset;
-    FT_Int            size_shift;
+    FT_ULong             offset;
+    FT_Int               size_shift;
 
-    WinFNT_HeaderRec  header;
+    FT_WinFNT_HeaderRec  header;
 
-    FT_Byte*          fnt_frame;
-    FT_ULong          fnt_size;
+    FT_Byte*             fnt_frame;
+    FT_ULong             fnt_size;
 
   } FNT_FontRec, *FNT_Font;
 
--- a/src/base/Jamfile
+++ b/src/base/Jamfile
@@ -22,9 +22,10 @@
 
 # Add the optional/replaceable files.
 #
-Library  $(FT2_LIB) : ftsystem.c ftinit.c   ftglyph.c  ftmm.c     ftbdf.c
-                      ftbbox.c   ftdebug.c  ftxf86.c   fttype1.c  ftpfr.c
-                      ftstroker.c ;
+Library  $(FT2_LIB) : ftsystem.c   ftinit.c    ftglyph.c  ftmm.c     ftbdf.c
+                      ftbbox.c     ftdebug.c   ftxf86.c   fttype1.c  ftpfr.c
+                      ftstroker.c  ftwinfnt.c
+                      ;
 
 # Add Macintosh-specific file to the library when necessary.
 #
--- a/src/base/descrip.mms
+++ b/src/base/descrip.mms
@@ -15,7 +15,7 @@
 
 CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.builds.vms],[--.include],[--.src.base])
 
-OBJS=ftbase.obj,ftinit.obj,ftglyph.obj,ftdebug.obj,ftbdf.obj,ftmm.obj,fttype1.obj,ftxf86.obj,ftpfr.obj, ftstroker.obj
+OBJS=ftbase.obj,ftinit.obj,ftglyph.obj,ftdebug.obj,ftbdf.obj,ftmm.obj,fttype1.obj,ftxf86.obj,ftpfr.obj,ftstroker.obj,ftwinfnt.obj
 
 all : $(OBJS)
         library [--.lib]freetype.olb $(OBJS)
--- a/src/base/rules.mk
+++ b/src/base/rules.mk
@@ -56,6 +56,7 @@
                 $(BASE_)ftxf86.c    \
                 $(BASE_)ftpfr.c     \
                 $(BASE_)ftstroker.c \
+                $(BASE_)ftwinfnt.c  \
                 $(BASE_)ftbbox.c
 
 # Default extensions objects
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -17,6 +17,7 @@
 
 
 #include <ft2build.h>
+#include FT_WINFONTS_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_OBJECTS_H
@@ -68,7 +69,7 @@
   const FT_Frame_Field  winfnt_header_fields[] =
   {
 #undef  FT_STRUCTURE
-#define FT_STRUCTURE  WinFNT_HeaderRec
+#define FT_STRUCTURE  FT_WinFNT_HeaderRec
 
     FT_FRAME_START( 146 ),
       FT_FRAME_USHORT_LE( version ),
@@ -106,7 +107,7 @@
       FT_FRAME_USHORT_LE( B_space ),
       FT_FRAME_USHORT_LE( C_space ),
       FT_FRAME_USHORT_LE( color_table_offset ),
-      FT_FRAME_BYTES    ( reserved2, 16 ),
+      FT_FRAME_BYTES    ( reserved1, 16 ),
     FT_FRAME_END
   };
 
@@ -127,8 +128,8 @@
   fnt_font_load( FNT_Font   font,
                  FT_Stream  stream )
   {
-    FT_Error       error;
-    WinFNT_Header  header = &font->header;
+    FT_Error          error;
+    FT_WinFNT_Header  header = &font->header;
 
 
     /* first of all, read the FNT header */