shithub: freetype+ttf2subf

Download patch

ref: b658ac9e63daf21cb136c10444eb29033cde7882
parent: 7b3dc7bb61a786b08e6ac2e12b4a5fa3a312c055
author: Werner Lemberg <[email protected]>
date: Sun Apr 28 06:25:55 EDT 2002

* src/pfr/pfrerror.h: New file.
* include/freetype/ftmoderr.h: Add PFR error codes.
* src/pfr/pfrgload.c: Include pfrerror.h.
Use PCF error codes.
(pfr_extra_item_load_stem_snaps): Fix debug message.
* src/pfr/pfrgload.c: Include pfrerror.h.
Use PCF error codes.
(pfr_extra_item_load_bitmap_info, pfr_glyph_load_simple,
pfr_glyph_load_compound): Fix debug message.
* src/pfr/pfrobjs.c: Include pfrerror.h.
Use PCF error codes.
(pfr_face_init): Return PFR_Err_Unknown_File_Format.
* src/pfr/rules.mk (PFR_DRV_H): Include pfrerror.h.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
 2002-04-28  Werner Lemberg  <[email protected]>
 
+	* src/pfr/pfrerror.h: New file.
+	* include/freetype/ftmoderr.h: Add PFR error codes.
+	* src/pfr/pfrgload.c: Include pfrerror.h.
+	Use PCF error codes.
+	(pfr_extra_item_load_stem_snaps): Fix debug message.
+	* src/pfr/pfrgload.c: Include pfrerror.h.
+	Use PCF error codes.
+	(pfr_extra_item_load_bitmap_info, pfr_glyph_load_simple,
+	pfr_glyph_load_compound): Fix debug message.
+	* src/pfr/pfrobjs.c: Include pfrerror.h.
+	Use PCF error codes.
+	(pfr_face_init): Return PFR_Err_Unknown_File_Format.
+	* src/pfr/rules.mk (PFR_DRV_H): Include pfrerror.h.
+
+2002-04-27  Werner Lemberg  <[email protected]>
+
 	* src/cache/ftccache.c (ftc_cache_lookup),
 	src/cache/ftccmap.c (ftc_cmap_family_init),
 	src/cache/ftcmanag.c (ftc_family_table_alloc),
--- a/include/freetype/ftmoderr.h
+++ b/include/freetype/ftmoderr.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType module error offsets (specification).                       */
 /*                                                                         */
-/*  Copyright 2001 by                                                      */
+/*  Copyright 2001, 2002 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -116,6 +116,7 @@
   FT_MODERRDEF( TrueType, 0xB00, "TrueType module" )
   FT_MODERRDEF( Type1,    0xC00, "Type 1 module" )
   FT_MODERRDEF( Winfonts, 0xD00, "Windows FON/FNT module" )
+  FT_MODERRDEF( PFR,      0xE00, "PFR module" )
 
 
 #ifdef FT_MODERR_END_LIST
--- /dev/null
+++ b/src/pfr/pfrerror.h
@@ -1,0 +1,40 @@
+/***************************************************************************/
+/*                                                                         */
+/*  pfrerror.h                                                             */
+/*                                                                         */
+/*    PFR error codes (specification only).                                */
+/*                                                                         */
+/*  Copyright 2002 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* This file is used to define the PFR error enumeration constants.      */
+  /*                                                                       */
+  /*************************************************************************/
+
+#ifndef __PFRERROR_H__
+#define __PFRERROR_H__
+
+#include FT_MODULE_ERRORS_H
+
+#undef __FTERRORS_H__
+
+#define FT_ERR_PREFIX  PFR_Err_
+#define FT_ERR_BASE    FT_Mod_Err_PFR
+
+#include FT_ERRORS_H
+
+#endif /* __PFRERROR_H__ */
+
+
+/* END */
--- a/src/pfr/pfrgload.c
+++ b/src/pfr/pfrgload.c
@@ -20,6 +20,8 @@
 #include "pfrload.h"            /* for macro definitions */
 #include FT_INTERNAL_DEBUG_H
 
+#include "pfrerror.h"
+
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_pfr
 
@@ -517,8 +519,8 @@
     return error;
 
   Too_Short:
-    error = FT_Err_Invalid_Table;
-    FT_ERROR(( "pfr_glyph_load: invalid glyph data\n" ));
+    error = PFR_Err_Invalid_Table;
+    FT_ERROR(( "pfr_glyph_load_simple: invalid glyph data\n" ));
     goto Exit;
   }
 
@@ -667,8 +669,8 @@
     return error;
 
   Too_Short:
-    error = FT_Err_Invalid_Table;
-    FT_ERROR(( "pfr_glyph_load: invalid glyph data\n" ));
+    error = PFR_Err_Invalid_Table;
+    FT_ERROR(( "pfr_glyph_load_compound: invalid glyph data\n" ));
     goto Exit;
   }
 
--- a/src/pfr/pfrload.c
+++ b/src/pfr/pfrload.c
@@ -20,6 +20,8 @@
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
 
+#include "pfrerror.h"
+
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_pfr
 
@@ -89,7 +91,7 @@
     
   Too_Short:
     FT_ERROR(( "pfr_extra_items_parse: invalid extra items table\n" ));
-    error = FT_Err_Invalid_Table;
+    error = PFR_Err_Invalid_Table;
     goto Exit;
   }
 
@@ -234,7 +236,7 @@
       goto Exit;
 
     if ( index >= num_log_fonts )
-      return FT_Err_Invalid_Argument;
+      return PFR_Err_Invalid_Argument;
 
     if ( FT_STREAM_SKIP( index * 5 ) ||
          FT_READ_USHORT( size )      ||
@@ -327,7 +329,7 @@
   
   Too_Short:
     FT_ERROR(( "pfr_log_font_load: invalid logical font table\n" ));
-    error = FT_Err_Invalid_Table;
+    error = PFR_Err_Invalid_Table;
     goto Fail;
   }
 
@@ -424,8 +426,8 @@
     return error;
     
   Too_Short:
-    error = FT_Err_Invalid_Table;
-    FT_ERROR(( "pfr.extra_item_load: invalid bitmap info table\n" ));
+    error = PFR_Err_Invalid_Table;
+    FT_ERROR(( "pfr_extra_item_load_bitmap_info: invalid bitmap info table\n" ));
     goto Exit;
   }                                  
 
@@ -493,8 +495,8 @@
     return error;
   
   Too_Short:
-    error = FT_Err_Invalid_Table;
-    FT_ERROR(( "pfr.exta_item_load: invalid stem snaps table\n" ));
+    error = PFR_Err_Invalid_Table;
+    FT_ERROR(( "pfr_exta_item_load_stem_snaps: invalid stem snaps table\n" ));
     goto Exit;
   }                                 
 
@@ -678,7 +680,7 @@
     return error;
   
   Too_Short:
-    error = FT_Err_Invalid_Table;
+    error = PFR_Err_Invalid_Table;
     FT_ERROR(( "pfr_phy_font_load: invalid physical font table\n" ));
     goto Fail;
   }
--- a/src/pfr/pfrobjs.c
+++ b/src/pfr/pfrobjs.c
@@ -23,6 +23,8 @@
 #include FT_OUTLINE_H
 #include FT_INTERNAL_DEBUG_H
 
+#include "pfrerror.h"
+
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_pfr
 
@@ -61,7 +63,7 @@
     if ( !pfr_header_check( &face->header ) )
     {
       FT_TRACE4(( "pfr_face_init: not a valid PFR font\n" ));
-      error = FT_Err_Invalid_Argument;
+      error = PFR_Err_Unknown_File_Format;
       goto Exit;
     }
 
@@ -85,7 +87,7 @@
     if ( face_index >= face->root.num_faces )
     {
       FT_ERROR(( "pfr_face_init: invalid face index\n" ));
-      error = FT_Err_Invalid_Argument;
+      error = PFR_Err_Invalid_Argument;
       goto Exit;
     }
 
--- a/src/pfr/rules.mk
+++ b/src/pfr/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2002 by
+# Copyright 2002 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -13,7 +13,7 @@
 # fully.
 
 
-# Pfr driver directory
+# pfr driver directory
 #
 PFR_DIR  := $(SRC_)pfr
 PFR_DIR_ := $(PFR_DIR)$(SEP)
@@ -24,7 +24,7 @@
 PFR_COMPILE := $(FT_COMPILE) $I$(PFR_DIR)
 
 
-# Pfr driver sources (i.e., C files)
+# pfr driver sources (i.e., C files)
 #
 PFR_DRV_SRC := $(PFR_DIR_)pfrload.c  \
                $(PFR_DIR_)pfrgload.c \
@@ -32,9 +32,10 @@
                $(PFR_DIR_)pfrdrivr.c \
                $(PFR_DIR_)pfrobjs.c
 
-# Pfr driver headers
+# pfr driver headers
 #
-PFR_DRV_H := $(PFR_DRV_SRC:%.c=%.h)
+PFR_DRV_H := $(PFR_DRV_SRC:%.c=%.h) \
+             $(PFR_DIR_)pfrerror.h
 
 
 # Pfr driver object(s)
@@ -45,18 +46,18 @@
 PFR_DRV_OBJ_M := $(PFR_DRV_SRC:$(PFR_DIR_)%.c=$(OBJ_)%.$O)
 PFR_DRV_OBJ_S := $(OBJ_)pfr.$O
 
-# Pfr driver source file for single build
+# pfr driver source file for single build
 #
 PFR_DRV_SRC_S := $(PFR_DIR_)pfr.c
 
 
-# Pfr driver - single object
+# pfr driver - single object
 #
 $(PFR_DRV_OBJ_S): $(PFR_DRV_SRC_S) $(PFR_DRV_SRC) $(FREETYPE_H) $(PFR_DRV_H)
 	$(PFR_COMPILE) $T$@ $(PFR_DRV_SRC_S)
 
 
-# Pfr driver - multiple objects
+# pfr driver - multiple objects
 #
 $(OBJ_)%.$O: $(PFR_DIR_)%.c $(FREETYPE_H) $(PFR_DRV_H)
 	$(PFR_COMPILE) $T$@ $<
--- a/src/sfnt/ttcmap0.c
+++ b/src/sfnt/ttcmap0.c
@@ -652,7 +652,7 @@
     /* check that segments are sorted in increasing order and do not */
     /* overlap; check also the offsets                               */
     {
-      FT_UInt  start, end, last = 0,offset, n;
+      FT_UInt  start, end, last = 0, offset, n;
       FT_Int   delta;