Commit bc25de66c112a9ff4722264330ada77b6e651408

Werner Lemberg 2013-11-16T07:52:20

[sfnt] Fix `OS/2' table version 5 support. We now follow the `official' announcement from Microsoft (on the OpenType mailing list, which unfortunately hasn't a public archive). * include/freetype/tttables.h (TT_OS2): s/usLowerPointSize/usLowerOpticalPointSize/, s/usUpperPointSize/usUpperOpticalPointSize/. * src/sfnt/ttload.c (tt_face_load_os2): Update, and set correct default values.

diff --git a/ChangeLog b/ChangeLog
index dcbc16b..b358116 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2013-11-16  Werner Lemberg  <wl@gnu.org>
+
+	[sfnt] Fix `OS/2' table version 5 support.
+
+	We now follow the `official' announcement from Microsoft (on the
+	OpenType mailing list, which unfortunately hasn't a public archive).
+
+	* include/freetype/tttables.h (TT_OS2):
+	s/usLowerPointSize/usLowerOpticalPointSize/,
+	s/usUpperPointSize/usUpperOpticalPointSize/.
+
+	* src/sfnt/ttload.c (tt_face_load_os2): Update, and set correct
+	default values.
+
 2013-11-13  Werner Lemberg  <wl@gnu.org>
 
 	* builds/unix/ft2unix.h: Remove.  No longer necessary.
diff --git a/include/tttables.h b/include/tttables.h
index a2077be..bb49dc0 100644
--- a/include/tttables.h
+++ b/include/tttables.h
@@ -398,8 +398,8 @@ FT_BEGIN_HEADER
 
     /* only version 5 and higher: */
 
-    FT_UShort  usLowerPointSize;       /* in twips (1/20th points) */
-    FT_UShort  usUpperPointSize;       /* in twips (1/20th points) */
+    FT_UShort  usLowerOpticalPointSize;       /* in twips (1/20th points) */
+    FT_UShort  usUpperOpticalPointSize;       /* in twips (1/20th points) */
 
   } TT_OS2;
 
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index af9e311..0a3cd29 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -1028,8 +1028,8 @@
     static const FT_Frame_Field  os2_fields_extra5[] =
     {
       FT_FRAME_START( 4 ),
-        FT_FRAME_USHORT( usLowerPointSize ),
-        FT_FRAME_USHORT( usUpperPointSize ),
+        FT_FRAME_USHORT( usLowerOpticalPointSize ),
+        FT_FRAME_USHORT( usUpperOpticalPointSize ),
       FT_FRAME_END
     };
 
@@ -1046,15 +1046,15 @@
     if ( FT_STREAM_READ_FIELDS( os2_fields, os2 ) )
       goto Exit;
 
-    os2->ulCodePageRange1 = 0;
-    os2->ulCodePageRange2 = 0;
-    os2->sxHeight         = 0;
-    os2->sCapHeight       = 0;
-    os2->usDefaultChar    = 0;
-    os2->usBreakChar      = 0;
-    os2->usMaxContext     = 0;
-    os2->usLowerPointSize = 0;
-    os2->usUpperPointSize = 0;
+    os2->ulCodePageRange1        = 0;
+    os2->ulCodePageRange2        = 0;
+    os2->sxHeight                = 0;
+    os2->sCapHeight              = 0;
+    os2->usDefaultChar           = 0;
+    os2->usBreakChar             = 0;
+    os2->usMaxContext            = 0;
+    os2->usLowerOpticalPointSize = 0;
+    os2->usUpperOpticalPointSize = 0xFFFF;
 
     if ( os2->version >= 0x0001 )
     {