From 02317d3b18d745cd3381b6a093d384d7afe6d525 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 19 Sep 2005 07:07:11 +0000 Subject: [PATCH] * 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. --- ChangeLog | 25 +++++++++++++++++++++++++ include/freetype/tttags.h | 2 ++ src/sfnt/ttload.c | 14 +++++++++++++- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d76520c25..95d619a12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2005-09-19 David Somers + + * 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 * src/sfnt/sfobjs.c (sfnt_load_face): Reactivate code to set diff --git a/include/freetype/tttags.h b/include/freetype/tttags.h index 845454cb0..a289db3f3 100644 --- a/include/freetype/tttags.h +++ b/include/freetype/tttags.h @@ -67,6 +67,7 @@ FT_BEGIN_HEADER #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 @@ FT_BEGIN_HEADER #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', ' ' ) diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c index 701dc98b9..387c5b3e0 100644 --- 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;