Commit 1119baee5466904f04262bb1183b0a3e623f5b74

David Turner 2000-05-02T11:01:49

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

diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index 410f5c4..07d7993 100644
--- 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" ));