[sfnt] Implement support for `OS/2' table version 5. See http://typedrawers.com/discussion/470/new-microsoft-size-specific-design-selection-mechanism for the announcement. * include/freetype/tttables.h (TT_OS2): Add fields `usLowerPointSize' and `usUpperPointSize'. Since FreeType returns this structure only as a pointer through `FT_Get_Sfnt_Table', there shouldn't be any ABI problems. * src/sfnt/ttload.c (tt_face_load_os2): Implement it. * docs/CHANGES: Updated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
diff --git a/ChangeLog b/ChangeLog
index ac9f00a..2f5585a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2013-10-27 Werner Lemberg <wl@gnu.org>
+
+ [sfnt] Implement support for `OS/2' table version 5.
+
+ See
+
+ http://typedrawers.com/discussion/470/new-microsoft-size-specific-design-selection-mechanism
+
+ for the announcement.
+
+ * include/freetype/tttables.h (TT_OS2): Add fields
+ `usLowerPointSize' and `usUpperPointSize'. Since FreeType returns
+ this structure only as a pointer through `FT_Get_Sfnt_Table', there
+ shouldn't be any ABI problems.
+
+ * src/sfnt/ttload.c (tt_face_load_os2): Implement it.
+
+ * docs/CHANGES: Updated.
+
2013-10-24 Werner Lemberg <wl@gnu.org>
* README.git, docs/CHANGES, docs/INSTALL: Updated.
diff --git a/docs/CHANGES b/docs/CHANGES
index 32d6b65..81a8eeb 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -14,11 +14,14 @@ CHANGES BETWEEN 2.5 and 2.5.1
II. IMPORTANT CHANGES
- - WOFF support has been added.
+ - WOFF font format support has been added.
- The auto-hinter now supports Hebrew. Greek and Cyrillic support
has been improved.
+ - Support for the forthcoming `OS/2' SFNT table version 5, as can
+ be found e.g. in the `Sitka' font family for Windows 8.1.
+
III. MISCELLANEOUS
@@ -28,8 +31,12 @@ CHANGES BETWEEN 2.5 and 2.5.1
- `ftgrid' has been updated to toggle various engines with the `H'
key, similar to `ftview' and `ftdiff'.
- - `ttdebug' now displays twilight data; key `t' shows the twilight
- point table.
+ - Some keys in `ttdebug' have been reassigned from lowercase to
+ their uppercase equivalents; for example `q' to quit the program
+ is now `Q'.
+
+ - `ttdebug' now displays twilight and storage area data; key `T'
+ shows the twilight point table, key `S' the storage data.
- Better support of ARMv7 and x86_64 processors.
diff --git a/include/freetype/tttables.h b/include/freetype/tttables.h
index e090322..426072f 100644
--- a/include/freetype/tttables.h
+++ b/include/freetype/tttables.h
@@ -340,8 +340,8 @@ FT_BEGIN_HEADER
/* TT_OS2 */
/* */
/* <Description> */
- /* A structure used to model a TrueType OS/2 table. This is the long */
- /* table version. All fields comply to the TrueType specification. */
+ /* A structure used to model a TrueType OS/2 table. All fields */
+ /* comply to the OpenType specification. */
/* */
/* Note that we now support old Mac fonts that do not include an OS/2 */
/* table. In this case, the `version' field is always set to 0xFFFF. */
@@ -396,6 +396,11 @@ FT_BEGIN_HEADER
FT_UShort usBreakChar;
FT_UShort usMaxContext;
+ /* only version 5 tables: */
+
+ FT_UShort usLowerPointSize;
+ FT_UShort usUpperPointSize;
+
} TT_OS2;
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index 20e240a..af9e311 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -1003,7 +1003,8 @@
FT_FRAME_END
};
- static const FT_Frame_Field os2_fields_extra[] =
+ /* `OS/2' version 1 and newer */
+ static const FT_Frame_Field os2_fields_extra1[] =
{
FT_FRAME_START( 8 ),
FT_FRAME_ULONG( ulCodePageRange1 ),
@@ -1011,6 +1012,7 @@
FT_FRAME_END
};
+ /* `OS/2' version 2 and newer */
static const FT_Frame_Field os2_fields_extra2[] =
{
FT_FRAME_START( 10 ),
@@ -1022,6 +1024,15 @@
FT_FRAME_END
};
+ /* `OS/2' version 5 and newer */
+ static const FT_Frame_Field os2_fields_extra5[] =
+ {
+ FT_FRAME_START( 4 ),
+ FT_FRAME_USHORT( usLowerPointSize ),
+ FT_FRAME_USHORT( usUpperPointSize ),
+ FT_FRAME_END
+ };
+
/* We now support old Mac fonts where the OS/2 table doesn't */
/* exist. Simply put, we set the `version' field to 0xFFFF */
@@ -1042,11 +1053,13 @@
os2->usDefaultChar = 0;
os2->usBreakChar = 0;
os2->usMaxContext = 0;
+ os2->usLowerPointSize = 0;
+ os2->usUpperPointSize = 0;
if ( os2->version >= 0x0001 )
{
/* only version 1 tables */
- if ( FT_STREAM_READ_FIELDS( os2_fields_extra, os2 ) )
+ if ( FT_STREAM_READ_FIELDS( os2_fields_extra1, os2 ) )
goto Exit;
if ( os2->version >= 0x0002 )
@@ -1054,6 +1067,13 @@
/* only version 2 tables */
if ( FT_STREAM_READ_FIELDS( os2_fields_extra2, os2 ) )
goto Exit;
+
+ if ( os2->version >= 0x0005 )
+ {
+ /* only version 5 tables */
+ if ( FT_STREAM_READ_FIELDS( os2_fields_extra5, os2 ) )
+ goto Exit;
+ }
}
}