shithub: freetype+ttf2subf

Download patch

ref: 8eacad6daaa625116ed72e5920a3b765d847a89c
parent: 7e25c688de81089bd270dfcae2a25530a5475fd6
author: Werner Lemberg <[email protected]>
date: Mon Sep 19 03:07:11 EDT 2005

* freetype2/src/sfnt/ttload.c (sfnt_dir_check): Modified to allow a
font to have no `head' table if tables `SING' and `META' are
present; this is to support `SING Glyphlet'.

`SING Glyphlet' is an extension to OpenType developed by Adobe
primarily to facilitate adding supplemental glyphs to an OpenType
font (with emphasis on, but not necessariy limited to, gaiji to a
CJK font).  A SING Glyphlet Font is an OpenType font that contains
the outline(s), either in a `glyf' or `CFF' table, for a glyph;
`cmap', `BASE', and `GSUB' tables are present with the same format
and functionaliy as a regular OpenType font; there are no `name',
`head', `OS/2', and `post' tables; there are two new tables, `SING'
which contains details about the glyphlet, and `META' which contains
metadata.

Further information on the SING Glyphlet format can be found at:

  http://www.adobe.com/products/indesign/sing_gaiji.html

* freetype2/include/freetype/ttags.h (TTAG_SING, TTAG_META): New
macros for the OpenType tables `SING' and `META'.  These two tables
are used in SING Glyphlet Format fonts.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2005-09-19  David Somers  <[email protected]>
+
+	* freetype2/src/sfnt/ttload.c (sfnt_dir_check): Modified to allow a
+	font to have no `head' table if tables `SING' and `META' are
+	present; this is to support `SING Glyphlet'.
+
+	`SING Glyphlet' is an extension to OpenType developed by Adobe
+	primarily to facilitate adding supplemental glyphs to an OpenType
+	font (with emphasis on, but not necessariy limited to, gaiji to a
+	CJK font).  A SING Glyphlet Font is an OpenType font that contains
+	the outline(s), either in a `glyf' or `CFF' table, for a glyph;
+	`cmap', `BASE', and `GSUB' tables are present with the same format
+	and functionaliy as a regular OpenType font; there are no `name',
+	`head', `OS/2', and `post' tables; there are two new tables, `SING'
+	which contains details about the glyphlet, and `META' which contains
+	metadata.
+
+	Further information on the SING Glyphlet format can be found at:
+
+	  http://www.adobe.com/products/indesign/sing_gaiji.html
+
+	* freetype2/include/freetype/ttags.h (TTAG_SING, TTAG_META): New
+	macros for the OpenType tables `SING' and `META'.  These two tables
+	are used in SING Glyphlet Format fonts.
+
 2005-09-09  Werner Lemberg  <[email protected]>
 
 	* src/sfnt/sfobjs.c (sfnt_load_face): Reactivate code to set
--- a/include/freetype/tttags.h
+++ b/include/freetype/tttags.h
@@ -67,6 +67,7 @@
 #define TTAG_loca  FT_MAKE_TAG( 'l', 'o', 'c', 'a' )
 #define TTAG_LTSH  FT_MAKE_TAG( 'L', 'T', 'S', 'H' )
 #define TTAG_maxp  FT_MAKE_TAG( 'm', 'a', 'x', 'p' )
+#define TTAG_META  FT_MAKE_TAG( 'M', 'E', 'T', 'A' )
 #define TTAG_MMFX  FT_MAKE_TAG( 'M', 'M', 'F', 'X' )
 #define TTAG_MMSD  FT_MAKE_TAG( 'M', 'M', 'S', 'D' )
 #define TTAG_mort  FT_MAKE_TAG( 'm', 'o', 'r', 't' )
@@ -79,6 +80,7 @@
 #define TTAG_post  FT_MAKE_TAG( 'p', 'o', 's', 't' )
 #define TTAG_prep  FT_MAKE_TAG( 'p', 'r', 'e', 'p' )
 #define TTAG_prop  FT_MAKE_TAG( 'p', 'r', 'o', 'p' )
+#define TTAG_SING  FT_MAKE_TAG( 'S', 'I', 'N', 'G' )
 #define TTAG_trak  FT_MAKE_TAG( 't', 'r', 'a', 'k' )
 #define TTAG_true  FT_MAKE_TAG( 't', 'r', 'u', 'e' )
 #define TTAG_ttc   FT_MAKE_TAG( 't', 't', 'c', ' ' )
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -156,7 +156,8 @@
                   FT_UInt    num_tables )
    {
     FT_Error        error;
-    FT_UInt         nn, has_head = 0;
+    FT_UInt         nn;
+    FT_UInt         has_head = 0, has_sing = 0, has_meta = 0;
 
     const FT_ULong  glyx_tag = FT_MAKE_TAG( 'g', 'l', 'y', 'x' );
     const FT_ULong  locx_tag = FT_MAKE_TAG( 'l', 'o', 'c', 'x' );
@@ -229,12 +230,23 @@
         if ( FT_STREAM_SEEK( offset + 28 + 16*nn ) )
           goto Bad_Format;
       }
+
 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
       else if ( table.Tag == TTAG_bhed )
         goto head_retry;
 #endif  /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */      
+
+      else if ( table.Tag == TTAG_SING )
+        has_sing = 1;
+      else if ( table.Tag == TTAG_META )
+        has_meta = 1;
     }
 
+    /* when sing and meta are present, head is not present */
+    if ( has_sing && has_meta && has_head == 0 )
+        goto Exit;
+
+    /* otherwise, treat a missing head as a failure */
     if ( has_head == 0 )
       goto Bad_Format;