shithub: freetype+ttf2subf

Download patch

ref: 5c4e40d7fd1fa1f971733d8c7e559962bb49f195
parent: 22a7f5b8afd1087d485d6442f25638a5823c1264
author: suzuki toshiya <[email protected]>
date: Fri Sep 8 20:59:33 EDT 2017

[sfnt, truetype] Register the tags for marginal fonts.

The first 32bit of standard TrueType variants is 0x00010000,
`OTTO', `ttcf', `true' or `typ1'.  2 marginal dfonts on legacy Mac
OS X, Keyboard.dfont and LastResort.dfont, have the sfnt resources
starting 0xA5 followed by `kbd' or `lst'.  Considering the following
data could be parsed as conventional TrueType fonts, the header
checking is updated to allow these tags.  It seems that recent Mac
OS X has already switched to normal TTF for these fonts.

See the discussion at
http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=3931.0

* include/freetype/tttags.h (TTAG_0xA5kbd, TTAG_0xA5lst): New header
tags for Keyboard.dfont and LastResort.dfont.
* src/sfnt/sfobjs.c (sfnt_open_font): Accept the sfnt resource
starts with TTAG_0xA5kbd or TTAG_0xA5lst.
* src/truetype/ttobjs.c (tt_face_init): Accept the face with the
format tag is TTAG_0xA5kbd or TTAG_0xA5lst.

git/fs: mount .git/fs: mount/attach disallowed
--- a/include/freetype/tttags.h
+++ b/include/freetype/tttags.h
@@ -106,6 +106,12 @@
 #define TTAG_VVAR  FT_MAKE_TAG( 'V', 'V', 'A', 'R' )
 #define TTAG_wOFF  FT_MAKE_TAG( 'w', 'O', 'F', 'F' )
 
+/* used by "Keyboard.dfont" on legacy Mac OS X */
+#define TTAG_0xA5kbd  FT_MAKE_TAG( 0xA5, 'k', 'b', 'd' )
+
+/* used by "LastResort.dfont" on legacy Mac OS X */
+#define TTAG_0xA5lst  FT_MAKE_TAG( 0xA5, 'l', 's', 't' )
+
 
 FT_END_HEADER
 
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -787,6 +787,8 @@
          tag != TTAG_OTTO    &&
          tag != TTAG_true    &&
          tag != TTAG_typ1    &&
+         tag != TTAG_0xA5kbd &&
+         tag != TTAG_0xA5lst &&
          tag != 0x00020000UL )
     {
       FT_TRACE2(( "  not a font using the SFNT container format\n" ));
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -576,9 +576,11 @@
     /* We must also be able to accept Mac/GX fonts, as well as OT ones. */
     /* The 0x00020000 tag is completely undocumented; some fonts from   */
     /* Arphic made for Chinese Windows 3.1 have this.                   */
-    if ( face->format_tag != 0x00010000L &&    /* MS fonts  */
-         face->format_tag != 0x00020000L &&    /* CJK fonts for Win 3.1 */
-         face->format_tag != TTAG_true   )     /* Mac fonts */
+    if ( face->format_tag != 0x00010000L  &&    /* MS fonts  */
+         face->format_tag != 0x00020000L  &&    /* CJK fonts for Win 3.1 */
+         face->format_tag != TTAG_true    &&    /* Mac fonts */
+         face->format_tag != TTAG_0xA5kbd &&    /* Keyboard.dfont for legacy Mac OS X */
+         face->format_tag != TTAG_0xA5lst )     /* LastResort.dfont for legacy Mac OS X */
     {
       FT_TRACE2(( "  not a TTF font\n" ));
       goto Bad_Format;