shithub: freetype+ttf2subf

Download patch

ref: 1119baee5466904f04262bb1183b0a3e623f5b74
parent: b7ef2b096867d7351c873c44dd4053d90d7997ef
author: David Turner <[email protected]>
date: Tue May 2 07:01:49 EDT 2000

added support for version 2 of the OS/2 table
five additional fields (see OT Spec 1.2)

git/fs: mount .git/fs: mount/attach disallowed
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -1270,6 +1270,15 @@
                 FT_FRAME_ULONG( TT_OS2, ulCodePageRange1 ),
                 FT_FRAME_ULONG( TT_OS2, ulCodePageRange2 ),
               { ft_frame_end } };
+
+    const FT_Frame_Field  os2_fields_extra2[] = {
+              { ft_frame_start, 0, 10 },
+                FT_FRAME_SHORT( TT_OS2,  sxHeight ),
+                FT_FRAME_SHORT( TT_OS2,  sCapHeight ),
+                FT_FRAME_USHORT( TT_OS2, usDefaultChar ),
+                FT_FRAME_USHORT( TT_OS2, usBreakChar ),
+                FT_FRAME_USHORT( TT_OS2, usMaxContext ),
+              { ft_frame_end } };
 #else
     TT_Int    j;
 #endif
@@ -1354,6 +1363,25 @@
 
       FORGET_Frame();
 #endif
+
+      if ( os2->version >= 0x0002 )
+      {
+        /* only version 2 tables */
+#ifdef READ_FIELDS
+        if ( READ_Fields( os2_fields_extra2, os2 ) ) goto Exit;
+#else
+        if ( ACCESS_Frame( 10L ) )  /* read into frame */
+          goto Exit;
+
+        os2->sxHeight      = GET_Short();
+        os2->sCapHeight    = GET_Short();
+        os2->usDefaultChar = GET_UShort();
+        os2->usBreakChar   = GET_UShort();
+        os2->usMaxContext  = GET_UShort();
+
+        FORGET_Frame();
+#endif
+      }
     }
 
     FT_TRACE2(( "loaded\n" ));