ref: ee5105107b59049c5d012d7658810c8378c8f411
parent: 994a859831afd3481c8dd00e2648a136c727b10d
author: Werner Lemberg <[email protected]>
date: Sun Oct 27 03:25:35 EDT 2013
[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.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2013-10-27 Werner Lemberg <[email protected]>
+
+ [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 <[email protected]>
* README.git, docs/CHANGES, docs/INSTALL: Updated.
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -14,12 +14,15 @@
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
- The stem darkening feature of the new CFF engine can now be
@@ -28,8 +31,12 @@
- `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.
--- a/include/freetype/tttables.h
+++ b/include/freetype/tttables.h
@@ -340,8 +340,8 @@
/* 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. */
@@ -395,6 +395,11 @@
FT_UShort usDefaultChar;
FT_UShort usBreakChar;
FT_UShort usMaxContext;
+
+ /* only version 5 tables: */
+
+ FT_UShort usLowerPointSize;
+ FT_UShort usUpperPointSize;
} TT_OS2;
--- 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,7 +1024,16 @@
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 */
/* and test this value each time we need to access the table. */
@@ -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;
+ }
}
}