aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gyp/sfnt.gyp45
-rw-r--r--include/config/SkUserConfig.h9
-rw-r--r--include/core/SkEndian.h56
-rw-r--r--src/sfnt/SkIBMFamilyClass.h174
-rw-r--r--src/sfnt/SkOTTableTypes.h35
-rw-r--r--src/sfnt/SkOTTable_OS_2.h42
-rw-r--r--src/sfnt/SkOTTable_OS_2_V0.h147
-rw-r--r--src/sfnt/SkOTTable_OS_2_V1.h517
-rw-r--r--src/sfnt/SkOTTable_OS_2_V2.h539
-rw-r--r--src/sfnt/SkOTTable_OS_2_V3.h549
-rw-r--r--src/sfnt/SkOTTable_OS_2_V4.h584
-rw-r--r--src/sfnt/SkOTTable_OS_2_VA.h140
-rw-r--r--src/sfnt/SkOTTable_head.h143
-rw-r--r--src/sfnt/SkOTTable_hhea.h50
-rw-r--r--src/sfnt/SkOTTable_post.h46
-rw-r--r--src/sfnt/SkPanose.h639
-rw-r--r--src/sfnt/SkPreprocessorSeq.h109
-rw-r--r--src/sfnt/SkTypedEnum.h67
18 files changed, 3890 insertions, 1 deletions
diff --git a/gyp/sfnt.gyp b/gyp/sfnt.gyp
new file mode 100644
index 0000000000..5068108663
--- /dev/null
+++ b/gyp/sfnt.gyp
@@ -0,0 +1,45 @@
+{
+ 'includes': [
+ 'common.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'sfnt',
+ 'type': 'static_library',
+ 'dependencies': [
+ 'core.gyp:core',
+ ],
+ 'include_dirs': [
+ '../src/sfnt',
+ ],
+ 'sources': [
+ '../src/sfnt/SkIBMFamilyClass.h',
+ '../src/sfnt/SkOTTableTypes.h',
+ '../src/sfnt/SkOTTable_head.h',
+ '../src/sfnt/SkOTTable_hhea.h',
+ '../src/sfnt/SkOTTable_OS_2.h',
+ '../src/sfnt/SkOTTable_OS_2_V0.h',
+ '../src/sfnt/SkOTTable_OS_2_V1.h',
+ '../src/sfnt/SkOTTable_OS_2_V2.h',
+ '../src/sfnt/SkOTTable_OS_2_V3.h',
+ '../src/sfnt/SkOTTable_OS_2_V4.h',
+ '../src/sfnt/SkOTTable_OS_2_VA.h',
+ '../src/sfnt/SkOTTable_post.h',
+ '../src/sfnt/SkPanose.h',
+ '../src/sfnt/SkPreprocessorSeq.h',
+ '../src/sfnt/SkTypedEnum.h',
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ '../src/sfnt',
+ ],
+ },
+ },
+ ],
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/include/config/SkUserConfig.h b/include/config/SkUserConfig.h
index f0fa8417bc..75e929203c 100644
--- a/include/config/SkUserConfig.h
+++ b/include/config/SkUserConfig.h
@@ -86,6 +86,15 @@
//#define SK_CPU_BENDIAN
//#define SK_CPU_LENDIAN
+/* Most compilers use the same bit endianness for bit flags in a byte as the
+ system byte endianness, and this is the default. If for some reason this
+ needs to be overridden, specify which of the mutually exclusive flags to
+ use. For example, some atom processors in certain configurations have big
+ endian byte order but little endian bit orders.
+*/
+//#define SK_UINT8_BITFIELD_BENDIAN
+//#define SK_UINT8_BITFIELD_LENDIAN
+
/* Some compilers don't support long long for 64bit integers. If yours does
not, define this to the appropriate type.
diff --git a/include/core/SkEndian.h b/include/core/SkEndian.h
index 3eb67dabfe..910cf1eeab 100644
--- a/include/core/SkEndian.h
+++ b/include/core/SkEndian.h
@@ -31,8 +31,11 @@
*/
static inline uint16_t SkEndianSwap16(U16CPU value) {
SkASSERT(value == (uint16_t)value);
- return (uint16_t)((value >> 8) | (value << 8));
+ return static_cast<uint16_t>((value >> 8) | (value << 8));
}
+template<uint16_t N> struct SkTEndianSwap16 {
+ static const uint16_t value = static_cast<uint16_t>((N >> 8) | ((N & 0xFF) << 8));
+};
/** Vector version of SkEndianSwap16(), which swaps the
low two bytes of each value in the array.
@@ -55,6 +58,12 @@ static inline uint32_t SkEndianSwap32(uint32_t value) {
((value & 0xFF0000) >> 8) |
(value >> 24);
}
+template<uint32_t N> struct SkTEndianSwap32 {
+ static const uint32_t value = ((N & 0xFF) << 24) |
+ ((N & 0xFF00) << 8) |
+ ((N & 0xFF0000) >> 8) |
+ (N >> 24);
+};
/** Vector version of SkEndianSwap16(), which swaps the
bytes of each value in the array.
@@ -73,11 +82,21 @@ static inline void SkEndianSwap32s(uint32_t array[], int count) {
#define SkEndian_SwapBE32(n) SkEndianSwap32(n)
#define SkEndian_SwapLE16(n) (n)
#define SkEndian_SwapLE32(n) (n)
+
+ #define SkTEndian_SwapBE16(n) SkTEndianSwap16<n>::value
+ #define SkTEndian_SwapBE32(n) SkTEndianSwap32<n>::value
+ #define SkTEndian_SwapLE16(n) (n)
+ #define SkTEndian_SwapLE32(n) (n)
#else // SK_CPU_BENDIAN
#define SkEndian_SwapBE16(n) (n)
#define SkEndian_SwapBE32(n) (n)
#define SkEndian_SwapLE16(n) SkEndianSwap16(n)
#define SkEndian_SwapLE32(n) SkEndianSwap32(n)
+
+ #define SkTEndian_SwapBE16(n) (n)
+ #define SkTEndian_SwapBE32(n) (n)
+ #define SkTEndian_SwapLE16(n) SkTEndianSwap16<n>::value
+ #define SkTEndian_SwapLE32(n) SkTEndianSwap32<n>::value
#endif
// When a bytestream is embedded in a 32-bit word, how far we need to
@@ -94,5 +113,40 @@ static inline void SkEndianSwap32s(uint32_t array[], int count) {
#define SkEndian_Byte3Shift 0
#endif
+
+#if defined(SK_UINT8_BITFIELD_LENDIAN) && defined(SK_UINT8_BITFIELD_BENDIAN)
+ #error "can't have both bitfield LENDIAN and BENDIAN defined"
+#endif
+
+#if !defined(SK_UINT8_BITFIELD_LENDIAN) && !defined(SK_UINT8_BITFIELD_BENDIAN)
+ #ifdef SK_CPU_LENDIAN
+ #define SK_UINT8_BITFIELD_LENDIAN
+ #else
+ #define SK_UINT8_BITFIELD_BENDIAN
+ #endif
+#endif
+
+#ifdef SK_UINT8_BITFIELD_LENDIAN
+ #define SK_UINT8_BITFIELD(f0, f1, f2, f3, f4, f5, f6, f7) \
+ SK_OT_BYTE f0 : 1; \
+ SK_OT_BYTE f1 : 1; \
+ SK_OT_BYTE f2 : 1; \
+ SK_OT_BYTE f3 : 1; \
+ SK_OT_BYTE f4 : 1; \
+ SK_OT_BYTE f5 : 1; \
+ SK_OT_BYTE f6 : 1; \
+ SK_OT_BYTE f7 : 1;
+#else
+ #define SK_UINT8_BITFIELD(f0, f1, f2, f3, f4, f5, f6, f7) \
+ SK_OT_BYTE f7 : 1; \
+ SK_OT_BYTE f6 : 1; \
+ SK_OT_BYTE f5 : 1; \
+ SK_OT_BYTE f4 : 1; \
+ SK_OT_BYTE f3 : 1; \
+ SK_OT_BYTE f2 : 1; \
+ SK_OT_BYTE f1 : 1; \
+ SK_OT_BYTE f0 : 1;
+#endif
+
#endif
diff --git a/src/sfnt/SkIBMFamilyClass.h b/src/sfnt/SkIBMFamilyClass.h
new file mode 100644
index 0000000000..45d9822f50
--- /dev/null
+++ b/src/sfnt/SkIBMFamilyClass.h
@@ -0,0 +1,174 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkIBMFamilyClass_DEFINED
+#define SkIBMFamilyClass_DEFINED
+
+#include "SkOTTableTypes.h"
+#include "SkTypedEnum.h"
+
+#pragma pack(push, 1)
+
+struct SkIBMFamilyClass {
+ SK_TYPED_ENUM(Class, SK_OT_BYTE,
+ ((NoClassification, 0))
+ ((OldstyleSerifs, 1))
+ ((TransitionalSerifs, 2))
+ ((ModernSerifs, 3))
+ ((ClarendonSerifs, 4))
+ ((SlabSerifs, 5))
+ //6 reserved for future use
+ ((FreeformSerifs, 7))
+ ((SansSerif, 8))
+ ((Ornamentals, 9))
+ ((Scripts, 10))
+ //11 reserved for future use
+ ((Symbolic, 12))
+ //13-15 reserved for future use
+ SK_SEQ_END,
+ (familyClass)SK_SEQ_END)
+ union SubClass {
+ struct OldstyleSerifs {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((NoClassification, 0))
+ ((IBMRoundedLegibility, 1))
+ ((Garalde, 2))
+ ((Venetian, 3))
+ ((ModifiedVenetian, 4))
+ ((DutchModern, 5))
+ ((DutchTraditional, 6))
+ ((Contemporary, 7))
+ ((Calligraphic, 8))
+ //9-14 reserved for future use
+ ((Miscellaneous, 15))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } oldstyleSerifs;
+ struct TransitionalSerifs {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((NoClassification, 0))
+ ((DirectLine, 1))
+ ((Script, 2))
+ //3-14 reserved for future use
+ ((Miscellaneous, 15))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } transitionalSerifs;
+ struct ModernSerifs {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((NoClassification, 0))
+ ((Italian, 1))
+ ((Script, 2))
+ //3-14 reserved for future use
+ ((Miscellaneous, 15))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } modernSerifs;
+ struct ClarendonSerifs {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((NoClassification, 0))
+ ((Clarendon, 1))
+ ((Modern, 2))
+ ((Traditional, 3))
+ ((Newspaper, 4))
+ ((StubSerif, 5))
+ ((Monotone, 6))
+ ((Typewriter, 7))
+ //8-14 reserved for future use
+ ((Miscellaneous, 15))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } clarendonSerifs;
+ struct SlabSerifs {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((NoClassification, 0))
+ ((Monotone, 1))
+ ((Humanist, 2))
+ ((Geometric, 3))
+ ((Swiss, 4))
+ ((Typewriter, 5))
+ //6-14 reserved for future use
+ ((Miscellaneous, 15))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } slabSerifs;
+ struct FreeformSerifs {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((NoClassification, 0))
+ ((Modern, 1))
+ //2-14 reserved for future use
+ ((Miscellaneous, 15))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } freeformSerifs;
+ struct SansSerif {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((NoClassification, 0))
+ ((IBMNeoGrotesqueGothic, 1))
+ ((Humanist, 2))
+ ((LowXRoundGeometric, 3))
+ ((HighXRoundGeometric, 4))
+ ((NeoGrotesqueGothic, 5))
+ ((ModifiedNeoGrotesqueGothic, 6))
+ //7-8 reserved for future use
+ ((TypewriterGothic, 9))
+ ((Matrix, 10))
+ //11-14 reserved for future use
+ ((Miscellaneous, 15))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } sansSerif;
+ struct Ornamentals {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((NoClassification, 0))
+ ((Engraver, 1))
+ ((BlackLetter, 2))
+ ((Decorative, 3))
+ ((ThreeDimensional, 4))
+ //5-14 reserved for future use
+ ((Miscellaneous, 15))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } ornamentals;
+ struct Scripts {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((NoClassification, 0))
+ ((Uncial, 1))
+ ((Brush_Joined, 2))
+ ((Formal_Joined, 3))
+ ((Monotone_Joined, 4))
+ ((Calligraphic, 5))
+ ((Brush_Unjoined, 6))
+ ((Formal_Unjoined, 7))
+ ((Monotone_Unjoined, 8))
+ //9-14 reserved for future use
+ ((Miscellaneous, 15))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } scripts;
+ struct Symbolic {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((NoClassification, 0))
+ //1-2 reserved for future use
+ ((MixedSerif, 3))
+ //4-5 reserved for future use
+ ((OldstyleSerif, 6))
+ ((NeoGrotesqueSansSerif, 7))
+ //8-14 reserved for future use
+ ((Miscellaneous, 15))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } symbolic;
+ } familySubClass;
+};
+
+#pragma pack(pop)
+
+
+SK_COMPILE_ASSERT(sizeof(SkIBMFamilyClass) == 2, sizeof_SkIBMFamilyClass_not_2);
+
+#endif
diff --git a/src/sfnt/SkOTTableTypes.h b/src/sfnt/SkOTTableTypes.h
new file mode 100644
index 0000000000..4073bd2c4e
--- /dev/null
+++ b/src/sfnt/SkOTTableTypes.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkOTTableTypes_DEFINED
+#define SkOTTableTypes_DEFINED
+
+#include "SkTypes.h"
+#include "SkEndian.h"
+
+//All SK_OT_ prefixed types should be considered as big endian.
+typedef uint8_t SK_OT_BYTE;
+#if CHAR_BIT == 8
+typedef signed char SK_OT_CHAR; //easier to debug
+#else
+typedef int8_t SK_OT_CHAR;
+#endif
+typedef int16_t SK_OT_SHORT;
+typedef uint16_t SK_OT_USHORT;
+typedef uint32_t SK_OT_ULONG;
+typedef int32_t SK_OT_LONG;
+//16.16 Fixed point representation.
+typedef int32_t SK_OT_Fixed;
+//F units are the units of measurement in em space.
+typedef int16_t SK_OT_FWORD;
+typedef uint16_t SK_OT_UFWORD;
+//Number of seconds since 12:00 midnight, January 1, 1904.
+typedef uint64_t SK_OT_LONGDATETIME;
+
+#define SK_OT_BYTE_BITFIELD SK_UINT8_BITFIELD
+
+#endif
diff --git a/src/sfnt/SkOTTable_OS_2.h b/src/sfnt/SkOTTable_OS_2.h
new file mode 100644
index 0000000000..9e1f8a419b
--- /dev/null
+++ b/src/sfnt/SkOTTable_OS_2.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkOTTable_OS_2_DEFINED
+#define SkOTTable_OS_2_DEFINED
+
+#include "SkOTTable_OS_2_VA.h"
+#include "SkOTTable_OS_2_V0.h"
+#include "SkOTTable_OS_2_V1.h"
+#include "SkOTTable_OS_2_V2.h"
+#include "SkOTTable_OS_2_V3.h"
+#include "SkOTTable_OS_2_V4.h"
+
+#pragma pack(push, 1)
+
+union SkOTTableOS2 {
+ //original V0 TT
+ struct VA : SkOTTableOS2_VA { } vA;
+ struct V0 : SkOTTableOS2_V0 { } v0;
+ struct V1 : SkOTTableOS2_V1 { } v1;
+ struct V2 : SkOTTableOS2_V2 { } v2;
+ //makes fsType 0-3 exclusive
+ struct V3 : SkOTTableOS2_V3 { } v3;
+ //defines fsSelection bits 7-9
+ struct V4 : SkOTTableOS2_V4 { } v4;
+};
+
+#pragma pack(pop)
+
+
+SK_COMPILE_ASSERT(sizeof(SkOTTableOS2::VA) == 68, sizeof_SkOTTableOS2__VA_not_68);
+SK_COMPILE_ASSERT(sizeof(SkOTTableOS2::V0) == 78, sizeof_SkOTTableOS2__V0_not_78);
+SK_COMPILE_ASSERT(sizeof(SkOTTableOS2::V1) == 86, sizeof_SkOTTableOS2__V1_not_86);
+SK_COMPILE_ASSERT(sizeof(SkOTTableOS2::V2) == 96, sizeof_SkOTTableOS2__V2_not_96);
+SK_COMPILE_ASSERT(sizeof(SkOTTableOS2::V3) == 96, sizeof_SkOTTableOS2__V3_not_96);
+SK_COMPILE_ASSERT(sizeof(SkOTTableOS2::V4) == 96, sizeof_SkOTTableOS2__V4_not_96);
+
+#endif
diff --git a/src/sfnt/SkOTTable_OS_2_V0.h b/src/sfnt/SkOTTable_OS_2_V0.h
new file mode 100644
index 0000000000..25e8c9c3e0
--- /dev/null
+++ b/src/sfnt/SkOTTable_OS_2_V0.h
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkOTTable_OS_2_V0_DEFINED
+#define SkOTTable_OS_2_V0_DEFINED
+
+#include "SkEndian.h"
+#include "SkIBMFamilyClass.h"
+#include "SkOTTableTypes.h"
+#include "SkPanose.h"
+#include "SkTypedEnum.h"
+
+#pragma pack(push, 1)
+
+struct SkOTTableOS2_V0 {
+ SK_OT_USHORT version;
+ //The only way to differentiate versionA and version0 is by size.
+ static const SK_OT_USHORT version0 = SkTEndian_SwapBE16(0);
+ SK_OT_SHORT xAvgCharWidth;
+ struct WeightClass {
+ SK_TYPED_ENUM(Value, SK_OT_USHORT,
+ ((Thin, SkTEndian_SwapBE16(100)))
+ ((ExtraLight, SkTEndian_SwapBE16(200)))
+ ((Light, SkTEndian_SwapBE16(300)))
+ ((Normal, SkTEndian_SwapBE16(400)))
+ ((Medium, SkTEndian_SwapBE16(500)))
+ ((SemiBold, SkTEndian_SwapBE16(600)))
+ ((Bold, SkTEndian_SwapBE16(700)))
+ ((ExtraBold, SkTEndian_SwapBE16(800)))
+ ((Black, SkTEndian_SwapBE16(900)))
+ SK_SEQ_END,
+ SK_SEQ_END)
+ SK_OT_USHORT value;
+ } usWeightClass;
+ struct WidthClass {
+ SK_TYPED_ENUM(Value, SK_OT_USHORT,
+ ((UltraCondensed, SkTEndian_SwapBE16(1)))
+ ((ExtraCondensed, SkTEndian_SwapBE16(2)))
+ ((Condensed, SkTEndian_SwapBE16(3)))
+ ((SemiCondensed, SkTEndian_SwapBE16(4)))
+ ((Medium, SkTEndian_SwapBE16(5)))
+ ((SemiExpanded, SkTEndian_SwapBE16(6)))
+ ((Expanded, SkTEndian_SwapBE16(7)))
+ ((ExtraExpanded, SkTEndian_SwapBE16(8)))
+ ((UltraExpanded, SkTEndian_SwapBE16(9)))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } usWidthClass;
+ union Type {
+ struct Field {
+ //8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved08,
+ Reserved09,
+ Reserved10,
+ Reserved11,
+ Reserved12,
+ Reserved13,
+ Reserved14,
+ Reserved15)
+ //0-7
+ SK_OT_BYTE_BITFIELD(
+ Reserved00,
+ Restricted,
+ PreviewPrint,
+ Editable,
+ Reserved04,
+ Reserved05,
+ Reserved06,
+ Reserved07)
+ } field;
+ struct Raw {
+ static const SK_OT_USHORT Installable = SkTEndian_SwapBE16(0);
+ static const SK_OT_USHORT RestrictedMask = SkTEndian_SwapBE16(1 << 1);
+ static const SK_OT_USHORT PreviewPrintMask = SkTEndian_SwapBE16(1 << 2);
+ static const SK_OT_USHORT EditableMask = SkTEndian_SwapBE16(1 << 3);
+ SK_OT_USHORT value;
+ } raw;
+ } fsType;
+ SK_OT_SHORT ySubscriptXSize;
+ SK_OT_SHORT ySubscriptYSize;
+ SK_OT_SHORT ySubscriptXOffset;
+ SK_OT_SHORT ySubscriptYOffset;
+ SK_OT_SHORT ySuperscriptXSize;
+ SK_OT_SHORT ySuperscriptYSize;
+ SK_OT_SHORT ySuperscriptXOffset;
+ SK_OT_SHORT ySuperscriptYOffset;
+ SK_OT_SHORT yStrikeoutSize;
+ SK_OT_SHORT yStrikeoutPosition;
+ SkIBMFamilyClass sFamilyClass;
+ SkPanose panose;
+ SK_OT_ULONG ulCharRange[4];
+ SK_OT_CHAR achVendID[4];
+ union Selection {
+ struct Field {
+ //8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved08,
+ Reserved09,
+ Reserved10,
+ Reserved11,
+ Reserved12,
+ Reserved13,
+ Reserved14,
+ Reserved15)
+ //0-7
+ SK_OT_BYTE_BITFIELD(
+ Italic,
+ Underscore,
+ Negative,
+ Outlined,
+ Strikeout,
+ Bold,
+ Regular,
+ Reserved07)
+ } field;
+ struct Raw {
+ static const SK_OT_USHORT ItalicMask = SkTEndian_SwapBE16(1 << 0);
+ static const SK_OT_USHORT UnderscoreMask = SkTEndian_SwapBE16(1 << 1);
+ static const SK_OT_USHORT NegativeMask = SkTEndian_SwapBE16(1 << 2);
+ static const SK_OT_USHORT OutlinedMask = SkTEndian_SwapBE16(1 << 3);
+ static const SK_OT_USHORT StrikeoutMask = SkTEndian_SwapBE16(1 << 4);
+ static const SK_OT_USHORT BoldMask = SkTEndian_SwapBE16(1 << 5);
+ static const SK_OT_USHORT RegularMask = SkTEndian_SwapBE16(1 << 6);
+ SK_OT_USHORT value;
+ } raw;
+ } fsSelection;
+ SK_OT_USHORT usFirstCharIndex;
+ SK_OT_USHORT usLastCharIndex;
+ //version0
+ SK_OT_SHORT sTypoAscender;
+ SK_OT_SHORT sTypoDescender;
+ SK_OT_SHORT sTypoLineGap;
+ SK_OT_USHORT usWinAscent;
+ SK_OT_USHORT usWinDescent;
+};
+
+#pragma pack(pop)
+
+
+SK_COMPILE_ASSERT(sizeof(SkOTTableOS2_V0) == 78, sizeof_SkOTTableOS2_V0_not_78);
+
+#endif
diff --git a/src/sfnt/SkOTTable_OS_2_V1.h b/src/sfnt/SkOTTable_OS_2_V1.h
new file mode 100644
index 0000000000..47d9921c41
--- /dev/null
+++ b/src/sfnt/SkOTTable_OS_2_V1.h
@@ -0,0 +1,517 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkOTTable_OS_2_V1_DEFINED
+#define SkOTTable_OS_2_V1_DEFINED
+
+#include "SkEndian.h"
+#include "SkIBMFamilyClass.h"
+#include "SkOTTableTypes.h"
+#include "SkPanose.h"
+#include "SkTypedEnum.h"
+
+#pragma pack(push, 1)
+
+struct SkOTTableOS2_V1 {
+ SK_OT_USHORT version;
+ static const SK_OT_USHORT version1 = SkTEndian_SwapBE16(1);
+ SK_OT_SHORT xAvgCharWidth;
+ struct WeightClass {
+ SK_TYPED_ENUM(Value, SK_OT_USHORT,
+ ((Thin, SkTEndian_SwapBE16(100)))
+ ((ExtraLight, SkTEndian_SwapBE16(200)))
+ ((Light, SkTEndian_SwapBE16(300)))
+ ((Normal, SkTEndian_SwapBE16(400)))
+ ((Medium, SkTEndian_SwapBE16(500)))
+ ((SemiBold, SkTEndian_SwapBE16(600)))
+ ((Bold, SkTEndian_SwapBE16(700)))
+ ((ExtraBold, SkTEndian_SwapBE16(800)))
+ ((Black, SkTEndian_SwapBE16(900)))
+ SK_SEQ_END,
+ SK_SEQ_END)
+ SK_OT_USHORT value;
+ } usWeightClass;
+ struct WidthClass {
+ SK_TYPED_ENUM(Value, SK_OT_USHORT,
+ ((UltraCondensed, SkTEndian_SwapBE16(1)))
+ ((ExtraCondensed, SkTEndian_SwapBE16(2)))
+ ((Condensed, SkTEndian_SwapBE16(3)))
+ ((SemiCondensed, SkTEndian_SwapBE16(4)))
+ ((Medium, SkTEndian_SwapBE16(5)))
+ ((SemiExpanded, SkTEndian_SwapBE16(6)))
+ ((Expanded, SkTEndian_SwapBE16(7)))
+ ((ExtraExpanded, SkTEndian_SwapBE16(8)))
+ ((UltraExpanded, SkTEndian_SwapBE16(9)))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } usWidthClass;
+ union Type {
+ struct Field {
+ //8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved08,
+ Reserved09,
+ Reserved10,
+ Reserved11,
+ Reserved12,
+ Reserved13,
+ Reserved14,
+ Reserved15)
+ //0-7
+ SK_OT_BYTE_BITFIELD(
+ Reserved00,
+ Restricted,
+ PreviewPrint,
+ Editable,
+ Reserved04,
+ Reserved05,
+ Reserved06,
+ Reserved07)
+ } field;
+ struct Raw {
+ static const SK_OT_USHORT Installable = SkTEndian_SwapBE16(0);
+ static const SK_OT_USHORT RestrictedMask = SkTEndian_SwapBE16(1 << 1);
+ static const SK_OT_USHORT PreviewPrintMask = SkTEndian_SwapBE16(1 << 2);
+ static const SK_OT_USHORT EditableMask = SkTEndian_SwapBE16(1 << 3);
+ SK_OT_USHORT value;
+ } raw;
+ } fsType;
+ SK_OT_SHORT ySubscriptXSize;
+ SK_OT_SHORT ySubscriptYSize;
+ SK_OT_SHORT ySubscriptXOffset;
+ SK_OT_SHORT ySubscriptYOffset;
+ SK_OT_SHORT ySuperscriptXSize;
+ SK_OT_SHORT ySuperscriptYSize;
+ SK_OT_SHORT ySuperscriptXOffset;
+ SK_OT_SHORT ySuperscriptYOffset;
+ SK_OT_SHORT yStrikeoutSize;
+ SK_OT_SHORT yStrikeoutPosition;
+ SkIBMFamilyClass sFamilyClass;
+ SkPanose panose;
+ union UnicodeRange {
+ struct Field {
+ //l0 24-31
+ SK_OT_BYTE_BITFIELD(
+ Thai,
+ Lao,
+ BasicGeorgian,
+ GeorgianExtended,
+ HangulJamo,
+ LatinExtendedAdditional,
+ GreekExtended,
+ GeneralPunctuation)
+ //l0 16-23
+ SK_OT_BYTE_BITFIELD(
+ Bengali,
+ Gurmukhi,
+ Gujarati,
+ Oriya,
+ Tamil,
+ Telugu,
+ Kannada,
+ Malayalam)
+ //l0 8-15
+ SK_OT_BYTE_BITFIELD(
+ GreekSymbolsAndCoptic,
+ Cyrillic,
+ Armenian,
+ BasicHebrew,
+ HebrewExtendedAB,
+ BasicArabic,
+ ArabicExtended,
+ Devanagari)
+ //l0 0-7
+ SK_OT_BYTE_BITFIELD(
+ BasicLatin,
+ Latin1Supplement,
+ LatinExtendedA,
+ LatinExtendedB,
+ IPAExtensions,
+ SpacingModifierLetters,
+ CombiningDiacriticalMarks,
+ BasicGreek)
+
+ //l1 24-31
+ SK_OT_BYTE_BITFIELD(
+ Hangul,
+ Reserved057,
+ Reserved058,
+ CJKUnifiedIdeographs,
+ PrivateUseArea,
+ CJKCompatibilityIdeographs,
+ AlphabeticPresentationForms,
+ ArabicPresentationFormsA)
+ //l1 16-23
+ SK_OT_BYTE_BITFIELD(
+ CJKSymbolsAndPunctuation,
+ Hiragana,
+ Katakana,
+ Bopomofo,
+ HangulCompatibilityJamo,
+ CJKMiscellaneous,
+ EnclosedCJKLettersAndMonths,
+ CJKCompatibility)
+ //l1 8-15
+ SK_OT_BYTE_BITFIELD(
+ ControlPictures,
+ OpticalCharacterRecognition,
+ EnclosedAlphanumerics,
+ BoxDrawing,
+ BlockElements,
+ GeometricShapes,
+ MiscellaneousSymbols,
+ Dingbats)
+ //l1 0-7
+ SK_OT_BYTE_BITFIELD(
+ SuperscriptsAndSubscripts,
+ CurrencySymbols,
+ CombiningDiacriticalMarksForSymbols,
+ LetterlikeSymbols,
+ NumberForms,
+ Arrows,
+ MathematicalOperators,
+ MiscellaneousTechnical)
+
+ //l2 24-31
+ SK_OT_BYTE_BITFIELD(
+ Reserved088,
+ Reserved089,
+ Reserved090,
+ Reserved091,
+ Reserved092,
+ Reserved093,
+ Reserved094,
+ Reserved095)
+ //l2 16-23
+ SK_OT_BYTE_BITFIELD(
+ Reserved080,
+ Reserved081,
+ Reserved082,
+ Reserved083,
+ Reserved084,
+ Reserved085,
+ Reserved086,
+ Reserved087)
+ //l2 8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved072,
+ Reserved073,
+ Reserved074,
+ Reserved075,
+ Reserved076,
+ Reserved077,
+ Reserved078,
+ Reserved079)
+ //l2 0-7
+ SK_OT_BYTE_BITFIELD(
+ CombiningHalfMarks,
+ CJKCompatibilityForms,
+ SmallFormVariants,
+ ArabicPresentationFormsB,
+ HalfwidthAndFullwidthForms,
+ Specials,
+ Reserved70,
+ Reserved71)
+
+ //l3 24-31
+ SK_OT_BYTE_BITFIELD(
+ Reserved120,
+ Reserved121,
+ Reserved122,
+ Reserved123,
+ Reserved124,
+ Reserved125,
+ Reserved126,
+ Reserved127)
+ //l3 16-23
+ SK_OT_BYTE_BITFIELD(
+ Reserved112,
+ Reserved113,
+ Reserved114,
+ Reserved115,
+ Reserved116,
+ Reserved117,
+ Reserved118,
+ Reserved119)
+ //l3 8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved104,
+ Reserved105,
+ Reserved106,
+ Reserved107,
+ Reserved108,
+ Reserved109,
+ Reserved110,
+ Reserved111)
+ //l3 0-7
+ SK_OT_BYTE_BITFIELD(
+ Reserved096,
+ Reserved097,
+ Reserved098,
+ Reserved099,
+ Reserved100,
+ Reserved101,
+ Reserved102,
+ Reserved103)
+ } field;
+ struct Raw {
+ struct l0 {
+ static const SK_OT_ULONG BasicLatinMask = SkTEndian_SwapBE32(1 << 0);
+ static const SK_OT_ULONG Latin1SupplementMask = SkTEndian_SwapBE32(1 << 1);
+ static const SK_OT_ULONG LatinExtendedAMask = SkTEndian_SwapBE32(1 << 2);
+ static const SK_OT_ULONG LatinExtendedBMask = SkTEndian_SwapBE32(1 << 3);
+ static const SK_OT_ULONG IPAExtensionsMask = SkTEndian_SwapBE32(1 << 4);
+ static const SK_OT_ULONG SpacingModifierLettersMask = SkTEndian_SwapBE32(1 << 5);
+ static const SK_OT_ULONG CombiningDiacriticalMarksMask = SkTEndian_SwapBE32(1 << 6);
+ static const SK_OT_ULONG BasicGreekMask = SkTEndian_SwapBE32(1 << 7);
+ static const SK_OT_ULONG GreekSymbolsAndCCopticMask = SkTEndian_SwapBE32(1 << 8);
+ static const SK_OT_ULONG CyrillicMask = SkTEndian_SwapBE32(1 << 9);
+ static const SK_OT_ULONG ArmenianMask = SkTEndian_SwapBE32(1 << 10);
+ static const SK_OT_ULONG BasicHebrewMask = SkTEndian_SwapBE32(1 << 11);
+ static const SK_OT_ULONG HebrewExtendedABMask = SkTEndian_SwapBE32(1 << 12);
+ static const SK_OT_ULONG BasicArabicMask = SkTEndian_SwapBE32(1 << 13);
+ static const SK_OT_ULONG ArabicExtendedMask = SkTEndian_SwapBE32(1 << 14);
+ static const SK_OT_ULONG DevanagariMask = SkTEndian_SwapBE32(1 << 15);
+ static const SK_OT_ULONG BengaliMask = SkTEndian_SwapBE32(1 << 16);
+ static const SK_OT_ULONG GurmukhiMask = SkTEndian_SwapBE32(1 << 17);
+ static const SK_OT_ULONG GujaratiMask = SkTEndian_SwapBE32(1 << 18);
+ static const SK_OT_ULONG OriyaMask = SkTEndian_SwapBE32(1 << 19);
+ static const SK_OT_ULONG TamilMask = SkTEndian_SwapBE32(1 << 20);
+ static const SK_OT_ULONG TeluguMask = SkTEndian_SwapBE32(1 << 21);
+ static const SK_OT_ULONG KannadaMask = SkTEndian_SwapBE32(1 << 22);
+ static const SK_OT_ULONG MalayalamMask = SkTEndian_SwapBE32(1 << 23);
+ static const SK_OT_ULONG ThaiMask = SkTEndian_SwapBE32(1 << 24);
+ static const SK_OT_ULONG LaoMask = SkTEndian_SwapBE32(1 << 25);
+ static const SK_OT_ULONG BasicGeorgianMask = SkTEndian_SwapBE32(1 << 26);
+ static const SK_OT_ULONG GeorgianExtendedMask = SkTEndian_SwapBE32(1 << 27);
+ static const SK_OT_ULONG HangulJamoMask = SkTEndian_SwapBE32(1 << 28);
+ static const SK_OT_ULONG LatinExtendedAdditionalMask = SkTEndian_SwapBE32(1 << 29);
+ static const SK_OT_ULONG GreekExtendedMask = SkTEndian_SwapBE32(1 << 30);
+ static const SK_OT_ULONG GeneralPunctuationMask = SkTEndian_SwapBE32(1 << 31);
+ };
+ struct l1 {
+ static const SK_OT_ULONG SuperscriptsAndSubscriptsMask = SkTEndian_SwapBE32(1 << (32 - 32));
+ static const SK_OT_ULONG CurrencySymbolsMask = SkTEndian_SwapBE32(1 << (33 - 32));
+ static const SK_OT_ULONG CombiningDiacriticalMarksForSymbolsMask = SkTEndian_SwapBE32(1 << (34 - 32));
+ static const SK_OT_ULONG LetterlikeSymbolsMask = SkTEndian_SwapBE32(1 << (35 - 32));
+ static const SK_OT_ULONG NumberFormsMask = SkTEndian_SwapBE32(1 << (36 - 32));
+ static const SK_OT_ULONG ArrowsMask = SkTEndian_SwapBE32(1 << (37 - 32));
+ static const SK_OT_ULONG MathematicalOperatorsMask = SkTEndian_SwapBE32(1 << (38 - 32));
+ static const SK_OT_ULONG MiscellaneousTechnicalMask = SkTEndian_SwapBE32(1 << (39 - 32));
+ static const SK_OT_ULONG ControlPicturesMask = SkTEndian_SwapBE32(1 << (40 - 32));
+ static const SK_OT_ULONG OpticalCharacterRecognitionMask = SkTEndian_SwapBE32(1 << (41 - 32));
+ static const SK_OT_ULONG EnclosedAlphanumericsMask = SkTEndian_SwapBE32(1 << (42 - 32));
+ static const SK_OT_ULONG BoxDrawingMask = SkTEndian_SwapBE32(1 << (43 - 32));
+ static const SK_OT_ULONG BlockElementsMask = SkTEndian_SwapBE32(1 << (44 - 32));
+ static const SK_OT_ULONG GeometricShapesMask = SkTEndian_SwapBE32(1 << (45 - 32));
+ static const SK_OT_ULONG MiscellaneousSymbolsMask = SkTEndian_SwapBE32(1 << (46 - 32));
+ static const SK_OT_ULONG DingbatsMask = SkTEndian_SwapBE32(1 << (47 - 32));
+ static const SK_OT_ULONG CJKSymbolsAndPunctuationMask = SkTEndian_SwapBE32(1 << (48 - 32));
+ static const SK_OT_ULONG HiraganaMask = SkTEndian_SwapBE32(1 << (49 - 32));
+ static const SK_OT_ULONG KatakanaMask = SkTEndian_SwapBE32(1 << (50 - 32));
+ static const SK_OT_ULONG BopomofoMask = SkTEndian_SwapBE32(1 << (51 - 32));
+ static const SK_OT_ULONG HangulCompatibilityJamoMask = SkTEndian_SwapBE32(1 << (52 - 32));
+ static const SK_OT_ULONG CJKMiscellaneousMask = SkTEndian_SwapBE32(1 << (53 - 32));
+ static const SK_OT_ULONG EnclosedCJKLettersAndMonthsMask = SkTEndian_SwapBE32(1 << (54 - 32));
+ static const SK_OT_ULONG CJKCompatibilityMask = SkTEndian_SwapBE32(1 << (55 - 32));
+ static const SK_OT_ULONG HangulMask = SkTEndian_SwapBE32(1 << (56 - 32));
+ //Reserved
+ //Reserved
+ static const SK_OT_ULONG CJKUnifiedIdeographsMask = SkTEndian_SwapBE32(1 << (59 - 32));
+ static const SK_OT_ULONG PrivateUseAreaMask = SkTEndian_SwapBE32(1 << (60 - 32));
+ static const SK_OT_ULONG CJKCompatibilityIdeographsMask = SkTEndian_SwapBE32(1 << (61 - 32));
+ static const SK_OT_ULONG AlphabeticPresentationFormsMask = SkTEndian_SwapBE32(1 << (62 - 32));
+ static const SK_OT_ULONG ArabicPresentationFormsAMask = SkTEndian_SwapBE32(1 << (63 - 32));
+ };
+ struct l2 {
+ static const SK_OT_ULONG CombiningHalfMarksMask = SkTEndian_SwapBE32(1 << (64 - 64));
+ static const SK_OT_ULONG CJKCompatibilityFormsMask = SkTEndian_SwapBE32(1 << (65 - 64));
+ static const SK_OT_ULONG SmallFormVariantsMask = SkTEndian_SwapBE32(1 << (66 - 64));
+ static const SK_OT_ULONG ArabicPresentationFormsBMask = SkTEndian_SwapBE32(1 << (67 - 64));
+ static const SK_OT_ULONG HalfwidthAndFullwidthFormsMask = SkTEndian_SwapBE32(1 << (68 - 64));
+ static const SK_OT_ULONG SpecialsMask = SkTEndian_SwapBE32(1 << (69 - 64));
+ };
+ SK_OT_ULONG value[4];
+ } raw;
+ } ulUnicodeRange;
+ SK_OT_CHAR achVendID[4];
+ union Selection {
+ struct Field {
+ //8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved08,
+ Reserved09,
+ Reserved10,
+ Reserved11,
+ Reserved12,
+ Reserved13,
+ Reserved14,
+ Reserved15)
+ //0-7
+ SK_OT_BYTE_BITFIELD(
+ Italic,
+ Underscore,
+ Negative,
+ Outlined,
+ Strikeout,
+ Bold,
+ Regular,
+ Reserved07)
+ } field;
+ struct Raw {
+ static const SK_OT_USHORT ItalicMask = SkTEndian_SwapBE16(1 << 0);
+ static const SK_OT_USHORT UnderscoreMask = SkTEndian_SwapBE16(1 << 1);
+ static const SK_OT_USHORT NegativeMask = SkTEndian_SwapBE16(1 << 2);
+ static const SK_OT_USHORT OutlinedMask = SkTEndian_SwapBE16(1 << 3);
+ static const SK_OT_USHORT StrikeoutMask = SkTEndian_SwapBE16(1 << 4);
+ static const SK_OT_USHORT BoldMask = SkTEndian_SwapBE16(1 << 5);
+ static const SK_OT_USHORT RegularMask = SkTEndian_SwapBE16(1 << 6);
+ SK_OT_USHORT value;
+ } raw;
+ } fsSelection;
+ SK_OT_USHORT usFirstCharIndex;
+ SK_OT_USHORT usLastCharIndex;
+ //version0
+ SK_OT_SHORT sTypoAscender;
+ SK_OT_SHORT sTypoDescender;
+ SK_OT_SHORT sTypoLineGap;
+ SK_OT_USHORT usWinAscent;
+ SK_OT_USHORT usWinDescent;
+ //version1
+ union CodePageRange {
+ struct Field {
+ //l0 24-31
+ SK_OT_BYTE_BITFIELD(
+ Reserved24,
+ Reserved25,
+ Reserved26,
+ Reserved27,
+ Reserved28,
+ MacintoshCharacterSet,
+ OEMCharacterSet,
+ SymbolCharacterSet)
+ //l0 16-23
+ SK_OT_BYTE_BITFIELD(
+ Thai_874,
+ JISJapan_932,
+ ChineseSimplified_936,
+ KoreanWansung_949,
+ ChineseTraditional_950,
+ KoreanJohab_1361,
+ Reserved22,
+ Reserved23)
+ //l0 8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved08,
+ Reserved09,
+ Reserved10,
+ Reserved11,
+ Reserved12,
+ Reserved13,
+ Reserved14,
+ Reserved15)
+ //l0 0-7
+ SK_OT_BYTE_BITFIELD(
+ Latin1_1252,
+ Latin2EasternEurope_1250,
+ Cyrillic_1251,
+ Greek_1253,
+ Turkish_1254,
+ Hebrew_1255,
+ Arabic_1256,
+ WindowsBaltic_1257)
+
+ //l1 24-31
+ SK_OT_BYTE_BITFIELD(
+ IBMTurkish_857,
+ IBMCyrillic_855,
+ Latin2_852,
+ MSDOSBaltic_775,
+ Greek_737,
+ Arabic_708,
+ WELatin1_850,
+ US_437)
+ //l1 16-23
+ SK_OT_BYTE_BITFIELD(
+ IBMGreek_869,
+ MSDOSRussian_866,
+ MSDOSNordic_865,
+ Arabic_864,
+ MSDOSCanadianFrench_863,
+ Hebrew_862,
+ MSDOSIcelandic_861,
+ MSDOSPortuguese_860)
+ //l1 8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved40,
+ Reserved41,
+ Reserved42,
+ Reserved43,
+ Reserved44,
+ Reserved45,
+ Reserved46,
+ Reserved47)
+ //l1 0-7
+ SK_OT_BYTE_BITFIELD(
+ Reserved32,
+ Reserved33,
+ Reserved34,
+ Reserved35,
+ Reserved36,
+ Reserved37,
+ Reserved38,
+ Reserved39)
+ } field;
+ struct Raw {
+ struct l0 {
+ static const SK_OT_ULONG Latin1_1252Mask = SkTEndian_SwapBE32(1 << 0);
+ static const SK_OT_ULONG Latin2EasternEurope_1250Mask = SkTEndian_SwapBE32(1 << 1);
+ static const SK_OT_ULONG Cyrillic_1251Mask = SkTEndian_SwapBE32(1 << 2);
+ static const SK_OT_ULONG Greek_1253Mask = SkTEndian_SwapBE32(1 << 3);
+ static const SK_OT_ULONG Turkish_1254Mask = SkTEndian_SwapBE32(1 << 4);
+ static const SK_OT_ULONG Hebrew_1255Mask = SkTEndian_SwapBE32(1 << 5);
+ static const SK_OT_ULONG Arabic_1256Mask = SkTEndian_SwapBE32(1 << 6);
+ static const SK_OT_ULONG WindowsBaltic_1257Mask = SkTEndian_SwapBE32(1 << 7);
+ static const SK_OT_ULONG Thai_874Mask = SkTEndian_SwapBE32(1 << 16);
+ static const SK_OT_ULONG JISJapan_932Mask = SkTEndian_SwapBE32(1 << 17);
+ static const SK_OT_ULONG ChineseSimplified_936Mask = SkTEndian_SwapBE32(1 << 18);
+ static const SK_OT_ULONG KoreanWansung_949Mask = SkTEndian_SwapBE32(1 << 19);
+ static const SK_OT_ULONG ChineseTraditional_950Mask = SkTEndian_SwapBE32(1 << 20);
+ static const SK_OT_ULONG KoreanJohab_1361Mask = SkTEndian_SwapBE32(1 << 21);
+ static const SK_OT_ULONG MacintoshCharacterSetMask = SkTEndian_SwapBE32(1 << 29);
+ static const SK_OT_ULONG OEMCharacterSetMask = SkTEndian_SwapBE32(1 << 30);
+ static const SK_OT_ULONG SymbolCharacterSetMask = SkTEndian_SwapBE32(1 << 31);
+ };
+ struct l1 {
+ static const SK_OT_ULONG IBMGreek_869Mask = SkTEndian_SwapBE32(1 << (48 - 32));
+ static const SK_OT_ULONG MSDOSRussian_866Mask = SkTEndian_SwapBE32(1 << (49 - 32));
+ static const SK_OT_ULONG MSDOSNordic_865Mask = SkTEndian_SwapBE32(1 << (50 - 32));
+ static const SK_OT_ULONG Arabic_864Mask = SkTEndian_SwapBE32(1 << (51 - 32));
+ static const SK_OT_ULONG MSDOSCanadianFrench_863Mask = SkTEndian_SwapBE32(1 << (52 - 32));
+ static const SK_OT_ULONG Hebrew_862Mask = SkTEndian_SwapBE32(1 << (53 - 32));
+ static const SK_OT_ULONG MSDOSIcelandic_861Mask = SkTEndian_SwapBE32(1 << (54 - 32));
+ static const SK_OT_ULONG MSDOSPortuguese_860Mask = SkTEndian_SwapBE32(1 << (55 - 32));
+ static const SK_OT_ULONG IBMTurkish_857Mask = SkTEndian_SwapBE32(1 << (56 - 32));
+ static const SK_OT_ULONG IBMCyrillic_855Mask = SkTEndian_SwapBE32(1 << (57 - 32));
+ static const SK_OT_ULONG Latin2_852Mask = SkTEndian_SwapBE32(1 << (58 - 32));
+ static const SK_OT_ULONG MSDOSBaltic_775Mask = SkTEndian_SwapBE32(1 << (59 - 32));
+ static const SK_OT_ULONG Greek_737Mask = SkTEndian_SwapBE32(1 << (60 - 32));
+ static const SK_OT_ULONG Arabic_708Mask = SkTEndian_SwapBE32(1 << (61 - 32));
+ static const SK_OT_ULONG WELatin1_850Mask = SkTEndian_SwapBE32(1 << (62 - 32));
+ static const SK_OT_ULONG US_437Mask = SkTEndian_SwapBE32(1 << (63 - 32));
+ };
+ SK_OT_ULONG value[2];
+ } raw;
+ } ulCodePageRange;
+};
+
+#pragma pack(pop)
+
+
+SK_COMPILE_ASSERT(sizeof(SkOTTableOS2_V1) == 86, sizeof_SkOTTableOS2_V1_not_86);
+
+#endif
diff --git a/src/sfnt/SkOTTable_OS_2_V2.h b/src/sfnt/SkOTTable_OS_2_V2.h
new file mode 100644
index 0000000000..ee1a2ddc95
--- /dev/null
+++ b/src/sfnt/SkOTTable_OS_2_V2.h
@@ -0,0 +1,539 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkOTTable_OS_2_V2_DEFINED
+#define SkOTTable_OS_2_V2_DEFINED
+
+#include "SkEndian.h"
+#include "SkIBMFamilyClass.h"
+#include "SkOTTableTypes.h"
+#include "SkPanose.h"
+#include "SkTypedEnum.h"
+
+#pragma pack(push, 1)
+
+struct SkOTTableOS2_V2 {
+ SK_OT_USHORT version;
+ static const SK_OT_USHORT version2 = SkTEndian_SwapBE16(2);
+ SK_OT_SHORT xAvgCharWidth;
+ struct WeightClass {
+ SK_TYPED_ENUM(Value, SK_OT_USHORT,
+ ((Thin, SkTEndian_SwapBE16(100)))
+ ((ExtraLight, SkTEndian_SwapBE16(200)))
+ ((Light, SkTEndian_SwapBE16(300)))
+ ((Normal, SkTEndian_SwapBE16(400)))
+ ((Medium, SkTEndian_SwapBE16(500)))
+ ((SemiBold, SkTEndian_SwapBE16(600)))
+ ((Bold, SkTEndian_SwapBE16(700)))
+ ((ExtraBold, SkTEndian_SwapBE16(800)))
+ ((Black, SkTEndian_SwapBE16(900)))
+ SK_SEQ_END,
+ SK_SEQ_END)
+ SK_OT_USHORT value;
+ } usWeightClass;
+ struct WidthClass {
+ SK_TYPED_ENUM(Value, SK_OT_USHORT,
+ ((UltraCondensed, SkTEndian_SwapBE16(1)))
+ ((ExtraCondensed, SkTEndian_SwapBE16(2)))
+ ((Condensed, SkTEndian_SwapBE16(3)))
+ ((SemiCondensed, SkTEndian_SwapBE16(4)))
+ ((Medium, SkTEndian_SwapBE16(5)))
+ ((SemiExpanded, SkTEndian_SwapBE16(6)))
+ ((Expanded, SkTEndian_SwapBE16(7)))
+ ((ExtraExpanded, SkTEndian_SwapBE16(8)))
+ ((UltraExpanded, SkTEndian_SwapBE16(9))),
+ (value)SK_SEQ_END)
+ } usWidthClass;
+ union Type {
+ struct Field {
+ //8-15
+ SK_OT_BYTE_BITFIELD(
+ NoSubsetting,
+ Bitmap,
+ Reserved10,
+ Reserved11,
+ Reserved12,
+ Reserved13,
+ Reserved14,
+ Reserved15)
+ //0-7
+ SK_OT_BYTE_BITFIELD(
+ Reserved00,
+ Restricted,
+ PreviewPrint,
+ Editable,
+ Reserved04,
+ Reserved05,
+ Reserved06,
+ Reserved07)
+ } field;
+ struct Raw {
+ static const SK_OT_USHORT Installable = SkTEndian_SwapBE16(0);
+ static const SK_OT_USHORT RestrictedMask = SkTEndian_SwapBE16(1 << 1);
+ static const SK_OT_USHORT PreviewPrintMask = SkTEndian_SwapBE16(1 << 2);
+ static const SK_OT_USHORT EditableMask = SkTEndian_SwapBE16(1 << 3);
+ static const SK_OT_USHORT NoSubsettingMask = SkTEndian_SwapBE16(1 << 8);
+ static const SK_OT_USHORT BitmapMask = SkTEndian_SwapBE16(1 << 9);
+ SK_OT_USHORT value;
+ } raw;
+ } fsType;
+ SK_OT_SHORT ySubscriptXSize;
+ SK_OT_SHORT ySubscriptYSize;
+ SK_OT_SHORT ySubscriptXOffset;
+ SK_OT_SHORT ySubscriptYOffset;
+ SK_OT_SHORT ySuperscriptXSize;
+ SK_OT_SHORT ySuperscriptYSize;
+ SK_OT_SHORT ySuperscriptXOffset;
+ SK_OT_SHORT ySuperscriptYOffset;
+ SK_OT_SHORT yStrikeoutSize;
+ SK_OT_SHORT yStrikeoutPosition;
+ SkIBMFamilyClass sFamilyClass;
+ SkPanose panose;
+ union UnicodeRange {
+ struct Field {
+ //l0 24-31
+ SK_OT_BYTE_BITFIELD(
+ Thai,
+ Lao,
+ Georgian,
+ Reserved027,
+ HangulJamo,
+ LatinExtendedAdditional,
+ GreekExtended,
+ GeneralPunctuation)
+ //l0 16-23
+ SK_OT_BYTE_BITFIELD(
+ Bengali,
+ Gurmukhi,
+ Gujarati,
+ Oriya,
+ Tamil,
+ Telugu,
+ Kannada,
+ Malayalam)
+ //l0 8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved008,
+ Cyrillic,
+ Armenian,
+ Hebrew,
+ Reserved012,
+ Arabic,
+ Reserved014,
+ Devanagari)
+ //l0 0-7
+ SK_OT_BYTE_BITFIELD(
+ BasicLatin,
+ Latin1Supplement,
+ LatinExtendedA,
+ LatinExtendedB,
+ IPAExtensions,
+ SpacingModifierLetters,
+ CombiningDiacriticalMarks,
+ Greek)
+
+ //l1 24-31
+ SK_OT_BYTE_BITFIELD(
+ Hangul,
+ Surrogates,
+ Reserved058,
+ CJKUnifiedIdeographs,
+ PrivateUseArea,
+ CJKCompatibilityIdeographs,
+ AlphabeticPresentationForms,
+ ArabicPresentationFormsA)
+ //l1 16-23
+ SK_OT_BYTE_BITFIELD(
+ CJKSymbolsAndPunctuation,
+ Hiragana,
+ Katakana,
+ Bopomofo,
+ HangulCompatibilityJamo,
+ CJKMiscellaneous,
+ EnclosedCJKLettersAndMonths,
+ CJKCompatibility)
+ //l1 8-15
+ SK_OT_BYTE_BITFIELD(
+ ControlPictures,
+ OpticalCharacterRecognition,
+ EnclosedAlphanumerics,
+ BoxDrawing,
+ BlockElements,
+ GeometricShapes,
+ MiscellaneousSymbols,
+ Dingbats)
+ //l1 0-7
+ SK_OT_BYTE_BITFIELD(
+ SuperscriptsAndSubscripts,
+ CurrencySymbols,
+ CombiningDiacriticalMarksForSymbols,
+ LetterlikeSymbols,
+ NumberForms,
+ Arrows,
+ MathematicalOperators,
+ MiscellaneousTechnical)
+
+ //l2 24-31
+ SK_OT_BYTE_BITFIELD(
+ Reserved088,
+ Reserved089,
+ Reserved090,
+ Reserved091,
+ Reserved092,
+ Reserved093,
+ Reserved094,
+ Reserved095)
+ //l2 16-23
+ SK_OT_BYTE_BITFIELD(
+ Khmer,
+ Mongolian,
+ Braille,
+ Yi,
+ Reserved084,
+ Reserved085,
+ Reserved086,
+ Reserved087)
+ //l2 8-15
+ SK_OT_BYTE_BITFIELD(
+ Thaana,
+ Sinhala,
+ Myanmar,
+ Ethiopic,
+ Cherokee,
+ UnifiedCanadianSyllabics,
+ Ogham,
+ Runic)
+ //l2 0-7
+ SK_OT_BYTE_BITFIELD(
+ CombiningHalfMarks,
+ CJKCompatibilityForms,
+ SmallFormVariants,
+ ArabicPresentationFormsB,
+ HalfwidthAndFullwidthForms,
+ Specials,
+ Tibetan,
+ Syriac)
+
+ //l3 24-31
+ SK_OT_BYTE_BITFIELD(
+ Reserved120,
+ Reserved121,
+ Reserved122,
+ Reserved123,
+ Reserved124,
+ Reserved125,
+ Reserved126,
+ Reserved127)
+ //l3 16-23
+ SK_OT_BYTE_BITFIELD(
+ Reserved112,
+ Reserved113,
+ Reserved114,
+ Reserved115,
+ Reserved116,
+ Reserved117,
+ Reserved118,
+ Reserved119)
+ //l3 8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved104,
+ Reserved105,
+ Reserved106,
+ Reserved107,
+ Reserved108,
+ Reserved109,
+ Reserved110,
+ Reserved111)
+ //l3 0-7
+ SK_OT_BYTE_BITFIELD(
+ Reserved096,
+ Reserved097,
+ Reserved098,
+ Reserved099,
+ Reserved100,
+ Reserved101,
+ Reserved102,
+ Reserved103)
+ } field;
+ struct Raw {
+ struct l0 {
+ static const SK_OT_ULONG BasicLatinMask = SkTEndian_SwapBE32(1 << 0);
+ static const SK_OT_ULONG Latin1SupplementMask = SkTEndian_SwapBE32(1 << 1);
+ static const SK_OT_ULONG LatinExtendedAMask = SkTEndian_SwapBE32(1 << 2);
+ static const SK_OT_ULONG LatinExtendedBMask = SkTEndian_SwapBE32(1 << 3);
+ static const SK_OT_ULONG IPAExtensionsMask = SkTEndian_SwapBE32(1 << 4);
+ static const SK_OT_ULONG SpacingModifierLettersMask = SkTEndian_SwapBE32(1 << 5);
+ static const SK_OT_ULONG CombiningDiacriticalMarksMask = SkTEndian_SwapBE32(1 << 6);
+ static const SK_OT_ULONG GreekMask = SkTEndian_SwapBE32(1 << 7);
+ //Reserved
+ static const SK_OT_ULONG CyrillicMask = SkTEndian_SwapBE32(1 << 9);
+ static const SK_OT_ULONG ArmenianMask = SkTEndian_SwapBE32(1 << 10);
+ static const SK_OT_ULONG HebrewMask = SkTEndian_SwapBE32(1 << 11);
+ //Reserved
+ static const SK_OT_ULONG ArabicMask = SkTEndian_SwapBE32(1 << 13);
+ //Reserved
+ static const SK_OT_ULONG DevanagariMask = SkTEndian_SwapBE32(1 << 15);
+ static const SK_OT_ULONG BengaliMask = SkTEndian_SwapBE32(1 << 16);
+ static const SK_OT_ULONG GurmukhiMask = SkTEndian_SwapBE32(1 << 17);
+ static const SK_OT_ULONG GujaratiMask = SkTEndian_SwapBE32(1 << 18);
+ static const SK_OT_ULONG OriyaMask = SkTEndian_SwapBE32(1 << 19);
+ static const SK_OT_ULONG TamilMask = SkTEndian_SwapBE32(1 << 20);
+ static const SK_OT_ULONG TeluguMask = SkTEndian_SwapBE32(1 << 21);
+ static const SK_OT_ULONG KannadaMask = SkTEndian_SwapBE32(1 << 22);
+ static const SK_OT_ULONG MalayalamMask = SkTEndian_SwapBE32(1 << 23);
+ static const SK_OT_ULONG ThaiMask = SkTEndian_SwapBE32(1 << 24);
+ static const SK_OT_ULONG LaoMask = SkTEndian_SwapBE32(1 << 25);
+ static const SK_OT_ULONG GeorgianMask = SkTEndian_SwapBE32(1 << 26);
+ //Reserved
+ static const SK_OT_ULONG HangulJamoMask = SkTEndian_SwapBE32(1 << 28);
+ static const SK_OT_ULONG LatinExtendedAdditionalMask = SkTEndian_SwapBE32(1 << 29);
+ static const SK_OT_ULONG GreekExtendedMask = SkTEndian_SwapBE32(1 << 30);
+ static const SK_OT_ULONG GeneralPunctuationMask = SkTEndian_SwapBE32(1 << 31);
+ };
+ struct l1 {
+ static const SK_OT_ULONG SuperscriptsAndSubscriptsMask = SkTEndian_SwapBE32(1 << (32 - 32));
+ static const SK_OT_ULONG CurrencySymbolsMask = SkTEndian_SwapBE32(1 << (33 - 32));
+ static const SK_OT_ULONG CombiningDiacriticalMarksForSymbolsMask = SkTEndian_SwapBE32(1 << (34 - 32));
+ static const SK_OT_ULONG LetterlikeSymbolsMask = SkTEndian_SwapBE32(1 << (35 - 32));
+ static const SK_OT_ULONG NumberFormsMask = SkTEndian_SwapBE32(1 << (36 - 32));
+ static const SK_OT_ULONG ArrowsMask = SkTEndian_SwapBE32(1 << (37 - 32));
+ static const SK_OT_ULONG MathematicalOperatorsMask = SkTEndian_SwapBE32(1 << (38 - 32));
+ static const SK_OT_ULONG MiscellaneousTechnicalMask = SkTEndian_SwapBE32(1 << (39 - 32));
+ static const SK_OT_ULONG ControlPicturesMask = SkTEndian_SwapBE32(1 << (40 - 32));
+ static const SK_OT_ULONG OpticalCharacterRecognitionMask = SkTEndian_SwapBE32(1 << (41 - 32));
+ static const SK_OT_ULONG EnclosedAlphanumericsMask = SkTEndian_SwapBE32(1 << (42 - 32));
+ static const SK_OT_ULONG BoxDrawingMask = SkTEndian_SwapBE32(1 << (43 - 32));
+ static const SK_OT_ULONG BlockElementsMask = SkTEndian_SwapBE32(1 << (44 - 32));
+ static const SK_OT_ULONG GeometricShapesMask = SkTEndian_SwapBE32(1 << (45 - 32));
+ static const SK_OT_ULONG MiscellaneousSymbolsMask = SkTEndian_SwapBE32(1 << (46 - 32));
+ static const SK_OT_ULONG DingbatsMask = SkTEndian_SwapBE32(1 << (47 - 32));
+ static const SK_OT_ULONG CJKSymbolsAndPunctuationMask = SkTEndian_SwapBE32(1 << (48 - 32));
+ static const SK_OT_ULONG HiraganaMask = SkTEndian_SwapBE32(1 << (49 - 32));
+ static const SK_OT_ULONG KatakanaMask = SkTEndian_SwapBE32(1 << (50 - 32));
+ static const SK_OT_ULONG BopomofoMask = SkTEndian_SwapBE32(1 << (51 - 32));
+ static const SK_OT_ULONG HangulCompatibilityJamoMask = SkTEndian_SwapBE32(1 << (52 - 32));
+ static const SK_OT_ULONG CJKMiscellaneousMask = SkTEndian_SwapBE32(1 << (53 - 32));
+ static const SK_OT_ULONG EnclosedCJKLettersAndMonthsMask = SkTEndian_SwapBE32(1 << (54 - 32));
+ static const SK_OT_ULONG CJKCompatibilityMask = SkTEndian_SwapBE32(1 << (55 - 32));
+ static const SK_OT_ULONG HangulMask = SkTEndian_SwapBE32(1 << (56 - 32));
+ static const SK_OT_ULONG SurrogatesMask = SkTEndian_SwapBE32(1 << (57 - 32));
+ //Reserved
+ static const SK_OT_ULONG CJKUnifiedIdeographsMask = SkTEndian_SwapBE32(1 << (59 - 32));
+ static const SK_OT_ULONG PrivateUseAreaMask = SkTEndian_SwapBE32(1 << (60 - 32));
+ static const SK_OT_ULONG CJKCompatibilityIdeographsMask = SkTEndian_SwapBE32(1 << (61 - 32));
+ static const SK_OT_ULONG AlphabeticPresentationFormsMask = SkTEndian_SwapBE32(1 << (62 - 32));
+ static const SK_OT_ULONG ArabicPresentationFormsAMask = SkTEndian_SwapBE32(1 << (63 - 32));
+ };
+ struct l2 {
+ static const SK_OT_ULONG CombiningHalfMarksMask = SkTEndian_SwapBE32(1 << (64 - 64));
+ static const SK_OT_ULONG CJKCompatibilityFormsMask = SkTEndian_SwapBE32(1 << (65 - 64));
+ static const SK_OT_ULONG SmallFormVariantsMask = SkTEndian_SwapBE32(1 << (66 - 64));
+ static const SK_OT_ULONG ArabicPresentationFormsBMask = SkTEndian_SwapBE32(1 << (67 - 64));
+ static const SK_OT_ULONG HalfwidthAndFullwidthFormsMask = SkTEndian_SwapBE32(1 << (68 - 64));
+ static const SK_OT_ULONG SpecialsMask = SkTEndian_SwapBE32(1 << (69 - 64));
+ static const SK_OT_ULONG TibetanMask = SkTEndian_SwapBE32(1 << (70 - 64));
+ static const SK_OT_ULONG SyriacMask = SkTEndian_SwapBE32(1 << (71 - 64));
+ static const SK_OT_ULONG ThaanaMask = SkTEndian_SwapBE32(1 << (72 - 64));
+ static const SK_OT_ULONG SinhalaMask = SkTEndian_SwapBE32(1 << (73 - 64));
+ static const SK_OT_ULONG MyanmarMask = SkTEndian_SwapBE32(1 << (74 - 64));
+ static const SK_OT_ULONG EthiopicMask = SkTEndian_SwapBE32(1 << (75 - 64));
+ static const SK_OT_ULONG CherokeeMask = SkTEndian_SwapBE32(1 << (76 - 64));
+ static const SK_OT_ULONG UnifiedCanadianSyllabicsMask = SkTEndian_SwapBE32(1 << (77 - 64));
+ static const SK_OT_ULONG OghamMask = SkTEndian_SwapBE32(1 << (78 - 64));
+ static const SK_OT_ULONG RunicMask = SkTEndian_SwapBE32(1 << (79 - 64));
+ static const SK_OT_ULONG KhmerMask = SkTEndian_SwapBE32(1 << (80 - 64));
+ static const SK_OT_ULONG MongolianMask = SkTEndian_SwapBE32(1 << (81 - 64));
+ static const SK_OT_ULONG BrailleMask = SkTEndian_SwapBE32(1 << (82 - 64));
+ static const SK_OT_ULONG YiMask = SkTEndian_SwapBE32(1 << (83 - 64));
+ };
+ SK_OT_ULONG value[4];
+ } raw;
+ } ulUnicodeRange;
+ SK_OT_CHAR achVendID[4];
+ union Selection {
+ struct Field {
+ //8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved08,
+ Reserved09,
+ Reserved10,
+ Reserved11,
+ Reserved12,
+ Reserved13,
+ Reserved14,
+ Reserved15)
+ //0-7
+ SK_OT_BYTE_BITFIELD(
+ Italic,
+ Underscore,
+ Negative,
+ Outlined,
+ Strikeout,
+ Bold,
+ Regular,
+ Reserved07)
+ } field;
+ struct Raw {
+ static const SK_OT_USHORT ItalicMask = SkTEndian_SwapBE16(1 << 0);
+ static const SK_OT_USHORT UnderscoreMask = SkTEndian_SwapBE16(1 << 1);
+ static const SK_OT_USHORT NegativeMask = SkTEndian_SwapBE16(1 << 2);
+ static const SK_OT_USHORT OutlinedMask = SkTEndian_SwapBE16(1 << 3);
+ static const SK_OT_USHORT StrikeoutMask = SkTEndian_SwapBE16(1 << 4);
+ static const SK_OT_USHORT BoldMask = SkTEndian_SwapBE16(1 << 5);
+ static const SK_OT_USHORT RegularMask = SkTEndian_SwapBE16(1 << 6);
+ SK_OT_USHORT value;
+ } raw;
+ } fsSelection;
+ SK_OT_USHORT usFirstCharIndex;
+ SK_OT_USHORT usLastCharIndex;
+ //version0
+ SK_OT_SHORT sTypoAscender;
+ SK_OT_SHORT sTypoDescender;
+ SK_OT_SHORT sTypoLineGap;
+ SK_OT_USHORT usWinAscent;
+ SK_OT_USHORT usWinDescent;
+ //version1
+ union CodePageRange {
+ struct Field {
+ //l0 24-31
+ SK_OT_BYTE_BITFIELD(
+ Reserved24,
+ Reserved25,
+ Reserved26,
+ Reserved27,
+ Reserved28,
+ MacintoshCharacterSet,
+ OEMCharacterSet,
+ SymbolCharacterSet)
+ //l0 16-23
+ SK_OT_BYTE_BITFIELD(
+ Thai_874,
+ JISJapan_932,
+ ChineseSimplified_936,
+ KoreanWansung_949,
+ ChineseTraditional_950,
+ KoreanJohab_1361,
+ Reserved22,
+ Reserved23)
+ //l0 8-15
+ SK_OT_BYTE_BITFIELD(
+ Vietnamese,
+ Reserved09,
+ Reserved10,
+ Reserved11,
+ Reserved12,
+ Reserved13,
+ Reserved14,
+ Reserved15)
+ //l0 0-7
+ SK_OT_BYTE_BITFIELD(
+ Latin1_1252,
+ Latin2EasternEurope_1250,
+ Cyrillic_1251,
+ Greek_1253,
+ Turkish_1254,
+ Hebrew_1255,
+ Arabic_1256,
+ WindowsBaltic_1257)
+
+ //l1 24-31
+ SK_OT_BYTE_BITFIELD(
+ IBMTurkish_857,
+ IBMCyrillic_855,
+ Latin2_852,
+ MSDOSBaltic_775,
+ Greek_737,
+ Arabic_708,
+ WELatin1_850,
+ US_437)
+ //l1 16-23
+ SK_OT_BYTE_BITFIELD(
+ IBMGreek_869,
+ MSDOSRussian_866,
+ MSDOSNordic_865,
+ Arabic_864,
+ MSDOSCanadianFrench_863,
+ Hebrew_862,
+ MSDOSIcelandic_861,
+ MSDOSPortuguese_860)
+ //l1 8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved40,
+ Reserved41,
+ Reserved42,
+ Reserved43,
+ Reserved44,
+ Reserved45,
+ Reserved46,
+ Reserved47)
+ //l1 0-7
+ SK_OT_BYTE_BITFIELD(
+ Reserved32,
+ Reserved33,
+ Reserved34,
+ Reserved35,
+ Reserved36,
+ Reserved37,
+ Reserved38,
+ Reserved39)
+ } field;
+ struct Raw {
+ struct l0 {
+ static const SK_OT_ULONG Latin1_1252Mask = SkTEndian_SwapBE32(1 << 0);
+ static const SK_OT_ULONG Latin2EasternEurope_1250Mask = SkTEndian_SwapBE32(1 << 1);
+ static const SK_OT_ULONG Cyrillic_1251Mask = SkTEndian_SwapBE32(1 << 2);
+ static const SK_OT_ULONG Greek_1253Mask = SkTEndian_SwapBE32(1 << 3);
+ static const SK_OT_ULONG Turkish_1254Mask = SkTEndian_SwapBE32(1 << 4);
+ static const SK_OT_ULONG Hebrew_1255Mask = SkTEndian_SwapBE32(1 << 5);
+ static const SK_OT_ULONG Arabic_1256Mask = SkTEndian_SwapBE32(1 << 6);
+ static const SK_OT_ULONG WindowsBaltic_1257Mask = SkTEndian_SwapBE32(1 << 7);
+ static const SK_OT_ULONG Vietnamese_1258Mask = SkTEndian_SwapBE32(1 << 8);
+ static const SK_OT_ULONG Thai_874Mask = SkTEndian_SwapBE32(1 << 16);
+ static const SK_OT_ULONG JISJapan_932Mask = SkTEndian_SwapBE32(1 << 17);
+ static const SK_OT_ULONG ChineseSimplified_936Mask = SkTEndian_SwapBE32(1 << 18);
+ static const SK_OT_ULONG KoreanWansung_949Mask = SkTEndian_SwapBE32(1 << 19);
+ static const SK_OT_ULONG ChineseTraditional_950Mask = SkTEndian_SwapBE32(1 << 20);
+ static const SK_OT_ULONG KoreanJohab_1361Mask = SkTEndian_SwapBE32(1 << 21);
+ static const SK_OT_ULONG MacintoshCharacterSetMask = SkTEndian_SwapBE32(1 << 29);
+ static const SK_OT_ULONG OEMCharacterSetMask = SkTEndian_SwapBE32(1 << 30);
+ static const SK_OT_ULONG SymbolCharacterSetMask = SkTEndian_SwapBE32(1 << 31);
+ };
+ struct l1 {
+ static const SK_OT_ULONG IBMGreek_869Mask = SkTEndian_SwapBE32(1 << (48 - 32));
+ static const SK_OT_ULONG MSDOSRussian_866Mask = SkTEndian_SwapBE32(1 << (49 - 32));
+ static const SK_OT_ULONG MSDOSNordic_865Mask = SkTEndian_SwapBE32(1 << (50 - 32));
+ static const SK_OT_ULONG Arabic_864Mask = SkTEndian_SwapBE32(1 << (51 - 32));
+ static const SK_OT_ULONG MSDOSCanadianFrench_863Mask = SkTEndian_SwapBE32(1 << (52 - 32));
+ static const SK_OT_ULONG Hebrew_862Mask = SkTEndian_SwapBE32(1 << (53 - 32));
+ static const SK_OT_ULONG MSDOSIcelandic_861Mask = SkTEndian_SwapBE32(1 << (54 - 32));
+ static const SK_OT_ULONG MSDOSPortuguese_860Mask = SkTEndian_SwapBE32(1 << (55 - 32));
+ static const SK_OT_ULONG IBMTurkish_857Mask = SkTEndian_SwapBE32(1 << (56 - 32));
+ static const SK_OT_ULONG IBMCyrillic_855Mask = SkTEndian_SwapBE32(1 << (57 - 32));
+ static const SK_OT_ULONG Latin2_852Mask = SkTEndian_SwapBE32(1 << (58 - 32));
+ static const SK_OT_ULONG MSDOSBaltic_775Mask = SkTEndian_SwapBE32(1 << (59 - 32));
+ static const SK_OT_ULONG Greek_737Mask = SkTEndian_SwapBE32(1 << (60 - 32));
+ static const SK_OT_ULONG Arabic_708Mask = SkTEndian_SwapBE32(1 << (61 - 32));
+ static const SK_OT_ULONG WELatin1_850Mask = SkTEndian_SwapBE32(1 << (62 - 32));
+ static const SK_OT_ULONG US_437Mask = SkTEndian_SwapBE32(1 << (63 - 32));
+ };
+ SK_OT_ULONG value[2];
+ } raw;
+ } ulCodePageRange;
+ //version2
+ SK_OT_SHORT sxHeight;
+ SK_OT_SHORT sCapHeight;
+ SK_OT_USHORT usDefaultChar;
+ SK_OT_USHORT usBreakChar;
+ SK_OT_USHORT usMaxContext;
+};
+
+#pragma pack(pop)
+
+
+SK_COMPILE_ASSERT(sizeof(SkOTTableOS2_V2) == 96, sizeof_SkOTTableOS2_V2_not_96);
+
+#endif
diff --git a/src/sfnt/SkOTTable_OS_2_V3.h b/src/sfnt/SkOTTable_OS_2_V3.h
new file mode 100644
index 0000000000..ffd6d6a579
--- /dev/null
+++ b/src/sfnt/SkOTTable_OS_2_V3.h
@@ -0,0 +1,549 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkOTTable_OS_2_V3_DEFINED
+#define SkOTTable_OS_2_V3_DEFINED
+
+#include "SkEndian.h"
+#include "SkIBMFamilyClass.h"
+#include "SkOTTableTypes.h"
+#include "SkPanose.h"
+#include "SkTypedEnum.h"
+
+#pragma pack(push, 1)
+
+struct SkOTTableOS2_V3 {
+ SK_OT_USHORT version;
+ static const SK_OT_USHORT version3 = SkTEndian_SwapBE16(3);
+ SK_OT_SHORT xAvgCharWidth;
+ struct WeightClass {
+ SK_TYPED_ENUM(Value, SK_OT_USHORT,
+ ((Thin, SkTEndian_SwapBE16(100)))
+ ((ExtraLight, SkTEndian_SwapBE16(200)))
+ ((Light, SkTEndian_SwapBE16(300)))
+ ((Normal, SkTEndian_SwapBE16(400)))
+ ((Medium, SkTEndian_SwapBE16(500)))
+ ((SemiBold, SkTEndian_SwapBE16(600)))
+ ((Bold, SkTEndian_SwapBE16(700)))
+ ((ExtraBold, SkTEndian_SwapBE16(800)))
+ ((Black, SkTEndian_SwapBE16(900)))
+ SK_SEQ_END,
+ SK_SEQ_END)
+ SK_OT_USHORT value;
+ } usWeightClass;
+ struct WidthClass {
+ SK_TYPED_ENUM(Value, SK_OT_USHORT,
+ ((UltraCondensed, SkTEndian_SwapBE16(1)))
+ ((ExtraCondensed, SkTEndian_SwapBE16(2)))
+ ((Condensed, SkTEndian_SwapBE16(3)))
+ ((SemiCondensed, SkTEndian_SwapBE16(4)))
+ ((Medium, SkTEndian_SwapBE16(5)))
+ ((SemiExpanded, SkTEndian_SwapBE16(6)))
+ ((Expanded, SkTEndian_SwapBE16(7)))
+ ((ExtraExpanded, SkTEndian_SwapBE16(8)))
+ ((UltraExpanded, SkTEndian_SwapBE16(9)))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } usWidthClass;
+ union Type {
+ struct Field {
+ //8-15
+ SK_OT_BYTE_BITFIELD(
+ NoSubsetting,
+ Bitmap,
+ Reserved10,
+ Reserved11,
+ Reserved12,
+ Reserved13,
+ Reserved14,
+ Reserved15)
+ //0-7
+ SK_OT_BYTE_BITFIELD(
+ Reserved00,
+ Restricted,
+ PreviewPrint,
+ Editable,
+ Reserved04,
+ Reserved05,
+ Reserved06,
+ Reserved07)
+ } field;
+ struct Raw {
+ static const SK_OT_USHORT Installable = SkTEndian_SwapBE16(0);
+ static const SK_OT_USHORT RestrictedMask = SkTEndian_SwapBE16(1 << 1);
+ static const SK_OT_USHORT PreviewPrintMask = SkTEndian_SwapBE16(1 << 2);
+ static const SK_OT_USHORT EditableMask = SkTEndian_SwapBE16(1 << 3);
+ static const SK_OT_USHORT NoSubsettingMask = SkTEndian_SwapBE16(1 << 8);
+ static const SK_OT_USHORT BitmapMask = SkTEndian_SwapBE16(1 << 9);
+ SK_OT_USHORT value;
+ } raw;
+ } fsType;
+ SK_OT_SHORT ySubscriptXSize;
+ SK_OT_SHORT ySubscriptYSize;
+ SK_OT_SHORT ySubscriptXOffset;
+ SK_OT_SHORT ySubscriptYOffset;
+ SK_OT_SHORT ySuperscriptXSize;
+ SK_OT_SHORT ySuperscriptYSize;
+ SK_OT_SHORT ySuperscriptXOffset;
+ SK_OT_SHORT ySuperscriptYOffset;
+ SK_OT_SHORT yStrikeoutSize;
+ SK_OT_SHORT yStrikeoutPosition;
+ SkIBMFamilyClass sFamilyClass;
+ SkPanose panose;
+ union UnicodeRange {
+ struct Field {
+ //l0 24-31
+ SK_OT_BYTE_BITFIELD(
+ Thai,
+ Lao,
+ Georgian,
+ Reserved027,
+ HangulJamo,
+ LatinExtendedAdditional,
+ GreekExtended,
+ GeneralPunctuation)
+ //l0 16-23
+ SK_OT_BYTE_BITFIELD(
+ Bengali,
+ Gurmukhi,
+ Gujarati,
+ Oriya,
+ Tamil,
+ Telugu,
+ Kannada,
+ Malayalam)
+ //l0 8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved008,
+ Cyrillic,
+ Armenian,
+ Hebrew,
+ Reserved012,
+ Arabic,
+ Reserved014,
+ Devanagari)
+ //l0 0-7
+ SK_OT_BYTE_BITFIELD(
+ BasicLatin,
+ Latin1Supplement,
+ LatinExtendedA,
+ LatinExtendedB,
+ IPAExtensions,
+ SpacingModifierLetters,
+ CombiningDiacriticalMarks,
+ GreekAndCoptic)
+
+ //l1 24-31
+ SK_OT_BYTE_BITFIELD(
+ Hangul,
+ NonPlane0,
+ Reserved058,
+ CJKUnifiedIdeographs,
+ PrivateUseArea,
+ CJKCompatibilityIdeographs,
+ AlphabeticPresentationForms,
+ ArabicPresentationFormsA)
+ //l1 16-23
+ SK_OT_BYTE_BITFIELD(
+ CJKSymbolsAndPunctuation,
+ Hiragana,
+ Katakana,
+ Bopomofo,
+ HangulCompatibilityJamo,
+ Reserved053,
+ EnclosedCJKLettersAndMonths,
+ CJKCompatibility)
+ //l1 8-15
+ SK_OT_BYTE_BITFIELD(
+ ControlPictures,
+ OpticalCharacterRecognition,
+ EnclosedAlphanumerics,
+ BoxDrawing,
+ BlockElements,
+ GeometricShapes,
+ MiscellaneousSymbols,
+ Dingbats)
+ //l1 0-7
+ SK_OT_BYTE_BITFIELD(
+ SuperscriptsAndSubscripts,
+ CurrencySymbols,
+ CombiningDiacriticalMarksForSymbols,
+ LetterlikeSymbols,
+ NumberForms,
+ Arrows,
+ MathematicalOperators,
+ MiscellaneousTechnical)
+
+ //l2 24-31
+ SK_OT_BYTE_BITFIELD(
+ MusicalSymbols,
+ MathematicalAlphanumericSymbols,
+ PrivateUse,
+ VariationSelectors,
+ Tags,
+ Reserved093,
+ Reserved094,
+ Reserved095)
+ //l2 16-23
+ SK_OT_BYTE_BITFIELD(
+ Khmer,
+ Mongolian,
+ Braille,
+ Yi,
+ Tagalog_Hanunoo_Buhid_Tagbanwa,
+ OldItalic,
+ Gothic,
+ Deseret)
+ //l2 8-15
+ SK_OT_BYTE_BITFIELD(
+ Thaana,
+ Sinhala,
+ Myanmar,
+ Ethiopic,
+ Cherokee,
+ UnifiedCanadianSyllabics,
+ Ogham,
+ Runic)
+ //l2 0-7
+ SK_OT_BYTE_BITFIELD(
+ CombiningHalfMarks,
+ CJKCompatibilityForms,
+ SmallFormVariants,
+ ArabicPresentationFormsB,
+ HalfwidthAndFullwidthForms,
+ Specials,
+ Tibetan,
+ Syriac)
+
+ //l3 24-31
+ SK_OT_BYTE_BITFIELD(
+ Reserved120,
+ Reserved121,
+ Reserved122,
+ Reserved123,
+ Reserved124,
+ Reserved125,
+ Reserved126,
+ Reserved127)
+ //l3 16-23
+ SK_OT_BYTE_BITFIELD(
+ Reserved112,
+ Reserved113,
+ Reserved114,
+ Reserved115,
+ Reserved116,
+ Reserved117,
+ Reserved118,
+ Reserved119)
+ //l3 8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved104,
+ Reserved105,
+ Reserved106,
+ Reserved107,
+ Reserved108,
+ Reserved109,
+ Reserved110,
+ Reserved111)
+ //l3 0-7
+ SK_OT_BYTE_BITFIELD(
+ Reserved096,
+ Reserved097,
+ Reserved098,
+ Reserved099,
+ Reserved100,
+ Reserved101,
+ Reserved102,
+ Reserved103)
+ } field;
+ struct Raw {
+ struct l0 {
+ static const SK_OT_ULONG BasicLatinMask = SkTEndian_SwapBE32(1 << 0);
+ static const SK_OT_ULONG Latin1SupplementMask = SkTEndian_SwapBE32(1 << 1);
+ static const SK_OT_ULONG LatinExtendedAMask = SkTEndian_SwapBE32(1 << 2);
+ static const SK_OT_ULONG LatinExtendedBMask = SkTEndian_SwapBE32(1 << 3);
+ static const SK_OT_ULONG IPAExtensionsMask = SkTEndian_SwapBE32(1 << 4);
+ static const SK_OT_ULONG SpacingModifierLettersMask = SkTEndian_SwapBE32(1 << 5);
+ static const SK_OT_ULONG CombiningDiacriticalMarksMask = SkTEndian_SwapBE32(1 << 6);
+ static const SK_OT_ULONG GreekAndCopticMask = SkTEndian_SwapBE32(1 << 7);
+ //Reserved
+ static const SK_OT_ULONG CyrillicMask = SkTEndian_SwapBE32(1 << 9);
+ static const SK_OT_ULONG ArmenianMask = SkTEndian_SwapBE32(1 << 10);
+ static const SK_OT_ULONG HebrewMask = SkTEndian_SwapBE32(1 << 11);
+ //Reserved
+ static const SK_OT_ULONG ArabicMask = SkTEndian_SwapBE32(1 << 13);
+ //Reserved
+ static const SK_OT_ULONG DevanagariMask = SkTEndian_SwapBE32(1 << 15);
+ static const SK_OT_ULONG BengaliMask = SkTEndian_SwapBE32(1 << 16);
+ static const SK_OT_ULONG GurmukhiMask = SkTEndian_SwapBE32(1 << 17);
+ static const SK_OT_ULONG GujaratiMask = SkTEndian_SwapBE32(1 << 18);
+ static const SK_OT_ULONG OriyaMask = SkTEndian_SwapBE32(1 << 19);
+ static const SK_OT_ULONG TamilMask = SkTEndian_SwapBE32(1 << 20);
+ static const SK_OT_ULONG TeluguMask = SkTEndian_SwapBE32(1 << 21);
+ static const SK_OT_ULONG KannadaMask = SkTEndian_SwapBE32(1 << 22);
+ static const SK_OT_ULONG MalayalamMask = SkTEndian_SwapBE32(1 << 23);
+ static const SK_OT_ULONG ThaiMask = SkTEndian_SwapBE32(1 << 24);
+ static const SK_OT_ULONG LaoMask = SkTEndian_SwapBE32(1 << 25);
+ static const SK_OT_ULONG GeorgianMask = SkTEndian_SwapBE32(1 << 26);
+ //Reserved
+ static const SK_OT_ULONG HangulJamoMask = SkTEndian_SwapBE32(1 << 28);
+ static const SK_OT_ULONG LatinExtendedAdditionalMask = SkTEndian_SwapBE32(1 << 29);
+ static const SK_OT_ULONG GreekExtendedMask = SkTEndian_SwapBE32(1 << 30);
+ static const SK_OT_ULONG GeneralPunctuationMask = SkTEndian_SwapBE32(1 << 31);
+ };
+ struct l1 {
+ static const SK_OT_ULONG SuperscriptsAndSubscriptsMask = SkTEndian_SwapBE32(1 << (32 - 32));
+ static const SK_OT_ULONG CurrencySymbolsMask = SkTEndian_SwapBE32(1 << (33 - 32));
+ static const SK_OT_ULONG CombiningDiacriticalMarksForSymbolsMask = SkTEndian_SwapBE32(1 << (34 - 32));
+ static const SK_OT_ULONG LetterlikeSymbolsMask = SkTEndian_SwapBE32(1 << (35 - 32));
+ static const SK_OT_ULONG NumberFormsMask = SkTEndian_SwapBE32(1 << (36 - 32));
+ static const SK_OT_ULONG ArrowsMask = SkTEndian_SwapBE32(1 << (37 - 32));
+ static const SK_OT_ULONG MathematicalOperatorsMask = SkTEndian_SwapBE32(1 << (38 - 32));
+ static const SK_OT_ULONG MiscellaneousTechnicalMask = SkTEndian_SwapBE32(1 << (39 - 32));
+ static const SK_OT_ULONG ControlPicturesMask = SkTEndian_SwapBE32(1 << (40 - 32));
+ static const SK_OT_ULONG OpticalCharacterRecognitionMask = SkTEndian_SwapBE32(1 << (41 - 32));
+ static const SK_OT_ULONG EnclosedAlphanumericsMask = SkTEndian_SwapBE32(1 << (42 - 32));
+ static const SK_OT_ULONG BoxDrawingMask = SkTEndian_SwapBE32(1 << (43 - 32));
+ static const SK_OT_ULONG BlockElementsMask = SkTEndian_SwapBE32(1 << (44 - 32));
+ static const SK_OT_ULONG GeometricShapesMask = SkTEndian_SwapBE32(1 << (45 - 32));
+ static const SK_OT_ULONG MiscellaneousSymbolsMask = SkTEndian_SwapBE32(1 << (46 - 32));
+ static const SK_OT_ULONG DingbatsMask = SkTEndian_SwapBE32(1 << (47 - 32));
+ static const SK_OT_ULONG CJKSymbolsAndPunctuationMask = SkTEndian_SwapBE32(1 << (48 - 32));
+ static const SK_OT_ULONG HiraganaMask = SkTEndian_SwapBE32(1 << (49 - 32));
+ static const SK_OT_ULONG KatakanaMask = SkTEndian_SwapBE32(1 << (50 - 32));
+ static const SK_OT_ULONG BopomofoMask = SkTEndian_SwapBE32(1 << (51 - 32));
+ static const SK_OT_ULONG HangulCompatibilityJamoMask = SkTEndian_SwapBE32(1 << (52 - 32));
+ //Reserved
+ static const SK_OT_ULONG EnclosedCJKLettersAndMonthsMask = SkTEndian_SwapBE32(1 << (54 - 32));
+ static const SK_OT_ULONG CJKCompatibilityMask = SkTEndian_SwapBE32(1 << (55 - 32));
+ static const SK_OT_ULONG HangulMask = SkTEndian_SwapBE32(1 << (56 - 32));
+ static const SK_OT_ULONG NonPlane0Mask = SkTEndian_SwapBE32(1 << (57 - 32));
+ //Reserved
+ static const SK_OT_ULONG CJKUnifiedIdeographsMask = SkTEndian_SwapBE32(1 << (59 - 32));
+ static const SK_OT_ULONG PrivateUseAreaMask = SkTEndian_SwapBE32(1 << (60 - 32));
+ static const SK_OT_ULONG CJKCompatibilityIdeographsMask = SkTEndian_SwapBE32(1 << (61 - 32));
+ static const SK_OT_ULONG AlphabeticPresentationFormsMask = SkTEndian_SwapBE32(1 << (62 - 32));
+ static const SK_OT_ULONG ArabicPresentationFormsAMask = SkTEndian_SwapBE32(1 << (63 - 32));
+ };
+ struct l2 {
+ static const SK_OT_ULONG CombiningHalfMarksMask = SkTEndian_SwapBE32(1 << (64 - 64));
+ static const SK_OT_ULONG CJKCompatibilityFormsMask = SkTEndian_SwapBE32(1 << (65 - 64));
+ static const SK_OT_ULONG SmallFormVariantsMask = SkTEndian_SwapBE32(1 << (66 - 64));
+ static const SK_OT_ULONG ArabicPresentationFormsBMask = SkTEndian_SwapBE32(1 << (67 - 64));
+ static const SK_OT_ULONG HalfwidthAndFullwidthFormsMask = SkTEndian_SwapBE32(1 << (68 - 64));
+ static const SK_OT_ULONG SpecialsMask = SkTEndian_SwapBE32(1 << (69 - 64));
+ static const SK_OT_ULONG TibetanMask = SkTEndian_SwapBE32(1 << (70 - 64));
+ static const SK_OT_ULONG SyriacMask = SkTEndian_SwapBE32(1 << (71 - 64));
+ static const SK_OT_ULONG ThaanaMask = SkTEndian_SwapBE32(1 << (72 - 64));
+ static const SK_OT_ULONG SinhalaMask = SkTEndian_SwapBE32(1 << (73 - 64));
+ static const SK_OT_ULONG MyanmarMask = SkTEndian_SwapBE32(1 << (74 - 64));
+ static const SK_OT_ULONG EthiopicMask = SkTEndian_SwapBE32(1 << (75 - 64));
+ static const SK_OT_ULONG CherokeeMask = SkTEndian_SwapBE32(1 << (76 - 64));
+ static const SK_OT_ULONG UnifiedCanadianSyllabicsMask = SkTEndian_SwapBE32(1 << (77 - 64));
+ static const SK_OT_ULONG OghamMask = SkTEndian_SwapBE32(1 << (78 - 64));
+ static const SK_OT_ULONG RunicMask = SkTEndian_SwapBE32(1 << (79 - 64));
+ static const SK_OT_ULONG KhmerMask = SkTEndian_SwapBE32(1 << (80 - 64));
+ static const SK_OT_ULONG MongolianMask = SkTEndian_SwapBE32(1 << (81 - 64));
+ static const SK_OT_ULONG BrailleMask = SkTEndian_SwapBE32(1 << (82 - 64));
+ static const SK_OT_ULONG YiMask = SkTEndian_SwapBE32(1 << (83 - 64));
+ static const SK_OT_ULONG Tagalog_Hanunoo_Buhid_TagbanwaMask = SkTEndian_SwapBE32(1 << (84 - 64));
+ static const SK_OT_ULONG OldItalicMask = SkTEndian_SwapBE32(1 << (85 - 64));
+ static const SK_OT_ULONG GothicMask = SkTEndian_SwapBE32(1 << (86 - 64));
+ static const SK_OT_ULONG DeseretMask = SkTEndian_SwapBE32(1 << (87 - 64));
+ static const SK_OT_ULONG MusicalSymbolsMask = SkTEndian_SwapBE32(1 << (88 - 64));
+ static const SK_OT_ULONG MathematicalAlphanumericSymbolsMask = SkTEndian_SwapBE32(1 << (89 - 64));
+ static const SK_OT_ULONG PrivateUseMask = SkTEndian_SwapBE32(1 << (90 - 64));
+ static const SK_OT_ULONG VariationSelectorsMask = SkTEndian_SwapBE32(1 << (91 - 64));
+ static const SK_OT_ULONG TagsMask = SkTEndian_SwapBE32(1 << (92 - 64));
+ };
+ SK_OT_ULONG value[4];
+ } raw;
+ } ulUnicodeRange;
+ SK_OT_CHAR achVendID[4];
+ union Selection {
+ struct Field {
+ //8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved08,
+ Reserved09,
+ Reserved10,
+ Reserved11,
+ Reserved12,
+ Reserved13,
+ Reserved14,
+ Reserved15)
+ //0-7
+ SK_OT_BYTE_BITFIELD(
+ Italic,
+ Underscore,
+ Negative,
+ Outlined,
+ Strikeout,
+ Bold,
+ Regular,
+ Reserved07)
+ } field;
+ struct Raw {
+ static const SK_OT_USHORT ItalicMask = SkTEndian_SwapBE16(1 << 0);
+ static const SK_OT_USHORT UnderscoreMask = SkTEndian_SwapBE16(1 << 1);
+ static const SK_OT_USHORT NegativeMask = SkTEndian_SwapBE16(1 << 2);
+ static const SK_OT_USHORT OutlinedMask = SkTEndian_SwapBE16(1 << 3);
+ static const SK_OT_USHORT StrikeoutMask = SkTEndian_SwapBE16(1 << 4);
+ static const SK_OT_USHORT BoldMask = SkTEndian_SwapBE16(1 << 5);
+ static const SK_OT_USHORT RegularMask = SkTEndian_SwapBE16(1 << 6);
+ SK_OT_USHORT value;
+ } raw;
+ } fsSelection;
+ SK_OT_USHORT usFirstCharIndex;
+ SK_OT_USHORT usLastCharIndex;
+ //version0
+ SK_OT_SHORT sTypoAscender;
+ SK_OT_SHORT sTypoDescender;
+ SK_OT_SHORT sTypoLineGap;
+ SK_OT_USHORT usWinAscent;
+ SK_OT_USHORT usWinDescent;
+ //version1
+ union CodePageRange {
+ struct Field {
+ //l0 24-31
+ SK_OT_BYTE_BITFIELD(
+ Reserved24,
+ Reserved25,
+ Reserved26,
+ Reserved27,
+ Reserved28,
+ MacintoshCharacterSet,
+ OEMCharacterSet,
+ SymbolCharacterSet)
+ //l0 16-23
+ SK_OT_BYTE_BITFIELD(
+ Thai_874,
+ JISJapan_932,
+ ChineseSimplified_936,
+ KoreanWansung_949,
+ ChineseTraditional_950,
+ KoreanJohab_1361,
+ Reserved22,
+ Reserved23)
+ //l0 8-15
+ SK_OT_BYTE_BITFIELD(
+ Vietnamese,
+ Reserved09,
+ Reserved10,
+ Reserved11,
+ Reserved12,
+ Reserved13,
+ Reserved14,
+ Reserved15)
+ //l0 0-7
+ SK_OT_BYTE_BITFIELD(
+ Latin1_1252,
+ Latin2EasternEurope_1250,
+ Cyrillic_1251,
+ Greek_1253,
+ Turkish_1254,
+ Hebrew_1255,
+ Arabic_1256,
+ WindowsBaltic_1257)
+
+ //l1 24-31
+ SK_OT_BYTE_BITFIELD(
+ IBMTurkish_857,
+ IBMCyrillic_855,
+ Latin2_852,
+ MSDOSBaltic_775,
+ Greek_737,
+ Arabic_708,
+ WELatin1_850,
+ US_437)
+ //l1 16-23
+ SK_OT_BYTE_BITFIELD(
+ IBMGreek_869,
+ MSDOSRussian_866,
+ MSDOSNordic_865,
+ Arabic_864,
+ MSDOSCanadianFrench_863,
+ Hebrew_862,
+ MSDOSIcelandic_861,
+ MSDOSPortuguese_860)
+ //l1 8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved40,
+ Reserved41,
+ Reserved42,
+ Reserved43,
+ Reserved44,
+ Reserved45,
+ Reserved46,
+ Reserved47)
+ //l1 0-7
+ SK_OT_BYTE_BITFIELD(
+ Reserved32,
+ Reserved33,
+ Reserved34,
+ Reserved35,
+ Reserved36,
+ Reserved37,
+ Reserved38,
+ Reserved39)
+ } field;
+ struct Raw {
+ struct l0 {
+ static const SK_OT_ULONG Latin1_1252Mask = SkTEndian_SwapBE32(1 << 0);
+ static const SK_OT_ULONG Latin2EasternEurope_1250Mask = SkTEndian_SwapBE32(1 << 1);
+ static const SK_OT_ULONG Cyrillic_1251Mask = SkTEndian_SwapBE32(1 << 2);
+ static const SK_OT_ULONG Greek_1253Mask = SkTEndian_SwapBE32(1 << 3);
+ static const SK_OT_ULONG Turkish_1254Mask = SkTEndian_SwapBE32(1 << 4);
+ static const SK_OT_ULONG Hebrew_1255Mask = SkTEndian_SwapBE32(1 << 5);
+ static const SK_OT_ULONG Arabic_1256Mask = SkTEndian_SwapBE32(1 << 6);
+ static const SK_OT_ULONG WindowsBaltic_1257Mask = SkTEndian_SwapBE32(1 << 7);
+ static const SK_OT_ULONG Vietnamese_1258Mask = SkTEndian_SwapBE32(1 << 8);
+ static const SK_OT_ULONG Thai_874Mask = SkTEndian_SwapBE32(1 << 16);
+ static const SK_OT_ULONG JISJapan_932Mask = SkTEndian_SwapBE32(1 << 17);
+ static const SK_OT_ULONG ChineseSimplified_936Mask = SkTEndian_SwapBE32(1 << 18);
+ static const SK_OT_ULONG KoreanWansung_949Mask = SkTEndian_SwapBE32(1 << 19);
+ static const SK_OT_ULONG ChineseTraditional_950Mask = SkTEndian_SwapBE32(1 << 20);
+ static const SK_OT_ULONG KoreanJohab_1361Mask = SkTEndian_SwapBE32(1 << 21);
+ static const SK_OT_ULONG MacintoshCharacterSetMask = SkTEndian_SwapBE32(1 << 29);
+ static const SK_OT_ULONG OEMCharacterSetMask = SkTEndian_SwapBE32(1 << 30);
+ static const SK_OT_ULONG SymbolCharacterSetMask = SkTEndian_SwapBE32(1 << 31);
+ };
+ struct l1 {
+ static const SK_OT_ULONG IBMGreek_869Mask = SkTEndian_SwapBE32(1 << (48 - 32));
+ static const SK_OT_ULONG MSDOSRussian_866Mask = SkTEndian_SwapBE32(1 << (49 - 32));
+ static const SK_OT_ULONG MSDOSNordic_865Mask = SkTEndian_SwapBE32(1 << (50 - 32));
+ static const SK_OT_ULONG Arabic_864Mask = SkTEndian_SwapBE32(1 << (51 - 32));
+ static const SK_OT_ULONG MSDOSCanadianFrench_863Mask = SkTEndian_SwapBE32(1 << (52 - 32));
+ static const SK_OT_ULONG Hebrew_862Mask = SkTEndian_SwapBE32(1 << (53 - 32));
+ static const SK_OT_ULONG MSDOSIcelandic_861Mask = SkTEndian_SwapBE32(1 << (54 - 32));
+ static const SK_OT_ULONG MSDOSPortuguese_860Mask = SkTEndian_SwapBE32(1 << (55 - 32));
+ static const SK_OT_ULONG IBMTurkish_857Mask = SkTEndian_SwapBE32(1 << (56 - 32));
+ static const SK_OT_ULONG IBMCyrillic_855Mask = SkTEndian_SwapBE32(1 << (57 - 32));
+ static const SK_OT_ULONG Latin2_852Mask = SkTEndian_SwapBE32(1 << (58 - 32));
+ static const SK_OT_ULONG MSDOSBaltic_775Mask = SkTEndian_SwapBE32(1 << (59 - 32));
+ static const SK_OT_ULONG Greek_737Mask = SkTEndian_SwapBE32(1 << (60 - 32));
+ static const SK_OT_ULONG Arabic_708Mask = SkTEndian_SwapBE32(1 << (61 - 32));
+ static const SK_OT_ULONG WELatin1_850Mask = SkTEndian_SwapBE32(1 << (62 - 32));
+ static const SK_OT_ULONG US_437Mask = SkTEndian_SwapBE32(1 << (63 - 32));
+ };
+ SK_OT_ULONG value[2];
+ } raw;
+ } ulCodePageRange;
+ //version2
+ SK_OT_SHORT sxHeight;
+ SK_OT_SHORT sCapHeight;
+ SK_OT_USHORT usDefaultChar;
+ SK_OT_USHORT usBreakChar;
+ SK_OT_USHORT usMaxContext;
+};
+
+#pragma pack(pop)
+
+
+SK_COMPILE_ASSERT(sizeof(SkOTTableOS2_V3) == 96, sizeof_SkOTTableOS2_V3_not_96);
+
+#endif
diff --git a/src/sfnt/SkOTTable_OS_2_V4.h b/src/sfnt/SkOTTable_OS_2_V4.h
new file mode 100644
index 0000000000..64c6e8cb9b
--- /dev/null
+++ b/src/sfnt/SkOTTable_OS_2_V4.h
@@ -0,0 +1,584 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkOTTable_OS_2_V4_DEFINED
+#define SkOTTable_OS_2_V4_DEFINED
+
+#include "SkEndian.h"
+#include "SkIBMFamilyClass.h"
+#include "SkOTTableTypes.h"
+#include "SkPanose.h"
+#include "SkTypedEnum.h"
+
+#pragma pack(push, 1)
+
+struct SkOTTableOS2_V4 {
+ SK_OT_USHORT version;
+ static const SK_OT_USHORT version4 = SkTEndian_SwapBE16(4);
+ SK_OT_SHORT xAvgCharWidth;
+ struct WeightClass {
+ SK_TYPED_ENUM(Value, SK_OT_USHORT,
+ ((Thin, SkTEndian_SwapBE16(100)))
+ ((ExtraLight, SkTEndian_SwapBE16(200)))
+ ((Light, SkTEndian_SwapBE16(300)))
+ ((Normal, SkTEndian_SwapBE16(400)))
+ ((Medium, SkTEndian_SwapBE16(500)))
+ ((SemiBold, SkTEndian_SwapBE16(600)))
+ ((Bold, SkTEndian_SwapBE16(700)))
+ ((ExtraBold, SkTEndian_SwapBE16(800)))
+ ((Black, SkTEndian_SwapBE16(900)))
+ SK_SEQ_END,
+ SK_SEQ_END)
+ SK_OT_USHORT value;
+ } usWeightClass;
+ struct WidthClass {
+ SK_TYPED_ENUM(Value, SK_OT_USHORT,
+ ((UltraCondensed, SkTEndian_SwapBE16(1)))
+ ((ExtraCondensed, SkTEndian_SwapBE16(2)))
+ ((Condensed, SkTEndian_SwapBE16(3)))
+ ((SemiCondensed, SkTEndian_SwapBE16(4)))
+ ((Medium, SkTEndian_SwapBE16(5)))
+ ((SemiExpanded, SkTEndian_SwapBE16(6)))
+ ((Expanded, SkTEndian_SwapBE16(7)))
+ ((ExtraExpanded, SkTEndian_SwapBE16(8)))
+ ((UltraExpanded, SkTEndian_SwapBE16(9)))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } usWidthClass;
+ union Type {
+ struct Field {
+ //8-15
+ SK_OT_BYTE_BITFIELD(
+ NoSubsetting,
+ Bitmap,
+ Reserved10,
+ Reserved11,
+ Reserved12,
+ Reserved13,
+ Reserved14,
+ Reserved15)
+ //0-7
+ SK_OT_BYTE_BITFIELD(
+ Reserved00,
+ Restricted,
+ PreviewPrint,
+ Editable,
+ Reserved04,
+ Reserved05,
+ Reserved06,
+ Reserved07)
+ } field;
+ struct Raw {
+ static const SK_OT_USHORT Installable = SkTEndian_SwapBE16(0);
+ static const SK_OT_USHORT RestrictedMask = SkTEndian_SwapBE16(1 << 1);
+ static const SK_OT_USHORT PreviewPrintMask = SkTEndian_SwapBE16(1 << 2);
+ static const SK_OT_USHORT EditableMask = SkTEndian_SwapBE16(1 << 3);
+ static const SK_OT_USHORT NoSubsettingMask = SkTEndian_SwapBE16(1 << 8);
+ static const SK_OT_USHORT BitmapMask = SkTEndian_SwapBE16(1 << 9);
+ SK_OT_USHORT value;
+ } raw;
+ } fsType;
+ SK_OT_SHORT ySubscriptXSize;
+ SK_OT_SHORT ySubscriptYSize;
+ SK_OT_SHORT ySubscriptXOffset;
+ SK_OT_SHORT ySubscriptYOffset;
+ SK_OT_SHORT ySuperscriptXSize;
+ SK_OT_SHORT ySuperscriptYSize;
+ SK_OT_SHORT ySuperscriptXOffset;
+ SK_OT_SHORT ySuperscriptYOffset;
+ SK_OT_SHORT yStrikeoutSize;
+ SK_OT_SHORT yStrikeoutPosition;
+ SkIBMFamilyClass sFamilyClass;
+ SkPanose panose;
+ union UnicodeRange {
+ struct Field {
+ //l0 24-31
+ SK_OT_BYTE_BITFIELD(
+ Thai,
+ Lao,
+ Georgian,
+ Balinese,
+ HangulJamo,
+ LatinExtendedAdditional,
+ GreekExtended,
+ GeneralPunctuation)
+ //l0 16-23
+ SK_OT_BYTE_BITFIELD(
+ Bengali,
+ Gurmukhi,
+ Gujarati,
+ Oriya,
+ Tamil,
+ Telugu,
+ Kannada,
+ Malayalam)
+ //l0 8-15
+ SK_OT_BYTE_BITFIELD(
+ Coptic,
+ Cyrillic,
+ Armenian,
+ Hebrew,
+ Vai,
+ Arabic,
+ NKo,
+ Devanagari)
+ //l0 0-7
+ SK_OT_BYTE_BITFIELD(
+ BasicLatin,
+ Latin1Supplement,
+ LatinExtendedA,
+ LatinExtendedB,
+ IPAExtensions,
+ SpacingModifierLetters,
+ CombiningDiacriticalMarks,
+ GreekAndCoptic)
+
+ //l1 24-31
+ SK_OT_BYTE_BITFIELD(
+ Hangul,
+ NonPlane0,
+ Phoenician,
+ CJKUnifiedIdeographs,
+ PrivateUseArea,
+ CJKCompatibilityIdeographs,
+ AlphabeticPresentationForms,
+ ArabicPresentationFormsA)
+ //l1 16-23
+ SK_OT_BYTE_BITFIELD(
+ CJKSymbolsAndPunctuation,
+ Hiragana,
+ Katakana,
+ Bopomofo,
+ HangulCompatibilityJamo,
+ PhagsPa,
+ EnclosedCJKLettersAndMonths,
+ CJKCompatibility)
+ //l1 8-15
+ SK_OT_BYTE_BITFIELD(
+ ControlPictures,
+ OpticalCharacterRecognition,
+ EnclosedAlphanumerics,
+ BoxDrawing,
+ BlockElements,
+ GeometricShapes,
+ MiscellaneousSymbols,
+ Dingbats)
+ //l1 0-7
+ SK_OT_BYTE_BITFIELD(
+ SuperscriptsAndSubscripts,
+ CurrencySymbols,
+ CombiningDiacriticalMarksForSymbols,
+ LetterlikeSymbols,
+ NumberForms,
+ Arrows,
+ MathematicalOperators,
+ MiscellaneousTechnical)
+
+ //l2 24-31
+ SK_OT_BYTE_BITFIELD(
+ MusicalSymbols,
+ MathematicalAlphanumericSymbols,
+ PrivateUse,
+ VariationSelectors,
+ Tags,
+ Limbu,
+ TaiLe,
+ NewTaiLue)
+ //l2 16-23
+ SK_OT_BYTE_BITFIELD(
+ Khmer,
+ Mongolian,
+ Braille,
+ Yi,
+ Tagalog_Hanunoo_Buhid_Tagbanwa,
+ OldItalic,
+ Gothic,
+ Deseret)
+ //l2 8-15
+ SK_OT_BYTE_BITFIELD(
+ Thaana,
+ Sinhala,
+ Myanmar,
+ Ethiopic,
+ Cherokee,
+ UnifiedCanadianSyllabics,
+ Ogham,
+ Runic)
+ //l2 0-7
+ SK_OT_BYTE_BITFIELD(
+ CombiningHalfMarks,
+ CJKCompatibilityForms,
+ SmallFormVariants,
+ ArabicPresentationFormsB,
+ HalfwidthAndFullwidthForms,
+ Specials,
+ Tibetan,
+ Syriac)
+
+ //l3 24-31
+ SK_OT_BYTE_BITFIELD(
+ PhaistosDisc,
+ Carian_Lycian_Lydian,
+ DominoTiles_MahjongTiles,
+ Reserved123,
+ Reserved124,
+ Reserved125,
+ Reserved126,
+ Reserved127)
+ //l3 16-23
+ SK_OT_BYTE_BITFIELD(
+ Sundanese,
+ Lepcha,
+ OlChiki,
+ Saurashtra,
+ KayahLi,
+ Rejang,
+ Cham,
+ AncientSymbols)
+ //l3 8-15
+ SK_OT_BYTE_BITFIELD(
+ OldPersian,
+ Shavian,
+ Osmanya,
+ CypriotSyllabary,
+ Kharoshthi,
+ TaiXuanJingSymbols,
+ Cuneiform,
+ CountingRodNumerals)
+ //l3 0-7
+ SK_OT_BYTE_BITFIELD(
+ Buginese,
+ Glagolitic,
+ Tifinagh,
+ YijingHexagramSymbols,
+ SylotiNagri,
+ LinearB_AegeanNumbers,
+ AncientGreekNumbers,
+ Ugaritic)
+ } field;
+ struct Raw {
+ struct l0 {
+ static const SK_OT_ULONG BasicLatinMask = SkTEndian_SwapBE32(1 << 0);
+ static const SK_OT_ULONG Latin1SupplementMask = SkTEndian_SwapBE32(1 << 1);
+ static const SK_OT_ULONG LatinExtendedAMask = SkTEndian_SwapBE32(1 << 2);
+ static const SK_OT_ULONG LatinExtendedBMask = SkTEndian_SwapBE32(1 << 3);
+ static const SK_OT_ULONG IPAExtensionsMask = SkTEndian_SwapBE32(1 << 4);
+ static const SK_OT_ULONG SpacingModifierLettersMask = SkTEndian_SwapBE32(1 << 5);
+ static const SK_OT_ULONG CombiningDiacriticalMarksMask = SkTEndian_SwapBE32(1 << 6);
+ static const SK_OT_ULONG GreekAndCopticMask = SkTEndian_SwapBE32(1 << 7);
+ static const SK_OT_ULONG CopticMask = SkTEndian_SwapBE32(1 << 8);
+ static const SK_OT_ULONG CyrillicMask = SkTEndian_SwapBE32(1 << 9);
+ static const SK_OT_ULONG ArmenianMask = SkTEndian_SwapBE32(1 << 10);
+ static const SK_OT_ULONG HebrewMask = SkTEndian_SwapBE32(1 << 11);
+ static const SK_OT_ULONG VaiMask = SkTEndian_SwapBE32(1 << 12);
+ static const SK_OT_ULONG ArabicMask = SkTEndian_SwapBE32(1 << 13);
+ static const SK_OT_ULONG NKoMask = SkTEndian_SwapBE32(1 << 14);
+ static const SK_OT_ULONG DevanagariMask = SkTEndian_SwapBE32(1 << 15);
+ static const SK_OT_ULONG BengaliMask = SkTEndian_SwapBE32(1 << 16);
+ static const SK_OT_ULONG GurmukhiMask = SkTEndian_SwapBE32(1 << 17);
+ static const SK_OT_ULONG GujaratiMask = SkTEndian_SwapBE32(1 << 18);
+ static const SK_OT_ULONG OriyaMask = SkTEndian_SwapBE32(1 << 19);
+ static const SK_OT_ULONG TamilMask = SkTEndian_SwapBE32(1 << 20);
+ static const SK_OT_ULONG TeluguMask = SkTEndian_SwapBE32(1 << 21);
+ static const SK_OT_ULONG KannadaMask = SkTEndian_SwapBE32(1 << 22);
+ static const SK_OT_ULONG MalayalamMask = SkTEndian_SwapBE32(1 << 23);
+ static const SK_OT_ULONG ThaiMask = SkTEndian_SwapBE32(1 << 24);
+ static const SK_OT_ULONG LaoMask = SkTEndian_SwapBE32(1 << 25);
+ static const SK_OT_ULONG GeorgianMask = SkTEndian_SwapBE32(1 << 26);
+ static const SK_OT_ULONG BalineseMask = SkTEndian_SwapBE32(1 << 27);
+ static const SK_OT_ULONG HangulJamoMask = SkTEndian_SwapBE32(1 << 28);
+ static const SK_OT_ULONG LatinExtendedAdditionalMask = SkTEndian_SwapBE32(1 << 29);
+ static const SK_OT_ULONG GreekExtendedMask = SkTEndian_SwapBE32(1 << 30);
+ static const SK_OT_ULONG GeneralPunctuationMask = SkTEndian_SwapBE32(1 << 31);
+ };
+ struct l1 {
+ static const SK_OT_ULONG SuperscriptsAndSubscriptsMask = SkTEndian_SwapBE32(1 << (32 - 32));
+ static const SK_OT_ULONG CurrencySymbolsMask = SkTEndian_SwapBE32(1 << (33 - 32));
+ static const SK_OT_ULONG CombiningDiacriticalMarksForSymbolsMask = SkTEndian_SwapBE32(1 << (34 - 32));
+ static const SK_OT_ULONG LetterlikeSymbolsMask = SkTEndian_SwapBE32(1 << (35 - 32));
+ static const SK_OT_ULONG NumberFormsMask = SkTEndian_SwapBE32(1 << (36 - 32));
+ static const SK_OT_ULONG ArrowsMask = SkTEndian_SwapBE32(1 << (37 - 32));
+ static const SK_OT_ULONG MathematicalOperatorsMask = SkTEndian_SwapBE32(1 << (38 - 32));
+ static const SK_OT_ULONG MiscellaneousTechnicalMask = SkTEndian_SwapBE32(1 << (39 - 32));
+ static const SK_OT_ULONG ControlPicturesMask = SkTEndian_SwapBE32(1 << (40 - 32));
+ static const SK_OT_ULONG OpticalCharacterRecognitionMask = SkTEndian_SwapBE32(1 << (41 - 32));
+ static const SK_OT_ULONG EnclosedAlphanumericsMask = SkTEndian_SwapBE32(1 << (42 - 32));
+ static const SK_OT_ULONG BoxDrawingMask = SkTEndian_SwapBE32(1 << (43 - 32));
+ static const SK_OT_ULONG BlockElementsMask = SkTEndian_SwapBE32(1 << (44 - 32));
+ static const SK_OT_ULONG GeometricShapesMask = SkTEndian_SwapBE32(1 << (45 - 32));
+ static const SK_OT_ULONG MiscellaneousSymbolsMask = SkTEndian_SwapBE32(1 << (46 - 32));
+ static const SK_OT_ULONG DingbatsMask = SkTEndian_SwapBE32(1 << (47 - 32));
+ static const SK_OT_ULONG CJKSymbolsAndPunctuationMask = SkTEndian_SwapBE32(1 << (48 - 32));
+ static const SK_OT_ULONG HiraganaMask = SkTEndian_SwapBE32(1 << (49 - 32));
+ static const SK_OT_ULONG KatakanaMask = SkTEndian_SwapBE32(1 << (50 - 32));
+ static const SK_OT_ULONG BopomofoMask = SkTEndian_SwapBE32(1 << (51 - 32));
+ static const SK_OT_ULONG HangulCompatibilityJamoMask = SkTEndian_SwapBE32(1 << (52 - 32));
+ static const SK_OT_ULONG PhagsPaMask = SkTEndian_SwapBE32(1 << (53 - 32));
+ static const SK_OT_ULONG EnclosedCJKLettersAndMonthsMask = SkTEndian_SwapBE32(1 << (54 - 32));
+ static const SK_OT_ULONG CJKCompatibilityMask = SkTEndian_SwapBE32(1 << (55 - 32));
+ static const SK_OT_ULONG HangulMask = SkTEndian_SwapBE32(1 << (56 - 32));
+ static const SK_OT_ULONG NonPlane0Mask = SkTEndian_SwapBE32(1 << (57 - 32));
+ static const SK_OT_ULONG PhoenicianMask = SkTEndian_SwapBE32(1 << (58 - 32));
+ static const SK_OT_ULONG CJKUnifiedIdeographsMask = SkTEndian_SwapBE32(1 << (59 - 32));
+ static const SK_OT_ULONG PrivateUseAreaMask = SkTEndian_SwapBE32(1 << (60 - 32));
+ static const SK_OT_ULONG CJKCompatibilityIdeographsMask = SkTEndian_SwapBE32(1 << (61 - 32));
+ static const SK_OT_ULONG AlphabeticPresentationFormsMask = SkTEndian_SwapBE32(1 << (62 - 32));
+ static const SK_OT_ULONG ArabicPresentationFormsAMask = SkTEndian_SwapBE32(1 << (63 - 32));
+ };
+ struct l2 {
+ static const SK_OT_ULONG CombiningHalfMarksMask = SkTEndian_SwapBE32(1 << (64 - 64));
+ static const SK_OT_ULONG CJKCompatibilityFormsMask = SkTEndian_SwapBE32(1 << (65 - 64));
+ static const SK_OT_ULONG SmallFormVariantsMask = SkTEndian_SwapBE32(1 << (66 - 64));
+ static const SK_OT_ULONG ArabicPresentationFormsBMask = SkTEndian_SwapBE32(1 << (67 - 64));
+ static const SK_OT_ULONG HalfwidthAndFullwidthFormsMask = SkTEndian_SwapBE32(1 << (68 - 64));
+ static const SK_OT_ULONG SpecialsMask = SkTEndian_SwapBE32(1 << (69 - 64));
+ static const SK_OT_ULONG TibetanMask = SkTEndian_SwapBE32(1 << (70 - 64));
+ static const SK_OT_ULONG SyriacMask = SkTEndian_SwapBE32(1 << (71 - 64));
+ static const SK_OT_ULONG ThaanaMask = SkTEndian_SwapBE32(1 << (72 - 64));
+ static const SK_OT_ULONG SinhalaMask = SkTEndian_SwapBE32(1 << (73 - 64));
+ static const SK_OT_ULONG MyanmarMask = SkTEndian_SwapBE32(1 << (74 - 64));
+ static const SK_OT_ULONG EthiopicMask = SkTEndian_SwapBE32(1 << (75 - 64));
+ static const SK_OT_ULONG CherokeeMask = SkTEndian_SwapBE32(1 << (76 - 64));
+ static const SK_OT_ULONG UnifiedCanadianSyllabicsMask = SkTEndian_SwapBE32(1 << (77 - 64));
+ static const SK_OT_ULONG OghamMask = SkTEndian_SwapBE32(1 << (78 - 64));
+ static const SK_OT_ULONG RunicMask = SkTEndian_SwapBE32(1 << (79 - 64));
+ static const SK_OT_ULONG KhmerMask = SkTEndian_SwapBE32(1 << (80 - 64));
+ static const SK_OT_ULONG MongolianMask = SkTEndian_SwapBE32(1 << (81 - 64));
+ static const SK_OT_ULONG BrailleMask = SkTEndian_SwapBE32(1 << (82 - 64));
+ static const SK_OT_ULONG YiMask = SkTEndian_SwapBE32(1 << (83 - 64));
+ static const SK_OT_ULONG Tagalog_Hanunoo_Buhid_TagbanwaMask = SkTEndian_SwapBE32(1 << (84 - 64));
+ static const SK_OT_ULONG OldItalicMask = SkTEndian_SwapBE32(1 << (85 - 64));
+ static const SK_OT_ULONG GothicMask = SkTEndian_SwapBE32(1 << (86 - 64));
+ static const SK_OT_ULONG DeseretMask = SkTEndian_SwapBE32(1 << (87 - 64));
+ static const SK_OT_ULONG MusicalSymbolsMask = SkTEndian_SwapBE32(1 << (88 - 64));
+ static const SK_OT_ULONG MathematicalAlphanumericSymbolsMask = SkTEndian_SwapBE32(1 << (89 - 64));
+ static const SK_OT_ULONG PrivateUseMask = SkTEndian_SwapBE32(1 << (90 - 64));
+ static const SK_OT_ULONG VariationSelectorsMask = SkTEndian_SwapBE32(1 << (91 - 64));
+ static const SK_OT_ULONG TagsMask = SkTEndian_SwapBE32(1 << (92 - 64));
+ static const SK_OT_ULONG LimbuMask = SkTEndian_SwapBE32(1 << (93 - 64));
+ static const SK_OT_ULONG TaiLeMask = SkTEndian_SwapBE32(1 << (94 - 64));
+ static const SK_OT_ULONG NewTaiLueMask = SkTEndian_SwapBE32(1 << (95 - 64));
+ };
+ struct l3 {
+ static const SK_OT_ULONG BugineseMask = SkTEndian_SwapBE32(1 << (96 - 96));
+ static const SK_OT_ULONG GlagoliticMask = SkTEndian_SwapBE32(1 << (97 - 96));
+ static const SK_OT_ULONG TifinaghMask = SkTEndian_SwapBE32(1 << (98 - 96));
+ static const SK_OT_ULONG YijingHexagramSymbolsMask = SkTEndian_SwapBE32(1 << (99 - 96));
+ static const SK_OT_ULONG SylotiNagriMask = SkTEndian_SwapBE32(1 << (100 - 96));
+ static const SK_OT_ULONG LinearB_AegeanNumbersMask = SkTEndian_SwapBE32(1 << (101 - 96));
+ static const SK_OT_ULONG AncientGreekNumbersMask = SkTEndian_SwapBE32(1 << (102 - 96));
+ static const SK_OT_ULONG UgariticMask = SkTEndian_SwapBE32(1 << (103 - 96));
+ static const SK_OT_ULONG OldPersianMask = SkTEndian_SwapBE32(1 << (104 - 96));
+ static const SK_OT_ULONG ShavianMask = SkTEndian_SwapBE32(1 << (105 - 96));
+ static const SK_OT_ULONG OsmanyaMask = SkTEndian_SwapBE32(1 << (106 - 96));
+ static const SK_OT_ULONG CypriotSyllabaryMask = SkTEndian_SwapBE32(1 << (107 - 96));
+ static const SK_OT_ULONG KharoshthiMask = SkTEndian_SwapBE32(1 << (108 - 96));
+ static const SK_OT_ULONG TaiXuanJingSymbolsMask = SkTEndian_SwapBE32(1 << (109 - 96));
+ static const SK_OT_ULONG CuneiformMask = SkTEndian_SwapBE32(1 << (110 - 96));
+ static const SK_OT_ULONG CountingRodNumeralsMask = SkTEndian_SwapBE32(1 << (111 - 96));
+ static const SK_OT_ULONG SundaneseMask = SkTEndian_SwapBE32(1 << (112 - 96));
+ static const SK_OT_ULONG LepchaMask = SkTEndian_SwapBE32(1 << (113 - 96));
+ static const SK_OT_ULONG OlChikiMask = SkTEndian_SwapBE32(1 << (114 - 96));
+ static const SK_OT_ULONG SaurashtraMask = SkTEndian_SwapBE32(1 << (115 - 96));
+ static const SK_OT_ULONG KayahLiMask = SkTEndian_SwapBE32(1 << (116 - 96));
+ static const SK_OT_ULONG RejangMask = SkTEndian_SwapBE32(1 << (117 - 96));
+ static const SK_OT_ULONG ChamMask = SkTEndian_SwapBE32(1 << (118 - 96));
+ static const SK_OT_ULONG AncientSymbolsMask = SkTEndian_SwapBE32(1 << (119 - 96));
+ static const SK_OT_ULONG PhaistosDiscMask = SkTEndian_SwapBE32(1 << (120 - 96));
+ static const SK_OT_ULONG Carian_Lycian_LydianMask = SkTEndian_SwapBE32(1 << (121 - 96));
+ static const SK_OT_ULONG DominoTiles_MahjongTilesMask = SkTEndian_SwapBE32(1 << (122 - 96));
+ };
+ SK_OT_ULONG value[4];
+ } raw;
+ } ulUnicodeRange;
+ SK_OT_CHAR achVendID[4];
+ union Selection {
+ struct Field {
+ //8-15
+ SK_OT_BYTE_BITFIELD(
+ WWS,
+ Oblique,
+ Reserved10,
+ Reserved11,
+ Reserved12,
+ Reserved13,
+ Reserved14,
+ Reserved15)
+ //0-7
+ SK_OT_BYTE_BITFIELD(
+ Italic,
+ Underscore,
+ Negative,
+ Outlined,
+ Strikeout,
+ Bold,
+ Regular,
+ UseTypoMetrics)
+ } field;
+ struct Raw {
+ static const SK_OT_USHORT ItalicMask = SkTEndian_SwapBE16(1 << 0);
+ static const SK_OT_USHORT UnderscoreMask = SkTEndian_SwapBE16(1 << 1);
+ static const SK_OT_USHORT NegativeMask = SkTEndian_SwapBE16(1 << 2);
+ static const SK_OT_USHORT OutlinedMask = SkTEndian_SwapBE16(1 << 3);
+ static const SK_OT_USHORT StrikeoutMask = SkTEndian_SwapBE16(1 << 4);
+ static const SK_OT_USHORT BoldMask = SkTEndian_SwapBE16(1 << 5);
+ static const SK_OT_USHORT RegularMask = SkTEndian_SwapBE16(1 << 6);
+ static const SK_OT_USHORT UseTypoMetricsMask = SkTEndian_SwapBE16(1 << 7);
+ static const SK_OT_USHORT WWSMask = SkTEndian_SwapBE16(1 << 8);
+ static const SK_OT_USHORT ObliqueMask = SkTEndian_SwapBE16(1 << 9);
+ SK_OT_USHORT value;
+ } raw;
+ } fsSelection;
+ SK_OT_USHORT usFirstCharIndex;
+ SK_OT_USHORT usLastCharIndex;
+ //version0
+ SK_OT_SHORT sTypoAscender;
+ SK_OT_SHORT sTypoDescender;
+ SK_OT_SHORT sTypoLineGap;
+ SK_OT_USHORT usWinAscent;
+ SK_OT_USHORT usWinDescent;
+ //version1
+ union CodePageRange {
+ struct Field {
+ //l0 24-31
+ SK_OT_BYTE_BITFIELD(
+ Reserved24,
+ Reserved25,
+ Reserved26,
+ Reserved27,
+ Reserved28,
+ MacintoshCharacterSet,
+ OEMCharacterSet,
+ SymbolCharacterSet)
+ //l0 16-23
+ SK_OT_BYTE_BITFIELD(
+ Thai_874,
+ JISJapan_932,
+ ChineseSimplified_936,
+ KoreanWansung_949,
+ ChineseTraditional_950,
+ KoreanJohab_1361,
+ Reserved22,
+ Reserved23)
+ //l0 8-15
+ SK_OT_BYTE_BITFIELD(
+ Vietnamese,
+ Reserved09,
+ Reserved10,
+ Reserved11,
+ Reserved12,
+ Reserved13,
+ Reserved14,
+ Reserved15)
+ //l0 0-7
+ SK_OT_BYTE_BITFIELD(
+ Latin1_1252,
+ Latin2EasternEurope_1250,
+ Cyrillic_1251,
+ Greek_1253,
+ Turkish_1254,
+ Hebrew_1255,
+ Arabic_1256,
+ WindowsBaltic_1257)
+
+ //l1 24-31
+ SK_OT_BYTE_BITFIELD(
+ IBMTurkish_857,
+ IBMCyrillic_855,
+ Latin2_852,
+ MSDOSBaltic_775,
+ Greek_737,
+ Arabic_708,
+ WELatin1_850,
+ US_437)
+ //l1 16-23
+ SK_OT_BYTE_BITFIELD(
+ IBMGreek_869,
+ MSDOSRussian_866,
+ MSDOSNordic_865,
+ Arabic_864,
+ MSDOSCanadianFrench_863,
+ Hebrew_862,
+ MSDOSIcelandic_861,
+ MSDOSPortuguese_860)
+ //l1 8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved40,
+ Reserved41,
+ Reserved42,
+ Reserved43,
+ Reserved44,
+ Reserved45,
+ Reserved46,
+ Reserved47)
+ //l1 0-7
+ SK_OT_BYTE_BITFIELD(
+ Reserved32,
+ Reserved33,
+ Reserved34,
+ Reserved35,
+ Reserved36,
+ Reserved37,
+ Reserved38,
+ Reserved39)
+ } field;
+ struct Raw {
+ struct l0 {
+ static const SK_OT_ULONG Latin1_1252Mask = SkTEndian_SwapBE32(1 << 0);
+ static const SK_OT_ULONG Latin2EasternEurope_1250Mask = SkTEndian_SwapBE32(1 << 1);
+ static const SK_OT_ULONG Cyrillic_1251Mask = SkTEndian_SwapBE32(1 << 2);
+ static const SK_OT_ULONG Greek_1253Mask = SkTEndian_SwapBE32(1 << 3);
+ static const SK_OT_ULONG Turkish_1254Mask = SkTEndian_SwapBE32(1 << 4);
+ static const SK_OT_ULONG Hebrew_1255Mask = SkTEndian_SwapBE32(1 << 5);
+ static const SK_OT_ULONG Arabic_1256Mask = SkTEndian_SwapBE32(1 << 6);
+ static const SK_OT_ULONG WindowsBaltic_1257Mask = SkTEndian_SwapBE32(1 << 7);
+ static const SK_OT_ULONG Vietnamese_1258Mask = SkTEndian_SwapBE32(1 << 8);
+ static const SK_OT_ULONG Thai_874Mask = SkTEndian_SwapBE32(1 << 16);
+ static const SK_OT_ULONG JISJapan_932Mask = SkTEndian_SwapBE32(1 << 17);
+ static const SK_OT_ULONG ChineseSimplified_936Mask = SkTEndian_SwapBE32(1 << 18);
+ static const SK_OT_ULONG KoreanWansung_949Mask = SkTEndian_SwapBE32(1 << 19);
+ static const SK_OT_ULONG ChineseTraditional_950Mask = SkTEndian_SwapBE32(1 << 20);
+ static const SK_OT_ULONG KoreanJohab_1361Mask = SkTEndian_SwapBE32(1 << 21);
+ static const SK_OT_ULONG MacintoshCharacterSetMask = SkTEndian_SwapBE32(1 << 29);
+ static const SK_OT_ULONG OEMCharacterSetMask = SkTEndian_SwapBE32(1 << 30);
+ static const SK_OT_ULONG SymbolCharacterSetMask = SkTEndian_SwapBE32(1 << 31);
+ };
+ struct l1 {
+ static const SK_OT_ULONG IBMGreek_869Mask = SkTEndian_SwapBE32(1 << (48 - 32));
+ static const SK_OT_ULONG MSDOSRussian_866Mask = SkTEndian_SwapBE32(1 << (49 - 32));
+ static const SK_OT_ULONG MSDOSNordic_865Mask = SkTEndian_SwapBE32(1 << (50 - 32));
+ static const SK_OT_ULONG Arabic_864Mask = SkTEndian_SwapBE32(1 << (51 - 32));
+ static const SK_OT_ULONG MSDOSCanadianFrench_863Mask = SkTEndian_SwapBE32(1 << (52 - 32));
+ static const SK_OT_ULONG Hebrew_862Mask = SkTEndian_SwapBE32(1 << (53 - 32));
+ static const SK_OT_ULONG MSDOSIcelandic_861Mask = SkTEndian_SwapBE32(1 << (54 - 32));
+ static const SK_OT_ULONG MSDOSPortuguese_860Mask = SkTEndian_SwapBE32(1 << (55 - 32));
+ static const SK_OT_ULONG IBMTurkish_857Mask = SkTEndian_SwapBE32(1 << (56 - 32));
+ static const SK_OT_ULONG IBMCyrillic_855Mask = SkTEndian_SwapBE32(1 << (57 - 32));
+ static const SK_OT_ULONG Latin2_852Mask = SkTEndian_SwapBE32(1 << (58 - 32));
+ static const SK_OT_ULONG MSDOSBaltic_775Mask = SkTEndian_SwapBE32(1 << (59 - 32));
+ static const SK_OT_ULONG Greek_737Mask = SkTEndian_SwapBE32(1 << (60 - 32));
+ static const SK_OT_ULONG Arabic_708Mask = SkTEndian_SwapBE32(1 << (61 - 32));
+ static const SK_OT_ULONG WELatin1_850Mask = SkTEndian_SwapBE32(1 << (62 - 32));
+ static const SK_OT_ULONG US_437Mask = SkTEndian_SwapBE32(1 << (63 - 32));
+ };
+ SK_OT_ULONG value[2];
+ } raw;
+ } ulCodePageRange;
+ //version2
+ SK_OT_SHORT sxHeight;
+ SK_OT_SHORT sCapHeight;
+ SK_OT_USHORT usDefaultChar;
+ SK_OT_USHORT usBreakChar;
+ SK_OT_USHORT usMaxContext;
+};
+
+#pragma pack(pop)
+
+
+SK_COMPILE_ASSERT(sizeof(SkOTTableOS2_V4) == 96, sizeof_SkOTTableOS2_V4_not_96);
+
+#endif
diff --git a/src/sfnt/SkOTTable_OS_2_VA.h b/src/sfnt/SkOTTable_OS_2_VA.h
new file mode 100644
index 0000000000..22a022c2a6
--- /dev/null
+++ b/src/sfnt/SkOTTable_OS_2_VA.h
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkOTTable_OS_2_VA_DEFINED
+#define SkOTTable_OS_2_VA_DEFINED
+
+#include "SkEndian.h"
+#include "SkIBMFamilyClass.h"
+#include "SkOTTableTypes.h"
+#include "SkPanose.h"
+#include "SkTypedEnum.h"
+
+#pragma pack(push, 1)
+
+//Original V0 TT
+struct SkOTTableOS2_VA {
+ SK_OT_USHORT version;
+ //The only way to differentiate versionA and version0 is by size.
+ static const SK_OT_USHORT version0 = SkTEndian_SwapBE16(0);
+ SK_OT_SHORT xAvgCharWidth;
+ struct WeightClass {
+ SK_TYPED_ENUM(Value, SK_OT_USHORT,
+ ((UltraLight, SkTEndian_SwapBE16(1)))
+ ((ExtraLight, SkTEndian_SwapBE16(2)))
+ ((Light, SkTEndian_SwapBE16(3)))
+ ((SemiLight, SkTEndian_SwapBE16(4)))
+ ((Medium, SkTEndian_SwapBE16(5)))
+ ((SemiBold, SkTEndian_SwapBE16(6)))
+ ((Bold, SkTEndian_SwapBE16(7)))
+ ((ExtraBold, SkTEndian_SwapBE16(8)))
+ ((UltraBold, SkTEndian_SwapBE16(9)))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } usWeightClass;
+ struct WidthClass {
+ SK_TYPED_ENUM(Value, SK_OT_USHORT,
+ ((UltraCondensed, SkTEndian_SwapBE16(1)))
+ ((ExtraCondensed, SkTEndian_SwapBE16(2)))
+ ((Condensed, SkTEndian_SwapBE16(3)))
+ ((SemiCondensed, SkTEndian_SwapBE16(4)))
+ ((Medium, SkTEndian_SwapBE16(5)))
+ ((SemiExpanded, SkTEndian_SwapBE16(6)))
+ ((Expanded, SkTEndian_SwapBE16(7)))
+ ((ExtraExpanded, SkTEndian_SwapBE16(8)))
+ ((UltraExpanded, SkTEndian_SwapBE16(9)))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } usWidthClass;
+ union Type {
+ struct Field {
+ //8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved08,
+ Reserved09,
+ Reserved10,
+ Reserved11,
+ Reserved12,
+ Reserved13,
+ Reserved14,
+ Reserved15)
+ //0-7
+ SK_OT_BYTE_BITFIELD(
+ Reserved00,
+ Restricted,
+ PreviewPrint,
+ Editable,
+ Reserved04,
+ Reserved05,
+ Reserved06,
+ Reserved07)
+ } field;
+ struct Raw {
+ static const SK_OT_USHORT Installable = SkTEndian_SwapBE16(0);
+ static const SK_OT_USHORT RestrictedMask = SkTEndian_SwapBE16(1 << 1);
+ static const SK_OT_USHORT PreviewPrintMask = SkTEndian_SwapBE16(1 << 2);
+ static const SK_OT_USHORT EditableMask = SkTEndian_SwapBE16(1 << 3);
+ SK_OT_USHORT value;
+ } raw;
+ } fsType;
+ SK_OT_SHORT ySubscriptXSize;
+ SK_OT_SHORT ySubscriptYSize;
+ SK_OT_SHORT ySubscriptXOffset;
+ SK_OT_SHORT ySubscriptYOffset;
+ SK_OT_SHORT ySuperscriptXSize;
+ SK_OT_SHORT ySuperscriptYSize;
+ SK_OT_SHORT ySuperscriptXOffset;
+ SK_OT_SHORT ySuperscriptYOffset;
+ SK_OT_SHORT yStrikeoutSize;
+ SK_OT_SHORT yStrikeoutPosition;
+ SkIBMFamilyClass sFamilyClass;
+ SkPanose panose;
+ SK_OT_ULONG ulCharRange[4];
+ SK_OT_CHAR achVendID[4];
+ union Selection {
+ struct Field {
+ //8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved08,
+ Reserved09,
+ Reserved10,
+ Reserved11,
+ Reserved12,
+ Reserved13,
+ Reserved14,
+ Reserved15)
+ //0-7
+ SK_OT_BYTE_BITFIELD(
+ Italic,
+ Underscore,
+ Negative,
+ Outlined,
+ Strikeout,
+ Bold,
+ Reserved06,
+ Reserved07)
+ } field;
+ struct Raw {
+ static const SK_OT_USHORT ItalicMask = SkTEndian_SwapBE16(1 << 0);
+ static const SK_OT_USHORT UnderscoreMask = SkTEndian_SwapBE16(1 << 1);
+ static const SK_OT_USHORT NegativeMask = SkTEndian_SwapBE16(1 << 2);
+ static const SK_OT_USHORT OutlinedMask = SkTEndian_SwapBE16(1 << 3);
+ static const SK_OT_USHORT StrikeoutMask = SkTEndian_SwapBE16(1 << 4);
+ static const SK_OT_USHORT BoldMask = SkTEndian_SwapBE16(1 << 5);
+ SK_OT_USHORT value;
+ } raw;
+ } fsSelection;
+ SK_OT_USHORT usFirstCharIndex;
+ SK_OT_USHORT usLastCharIndex;
+};
+
+#pragma pack(pop)
+
+
+SK_COMPILE_ASSERT(sizeof(SkOTTableOS2_VA) == 68, sizeof_SkOTTableOS2_VA_not_68);
+
+#endif
diff --git a/src/sfnt/SkOTTable_head.h b/src/sfnt/SkOTTable_head.h
new file mode 100644
index 0000000000..2f1d69c82e
--- /dev/null
+++ b/src/sfnt/SkOTTable_head.h
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkOTTable_head_DEFINED
+#define SkOTTable_head_DEFINED
+
+#include "SkEndian.h"
+#include "SkOTTableTypes.h"
+#include "SkTypedEnum.h"
+
+#pragma pack(push, 1)
+
+struct SkOTTableHead {
+ SK_OT_Fixed version;
+ static const SK_OT_Fixed version1 = SkTEndian_SwapBE32(0x00010000);
+ SK_OT_Fixed fontRevision;
+ SK_OT_ULONG checkSumAdjustment;
+ SK_OT_ULONG magicNumber;
+ static const SK_OT_ULONG magicNumberConst = SkTEndian_SwapBE32(0x5F0F3CF5);
+ union Flags {
+ struct Field {
+ //8-15
+ SK_OT_BYTE_BITFIELD(
+ GXMetamorphosis_Apple,
+ HasStrongRTL_Apple,
+ HasIndicStyleRearrangement,
+ AgfaMicroTypeExpressProcessed,
+ FontConverted,
+ DesignedForClearType,
+ LastResort,
+ Reserved15)
+ //0-7
+ SK_OT_BYTE_BITFIELD(
+ BaselineAtY0,
+ LeftSidebearingAtX0,
+ InstructionsDependOnPointSize,
+ IntegerScaling,
+ InstructionsAlterAdvanceWidth,
+ VerticalCenteredGlyphs_Apple,
+ Reserved06,
+ RequiresLayout_Apple)
+ } field;
+ struct Raw {
+ static const SK_OT_USHORT BaselineAtY0Mask = SkTEndian_SwapBE16(1 << 0);
+ static const SK_OT_USHORT LeftSidebearingAtX0Mask = SkTEndian_SwapBE16(1 << 1);
+ static const SK_OT_USHORT InstructionsDependOnPointSizeMask = SkTEndian_SwapBE16(1 << 2);
+ static const SK_OT_USHORT IntegerScalingMask = SkTEndian_SwapBE16(1 << 3);
+ static const SK_OT_USHORT InstructionsAlterAdvanceWidthMask = SkTEndian_SwapBE16(1 << 4);
+ static const SK_OT_USHORT VerticalCenteredGlyphs_AppleMask = SkTEndian_SwapBE16(1 << 5);
+ //Reserved
+ static const SK_OT_USHORT RequiresLayout_AppleMask = SkTEndian_SwapBE16(1 << 7);
+
+ static const SK_OT_USHORT GXMetamorphosis_AppleMask = SkTEndian_SwapBE16(1 << 8);
+ static const SK_OT_USHORT HasStrongRTL_AppleMask = SkTEndian_SwapBE16(1 << 9);
+ static const SK_OT_USHORT HasIndicStyleRearrangementMask = SkTEndian_SwapBE16(1 << 10);
+ static const SK_OT_USHORT AgfaMicroTypeExpressProcessedMask = SkTEndian_SwapBE16(1 << 11);
+ static const SK_OT_USHORT FontConvertedMask = SkTEndian_SwapBE16(1 << 12);
+ static const SK_OT_USHORT DesignedForClearTypeMask = SkTEndian_SwapBE16(1 << 13);
+ static const SK_OT_USHORT LastResortMask = SkTEndian_SwapBE16(1 << 14);
+ //Reserved
+ SK_OT_USHORT value;
+ } raw;
+ } flags;
+ SK_OT_USHORT unitsPerEm;
+ SK_OT_LONGDATETIME created;
+ SK_OT_LONGDATETIME modified;
+ SK_OT_SHORT xMin;
+ SK_OT_SHORT yMin;
+ SK_OT_SHORT xMax;
+ SK_OT_SHORT yMax;
+ union MacStyle {
+ struct Field {
+ //8-15
+ SK_OT_BYTE_BITFIELD(
+ Reserved08,
+ Reserved09,
+ Reserved10,
+ Reserved11,
+ Reserved12,
+ Reserved13,
+ Reserved14,
+ Reserved15)
+ //0-7
+ SK_OT_BYTE_BITFIELD(
+ Bold,
+ Italic,
+ Underline,
+ Outline,
+ Shadow,
+ Condensed,
+ Extended,
+ Reserved07)
+ } field;
+ struct Raw {
+ static const SK_OT_USHORT BoldMask = SkTEndian_SwapBE16(1);
+ static const SK_OT_USHORT ItalicMask = SkTEndian_SwapBE16(1 << 1);
+ static const SK_OT_USHORT UnderlineMask = SkTEndian_SwapBE16(1 << 2);
+ static const SK_OT_USHORT OutlineMask = SkTEndian_SwapBE16(1 << 3);
+ static const SK_OT_USHORT ShadowMask = SkTEndian_SwapBE16(1 << 4);
+ static const SK_OT_USHORT CondensedMask = SkTEndian_SwapBE16(1 << 5);
+ static const SK_OT_USHORT ExtendedMask = SkTEndian_SwapBE16(1 << 6);
+
+ SK_OT_USHORT value;
+ } raw;
+ } macStyle;
+ SK_OT_USHORT lowestRecPPEM;
+ struct FontDirectionHint {
+ SK_TYPED_ENUM(Value, SK_OT_SHORT,
+ ((FullyMixedDirectionalGlyphs, SkTEndian_SwapBE16(0)))
+ ((OnlyStronglyLTR, SkTEndian_SwapBE16(1)))
+ ((StronglyLTR, SkTEndian_SwapBE16(2)))
+ ((OnlyStronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16(-1))))
+ ((StronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16(-2))))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } fontDirectionHint;
+ struct IndexToLocFormat {
+ SK_TYPED_ENUM(Value, SK_OT_SHORT,
+ ((ShortOffsets, SkTEndian_SwapBE16(0)))
+ ((LongOffsets, SkTEndian_SwapBE16(1)))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } indexToLocFormat;
+ struct GlyphDataFormat {
+ SK_TYPED_ENUM(Value, SK_OT_SHORT,
+ ((CurrentFormat, SkTEndian_SwapBE16(0)))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } glyphDataFormat;
+};
+
+#pragma pack(pop)
+
+
+#include <stddef.h>
+SK_COMPILE_ASSERT(offsetof(SkOTTableHead, glyphDataFormat) == 52, SkOTTableHead_glyphDataFormat_not_at_52);
+SK_COMPILE_ASSERT(sizeof(SkOTTableHead) == 54, sizeof_SkOTTableHead_not_54);
+
+#endif
diff --git a/src/sfnt/SkOTTable_hhea.h b/src/sfnt/SkOTTable_hhea.h
new file mode 100644
index 0000000000..0874bfd5da
--- /dev/null
+++ b/src/sfnt/SkOTTable_hhea.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkOTTable_hhea_DEFINED
+#define SkOTTable_hhea_DEFINED
+
+#include "SkEndian.h"
+#include "SkOTTableTypes.h"
+#include "SkTypedEnum.h"
+
+#pragma pack(push, 1)
+
+struct SkOTTableHorizontalHeader {
+ SK_OT_Fixed version;
+ static const SK_OT_Fixed version1 = SkTEndian_SwapBE32(0x00010000);
+ SK_OT_FWORD Ascender;
+ SK_OT_FWORD Descender;
+ SK_OT_FWORD LineGap;
+ SK_OT_UFWORD advanceWidthMax;
+ SK_OT_FWORD minLeftSideBearing;
+ SK_OT_FWORD minRightSideBearing;
+ SK_OT_FWORD xMaxExtent;
+ SK_OT_SHORT caretSlopeRise;
+ SK_OT_SHORT caretSlopeRun;
+ SK_OT_SHORT caretOffset;
+ SK_OT_SHORT Reserved24;
+ SK_OT_SHORT Reserved26;
+ SK_OT_SHORT Reserved28;
+ SK_OT_SHORT Reserved30;
+ struct MetricDataFormat {
+ SK_TYPED_ENUM(Value, SK_OT_SHORT,
+ ((CurrentFormat, SkTEndian_SwapBE16(0)))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } metricDataFormat;
+ SK_OT_USHORT numberOfHMetrics;
+};
+
+#pragma pack(pop)
+
+
+#include <stddef.h>
+SK_COMPILE_ASSERT(offsetof(SkOTTableHorizontalHeader, numberOfHMetrics) == 34, SkOTTableHorizontalHeader_numberOfHMetrics_not_at_34);
+SK_COMPILE_ASSERT(sizeof(SkOTTableHorizontalHeader) == 36, sizeof_SkOTTableHorizontalHeader_not_36);
+
+#endif
diff --git a/src/sfnt/SkOTTable_post.h b/src/sfnt/SkOTTable_post.h
new file mode 100644
index 0000000000..a5525d4780
--- /dev/null
+++ b/src/sfnt/SkOTTable_post.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkOTTable_post_DEFINED
+#define SkOTTable_post_DEFINED
+
+#include "SkEndian.h"
+#include "SkOTTableTypes.h"
+#include "SkTypedEnum.h"
+
+#pragma pack(push, 1)
+
+struct SkOTTablePostScript {
+ struct Format {
+ SK_TYPED_ENUM(Value, SK_OT_Fixed,
+ ((version1, SkTEndian_SwapBE32(0x00010000)))
+ ((version2, SkTEndian_SwapBE32(0x00020000)))
+ ((version2_5, SkTEndian_SwapBE32(0x00025000)))
+ ((version3, SkTEndian_SwapBE32(0x00030000)))
+ ((version4, SkTEndian_SwapBE32(0x00040000)))
+ SK_SEQ_END,
+ SK_SEQ_END)
+ SK_OT_Fixed value;
+ } format;
+ SK_OT_Fixed italicAngle;
+ SK_OT_FWORD underlinePosition;
+ SK_OT_FWORD underlineThickness;
+ SK_OT_ULONG isFixedPitch;
+ SK_OT_ULONG minMemType42;
+ SK_OT_ULONG maxMemType42;
+ SK_OT_ULONG minMemType1;
+ SK_OT_ULONG maxMemType1;
+};
+
+#pragma pack(pop)
+
+
+#include <stddef.h>
+SK_COMPILE_ASSERT(offsetof(SkOTTablePostScript, maxMemType1) == 28, SkOTTablePostScript_maxMemType1_not_at_28);
+SK_COMPILE_ASSERT(sizeof(SkOTTablePostScript) == 32, sizeof_SkOTTablePostScript_not_32);
+
+#endif
diff --git a/src/sfnt/SkPanose.h b/src/sfnt/SkPanose.h
new file mode 100644
index 0000000000..873c093f5e
--- /dev/null
+++ b/src/sfnt/SkPanose.h
@@ -0,0 +1,639 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkPanose_DEFINED
+#define SkPanose_DEFINED
+
+#include "SkOTTableTypes.h"
+#include "SkTypedEnum.h"
+
+#pragma pack(push, 1)
+
+struct SkPanose {
+ //This value changes the meaning of the following 9 bytes.
+ struct FamilyType {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((TextAndDisplay, 2))
+ ((Script, 3))
+ ((Decorative, 4))
+ ((Pictoral, 5))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bFamilyType;
+
+ union Data {
+ struct TextAndDisplay {
+ struct SerifStyle {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((Cove, 2))
+ ((ObtuseCove, 3))
+ ((SquareCove, 4))
+ ((ObtuseSquareCove, 5))
+ ((Square, 6))
+ ((Thin, 7))
+ ((Bone, 8))
+ ((Exaggerated, 9))
+ ((Triangle, 10))
+ ((NormalSans, 11))
+ ((ObtuseSans, 12))
+ ((PerpSans, 13))
+ ((Flared, 14))
+ ((Rounded, 15))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bSerifStyle;
+
+ struct Weight {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((VeryLight, 2))
+ ((Light, 3))
+ ((Thin, 4))
+ ((Book, 5))
+ ((Medium, 6))
+ ((Demi, 7))
+ ((Bold, 8))
+ ((Heavy, 9))
+ ((Black, 10))
+ ((ExtraBlack, 11))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bWeight;
+
+ struct Proportion {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((OldStyle, 2))
+ ((Modern, 3))
+ ((EvenWidth, 4))
+ ((Expanded, 5))
+ ((Condensed, 6))
+ ((VeryExpanded, 7))
+ ((VeryCondensed, 8))
+ ((Monospaced, 9))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bProportion;
+
+ struct Contrast {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((None, 2))
+ ((VeryLow, 3))
+ ((Low, 4))
+ ((MediumLow, 5))
+ ((Medium, 6))
+ ((MediumHigh, 7))
+ ((High, 8))
+ ((VeryHigh, 9))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bContrast;
+
+#ifdef SK_WIN_PANOSE
+ //This is what Windows (and FontForge and Apple TT spec) define.
+ //The Impact font uses 9.
+ struct StrokeVariation {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((GradualDiagonal, 2))
+ ((GradualTransitional, 3))
+ ((GradualVertical, 4))
+ ((GradualHorizontal, 5))
+ ((RapidVertical, 6))
+ ((RapidHorizontal, 7))
+ ((InstantVertical, 8))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bStrokeVariation;
+#else
+ //Stroke variation description in OT OS/2 ver0,ver1 is incorrect.
+ //This is what HP Panose says.
+ struct StrokeVariation {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((NoVariation, 2))
+ ((Gradual_Diagonal, 3))
+ ((Gradual_Transitional, 4))
+ ((Gradual_Vertical, 5))
+ ((Gradual_Horizontal, 6))
+ ((Rapid_Vertical, 7))
+ ((Rapid_Horizontal, 8))
+ ((Instant_Vertical, 9))
+ ((Instant_Horizontal, 10))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bStrokeVariation;
+#endif
+
+ struct ArmStyle {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((StraightArms_Horizontal, 2))
+ ((StraightArms_Wedge, 3))
+ ((StraightArms_Vertical, 4))
+ ((StraightArms_SingleSerif, 5))
+ ((StraightArms_DoubleSerif, 6))
+ ((NonStraightArms_Horizontal, 7))
+ ((NonStraightArms_Wedge, 8))
+ ((NonStraightArms_Vertical, 9))
+ ((NonStraightArms_SingleSerif, 10))
+ ((NonStraightArms_DoubleSerif, 11))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bArmStyle;
+
+ struct Letterform {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((Normal_Contact, 2))
+ ((Normal_Weighted, 3))
+ ((Normal_Boxed, 4))
+ ((Normal_Flattened, 5))
+ ((Normal_Rounded, 6))
+ ((Normal_OffCenter, 7))
+ ((Normal_Square, 8))
+ ((Oblique_Contact, 9))
+ ((Oblique_Weighted, 10))
+ ((Oblique_Boxed, 11))
+ ((Oblique_Flattened, 12))
+ ((Oblique_Rounded, 13))
+ ((Oblique_OffCenter, 14))
+ ((Oblique_Square, 15))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bLetterform;
+
+ struct Midline {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((Standard_Trimmed, 2))
+ ((Standard_Pointed, 3))
+ ((Standard_Serifed, 4))
+ ((High_Trimmed, 5))
+ ((High_Pointed, 6))
+ ((High_Serifed, 7))
+ ((Constant_Trimmed, 8))
+ ((Constant_Pointed, 9))
+ ((Constant_Serifed, 10))
+ ((Low_Trimmed, 11))
+ ((Low_Pointed, 12))
+ ((Low_Serifed, 13))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bMidline;
+
+ struct XHeight {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((Constant_Small, 2))
+ ((Constant_Standard, 3))
+ ((Constant_Large, 4))
+ ((Ducking_Small, 5))
+ ((Ducking_Standard, 6))
+ ((Ducking_Large, 7))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bXHeight;
+ } textAndDisplay;
+
+ struct Script {
+ struct ToolKind {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((FlatNib, 2))
+ ((PressurePoint, 3))
+ ((Engraved, 4))
+ ((Ball, 5))
+ ((Brush, 6))
+ ((Rough, 7))
+ ((FeltPen, 8))
+ ((WildBrush, 9))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bToolKind;
+
+ struct Weight {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((VeryLight, 2))
+ ((Light, 3))
+ ((Thin, 4))
+ ((Book, 5))
+ ((Medium, 6))
+ ((Demi, 7))
+ ((Bold, 8))
+ ((Heavy, 9))
+ ((Black, 10))
+ ((ExtraBlack, 11))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bWeight;
+
+ struct Spacing {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((ProportionalSpaced, 2))
+ ((Monospaced, 3))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bSpacing;
+
+ struct AspectRatio {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((VeryCondensed, 2))
+ ((Condensed, 3))
+ ((Normal, 4))
+ ((Expanded, 5))
+ ((VeryExpanded, 6))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bAspectRatio;
+
+ struct Contrast {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((None, 2))
+ ((VeryLow, 3))
+ ((Low, 4))
+ ((MediumLow, 5))
+ ((Medium, 6))
+ ((MediumHigh, 7))
+ ((High, 8))
+ ((VeryHigh, 9))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bContrast;
+
+ struct Topology {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((Roman_Disconnected, 2))
+ ((Roman_Trailing, 3))
+ ((Roman_Connected, 4))
+ ((Cursive_Disconnected, 5))
+ ((Cursive_Trailing, 6))
+ ((Cursive_Connected, 7))
+ ((Blackletter_Disconnected, 8))
+ ((Blackletter_Trailing, 9))
+ ((Blackletter_Connected, 10))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bTopology;
+
+ struct Form {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((Upright_NoWrapping, 2))
+ ((Upright_SomeWrapping, 3))
+ ((Upright_MoreWrapping, 4))
+ ((Upright_ExtremeWrapping, 5))
+ ((Oblique_NoWrapping, 6))
+ ((Oblique_SomeWrapping, 7))
+ ((Oblique_MoreWrapping, 8))
+ ((Oblique_ExtremeWrapping, 9))
+ ((Exaggerated_NoWrapping, 10))
+ ((Exaggerated_SomeWrapping, 11))
+ ((Exaggerated_MoreWrapping, 12))
+ ((Exaggerated_ExtremeWrapping, 13))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bForm;
+
+ struct Finials {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((None_NoLoops, 2))
+ ((None_ClosedLoops, 3))
+ ((None_OpenLoops, 4))
+ ((Sharp_NoLoops, 5))
+ ((Sharp_ClosedLoops, 6))
+ ((Sharp_OpenLoops, 7))
+ ((Tapered_NoLoops, 8))
+ ((Tapered_ClosedLoops, 9))
+ ((Tapered_OpenLoops, 10))
+ ((Round_NoLoops, 11))
+ ((Round_ClosedLoops, 12))
+ ((Round_OpenLoops, 13))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bFinials;
+
+ struct XAscent {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((VeryLow, 2))
+ ((Low, 3))
+ ((Medium, 4))
+ ((High, 5))
+ ((VeryHigh, 6))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bXAscent;
+ } script;
+
+ struct Decorative {
+ struct Class {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((Derivative, 2))
+ ((NonStandard_Topology, 3))
+ ((NonStandard_Elements, 4))
+ ((NonStandard_Aspect, 5))
+ ((Initials, 6))
+ ((Cartoon, 7))
+ ((PictureStems, 8))
+ ((Ornamented, 9))
+ ((TextAndBackground, 10))
+ ((Collage, 11))
+ ((Montage, 12))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bClass;
+
+ struct Weight {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((VeryLight, 2))
+ ((Light, 3))
+ ((Thin, 4))
+ ((Book, 5))
+ ((Medium, 6))
+ ((Demi, 7))
+ ((Bold, 8))
+ ((Heavy, 9))
+ ((Black, 10))
+ ((ExtraBlack, 11))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bWeight;
+
+ struct Aspect {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((SuperCondensed, 2))
+ ((VeryCondensed, 3))
+ ((Condensed, 4))
+ ((Normal, 5))
+ ((Extended, 6))
+ ((VeryExtended, 7))
+ ((SuperExtended, 8))
+ ((Monospaced, 9))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bAspect;
+
+ struct Contrast {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((None, 2))
+ ((VeryLow, 3))
+ ((Low, 4))
+ ((MediumLow, 5))
+ ((Medium, 6))
+ ((MediumHigh, 7))
+ ((High, 8))
+ ((VeryHigh, 9))
+ ((HorizontalLow, 10))
+ ((HorizontalMedium, 11))
+ ((HorizontalHigh, 12))
+ ((Broken, 13))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bContrast;
+
+ struct SerifVariant {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((Cove, 2))
+ ((ObtuseCove, 3))
+ ((SquareCove, 4))
+ ((ObtuseSquareCove, 5))
+ ((Square, 6))
+ ((Thin, 7))
+ ((Oval, 8))
+ ((Exaggerated, 9))
+ ((Triangle, 10))
+ ((NormalSans, 11))
+ ((ObtuseSans, 12))
+ ((PerpendicularSans, 13))
+ ((Flared, 14))
+ ((Rounded, 15))
+ ((Script, 16))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bSerifVariant;
+
+ struct Treatment {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((None_StandardSolidFill, 2))
+ ((White_NoFill, 3))
+ ((PatternedFill, 4))
+ ((ComplexFill, 5))
+ ((ShapedFill, 6))
+ ((DrawnDistressed, 7))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bTreatment;
+
+ struct Lining {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((None, 2))
+ ((Inline, 3))
+ ((Outline, 4))
+ ((Engraved, 5))
+ ((Shadow, 6))
+ ((Relief, 7))
+ ((Backdrop, 8))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bLining;
+
+ struct Topology {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((Standard, 2))
+ ((Square, 3))
+ ((MultipleSegment, 4))
+ ((DecoWacoMidlines, 5))
+ ((UnevenWeighting, 6))
+ ((DiverseArms, 7))
+ ((DiverseForms, 8))
+ ((LombardicForms, 9))
+ ((UpperCaseInLowerCase, 10))
+ ((ImpliedTopology, 11))
+ ((HorseshoeEandA, 12))
+ ((Cursive, 13))
+ ((Blackletter, 14))
+ ((SwashVariance, 15))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bTopology;
+
+ struct RangeOfCharacters {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((ExtendedCollection, 2))
+ ((Litterals, 3))
+ ((NoLowerCase, 4))
+ ((SmallCaps, 5))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bRangeOfCharacters;
+ } decorative;
+
+ struct Pictoral {
+ struct Kind {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((Montages, 2))
+ ((Pictures, 3))
+ ((Shapes, 4))
+ ((Scientific, 5))
+ ((Music, 6))
+ ((Expert, 7))
+ ((Patterns, 8))
+ ((Boarders, 9))
+ ((Icons, 10))
+ ((Logos, 11))
+ ((IndustrySpecific, 12))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bKind;
+
+ struct Weight {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((NoFit, 1))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bWeight;
+
+ struct Spacing {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((ProportionalSpaced, 2))
+ ((Monospaced, 3))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bSpacing;
+
+ struct AspectRatioAndContrast {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((NoFit, 1))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bAspectRatioAndContrast;
+
+ struct AspectRatio94 {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((NoWidth, 2))
+ ((ExceptionallyWide, 3))
+ ((SuperWide, 4))
+ ((VeryWide, 5))
+ ((Wide, 6))
+ ((Normal, 7))
+ ((Narrow, 8))
+ ((VeryNarrow, 9))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bAspectRatio94;
+
+ struct AspectRatio119 {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((NoWidth, 2))
+ ((ExceptionallyWide, 3))
+ ((SuperWide, 4))
+ ((VeryWide, 5))
+ ((Wide, 6))
+ ((Normal, 7))
+ ((Narrow, 8))
+ ((VeryNarrow, 9))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bAspectRatio119;
+
+ struct AspectRatio157 {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((NoWidth, 2))
+ ((ExceptionallyWide, 3))
+ ((SuperWide, 4))
+ ((VeryWide, 5))
+ ((Wide, 6))
+ ((Normal, 7))
+ ((Narrow, 8))
+ ((VeryNarrow, 9))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bAspectRatio157;
+
+ struct AspectRatio163 {
+ SK_TYPED_ENUM(Value, SK_OT_BYTE,
+ ((Any, 0))
+ ((NoFit, 1))
+ ((NoWidth, 2))
+ ((ExceptionallyWide, 3))
+ ((SuperWide, 4))
+ ((VeryWide, 5))
+ ((Wide, 6))
+ ((Normal, 7))
+ ((Narrow, 8))
+ ((VeryNarrow, 9))
+ SK_SEQ_END,
+ (value)SK_SEQ_END)
+ } bAspectRatio163;
+ } pictoral;
+ } data;
+};
+
+#pragma pack(pop)
+
+
+SK_COMPILE_ASSERT(sizeof(SkPanose) == 10, sizeof_SkPanose_not_10);
+
+#endif
diff --git a/src/sfnt/SkPreprocessorSeq.h b/src/sfnt/SkPreprocessorSeq.h
new file mode 100644
index 0000000000..b9a821a5e1
--- /dev/null
+++ b/src/sfnt/SkPreprocessorSeq.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkPreprocessorSeq_DEFINED
+#define SkPreprocessorSeq_DEFINED
+
+#define SK_CONCAT(a, b) SK_CONCAT_I(a, b) // allow for macro expansion
+#define SK_CONCAT_I(a, b) a ## b
+
+//A preprocessor pair is of the form '(a, b)'
+#define SK_PAIR_FIRST(pair) SK_PAIR_FIRST_I pair
+#define SK_PAIR_FIRST_I(a, b) a
+#define SK_PAIR_SECOND(pair) SK_PAIR_SECOND_I pair
+#define SK_PAIR_SECOND_I(a, b) b
+
+//A preprocessor sequence is of the form (a)(b)(c)SK_SEQ_END
+#if 0
+//The following is what we logically want to do.
+//However, MSVC expands macros at the wrong time, causing an error on use of
+//SK_SEQ_IGNORE_SECOND_I because it formally takes two parameters, but we only
+//pass "one" parameter in SK_SEQ_IGNORE_SECOND.
+
+#define SK_SEQ_HEAD(seq) SK_SEQ_IGNORE_SECOND(SK_SEQ_FIRST seq)
+#define SK_SEQ_IGNORE_SECOND(x) SK_SEQ_IGNORE_SECOND_I(x) // expand x
+#define SK_SEQ_IGNORE_SECOND_I(x, _) x
+#define SK_SEQ_FIRST(x) x, SK_NIL
+
+#else
+
+//This is less obvious, but works on GCC, clang, and MSVC.
+#define SK_SEQ_HEAD(seq) SK_SEQ_HEAD_II((SK_SEQ_FIRST seq))
+#define SK_SEQ_HEAD_II(x) SK_SEQ_IGNORE_SECOND_I x
+#define SK_SEQ_IGNORE_SECOND_I(x, _) x
+#define SK_SEQ_FIRST(x) x, SK_NIL
+
+#endif
+
+#define SK_SEQ_TAIL(seq) SK_SEQ_TAIL_I seq
+#define SK_SEQ_TAIL_I(x)
+
+#define SK_SEQ_SIZE(seq) SK_CONCAT(SK_SEQ_SIZE_, SK_SEQ_SIZE_TERMINATOR seq)
+
+#define SK_SEQ_SIZE_TERMINATOR(_) SK_SEQ_SIZE_0
+#define SK_SEQ_SIZE_0(_) SK_SEQ_SIZE_1
+#define SK_SEQ_SIZE_1(_) SK_SEQ_SIZE_2
+#define SK_SEQ_SIZE_2(_) SK_SEQ_SIZE_3
+#define SK_SEQ_SIZE_3(_) SK_SEQ_SIZE_4
+#define SK_SEQ_SIZE_4(_) SK_SEQ_SIZE_5
+#define SK_SEQ_SIZE_5(_) SK_SEQ_SIZE_6
+#define SK_SEQ_SIZE_6(_) SK_SEQ_SIZE_7
+#define SK_SEQ_SIZE_7(_) SK_SEQ_SIZE_8
+#define SK_SEQ_SIZE_8(_) SK_SEQ_SIZE_9
+#define SK_SEQ_SIZE_9(_) SK_SEQ_SIZE_10
+#define SK_SEQ_SIZE_10(_) SK_SEQ_SIZE_11
+#define SK_SEQ_SIZE_11(_) SK_SEQ_SIZE_12
+#define SK_SEQ_SIZE_12(_) SK_SEQ_SIZE_13
+#define SK_SEQ_SIZE_13(_) SK_SEQ_SIZE_14
+#define SK_SEQ_SIZE_14(_) SK_SEQ_SIZE_15
+#define SK_SEQ_SIZE_15(_) SK_SEQ_SIZE_16
+#define SK_SEQ_SIZE_16(_) SK_SEQ_SIZE_17
+
+#define SK_SEQ_SIZE_SK_SEQ_SIZE_0 0
+#define SK_SEQ_SIZE_SK_SEQ_SIZE_1 1
+#define SK_SEQ_SIZE_SK_SEQ_SIZE_2 2
+#define SK_SEQ_SIZE_SK_SEQ_SIZE_3 3
+#define SK_SEQ_SIZE_SK_SEQ_SIZE_4 4
+#define SK_SEQ_SIZE_SK_SEQ_SIZE_5 5
+#define SK_SEQ_SIZE_SK_SEQ_SIZE_6 6
+#define SK_SEQ_SIZE_SK_SEQ_SIZE_7 7
+#define SK_SEQ_SIZE_SK_SEQ_SIZE_8 8
+#define SK_SEQ_SIZE_SK_SEQ_SIZE_9 9
+#define SK_SEQ_SIZE_SK_SEQ_SIZE_10 10
+#define SK_SEQ_SIZE_SK_SEQ_SIZE_11 11
+#define SK_SEQ_SIZE_SK_SEQ_SIZE_12 12
+#define SK_SEQ_SIZE_SK_SEQ_SIZE_13 13
+#define SK_SEQ_SIZE_SK_SEQ_SIZE_14 14
+#define SK_SEQ_SIZE_SK_SEQ_SIZE_15 15
+#define SK_SEQ_SIZE_SK_SEQ_SIZE_16 16
+#define SK_SEQ_SIZE_SK_SEQ_SIZE_17 17
+
+#define SK_SEQ_FOREACH(op, data, seq) SK_SEQ_FOREACH_L(op, op, data, seq)
+#define SK_SEQ_FOREACH_L(op, lop, data, seq) SK_CONCAT(SK_SEQ_FOREACH_, SK_SEQ_SIZE(seq)) (op, lop, data, SK_SEQ_HEAD(seq), SK_SEQ_TAIL(seq))
+
+#define SK_SEQ_FOREACH_0(op,lop,d,x,t)
+#define SK_SEQ_FOREACH_1(op,lop,d,x,t) lop(d,x)
+#define SK_SEQ_FOREACH_2(op,lop,d,x,t) op(d,x) SK_SEQ_FOREACH_1(op, lop, d, SK_SEQ_HEAD(t), SK_SEQ_TAIL(t))
+#define SK_SEQ_FOREACH_3(op,lop,d,x,t) op(d,x) SK_SEQ_FOREACH_2(op, lop, d, SK_SEQ_HEAD(t), SK_SEQ_TAIL(t))
+#define SK_SEQ_FOREACH_4(op,lop,d,x,t) op(d,x) SK_SEQ_FOREACH_3(op, lop, d, SK_SEQ_HEAD(t), SK_SEQ_TAIL(t))
+#define SK_SEQ_FOREACH_5(op,lop,d,x,t) op(d,x) SK_SEQ_FOREACH_4(op, lop, d, SK_SEQ_HEAD(t), SK_SEQ_TAIL(t))
+#define SK_SEQ_FOREACH_6(op,lop,d,x,t) op(d,x) SK_SEQ_FOREACH_5(op, lop, d, SK_SEQ_HEAD(t), SK_SEQ_TAIL(t))
+#define SK_SEQ_FOREACH_7(op,lop,d,x,t) op(d,x) SK_SEQ_FOREACH_6(op, lop, d, SK_SEQ_HEAD(t), SK_SEQ_TAIL(t))
+#define SK_SEQ_FOREACH_8(op,lop,d,x,t) op(d,x) SK_SEQ_FOREACH_7(op, lop, d, SK_SEQ_HEAD(t), SK_SEQ_TAIL(t))
+#define SK_SEQ_FOREACH_9(op,lop,d,x,t) op(d,x) SK_SEQ_FOREACH_8(op, lop, d, SK_SEQ_HEAD(t), SK_SEQ_TAIL(t))
+#define SK_SEQ_FOREACH_10(op,lop,d,x,t) op(d,x) SK_SEQ_FOREACH_9(op, lop, d, SK_SEQ_HEAD(t), SK_SEQ_TAIL(t))
+#define SK_SEQ_FOREACH_11(op,lop,d,x,t) op(d,x) SK_SEQ_FOREACH_10(op, lop, d, SK_SEQ_HEAD(t), SK_SEQ_TAIL(t))
+#define SK_SEQ_FOREACH_12(op,lop,d,x,t) op(d,x) SK_SEQ_FOREACH_11(op, lop, d, SK_SEQ_HEAD(t), SK_SEQ_TAIL(t))
+#define SK_SEQ_FOREACH_13(op,lop,d,x,t) op(d,x) SK_SEQ_FOREACH_12(op, lop, d, SK_SEQ_HEAD(t), SK_SEQ_TAIL(t))
+#define SK_SEQ_FOREACH_14(op,lop,d,x,t) op(d,x) SK_SEQ_FOREACH_13(op, lop, d, SK_SEQ_HEAD(t), SK_SEQ_TAIL(t))
+#define SK_SEQ_FOREACH_15(op,lop,d,x,t) op(d,x) SK_SEQ_FOREACH_14(op, lop, d, SK_SEQ_HEAD(t), SK_SEQ_TAIL(t))
+#define SK_SEQ_FOREACH_16(op,lop,d,x,t) op(d,x) SK_SEQ_FOREACH_15(op, lop, d, SK_SEQ_HEAD(t), SK_SEQ_TAIL(t))
+#define SK_SEQ_FOREACH_17(op,lop,d,x,t) op(d,x) SK_SEQ_FOREACH_16(op, lop, d, SK_SEQ_HEAD(t), SK_SEQ_TAIL(t))
+
+#define SK_SEQ_END (SK_NIL)
+
+#endif
diff --git a/src/sfnt/SkTypedEnum.h b/src/sfnt/SkTypedEnum.h
new file mode 100644
index 0000000000..ac2f5e0c23
--- /dev/null
+++ b/src/sfnt/SkTypedEnum.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkTypedEnum_DEFINED
+#define SkTypedEnum_DEFINED
+
+#include "SkPreprocessorSeq.h"
+
+//Compatibility with non-clang compilers.
+#ifndef __has_feature
+ #define __has_feature(x) 0
+#endif
+#ifndef __has_extension
+ #define __has_extension __has_feature
+#endif
+
+//Detect if typed enums are supported.
+#if defined(_MSC_VER) && _MSC_VER >= 1400
+ #define SK_TYPED_ENUMS
+
+#elif defined(__clang__) && __has_extension(cxx_strong_enums)
+ #define SK_TYPED_ENUMS
+
+// Scoped enums are buggy in GCC 4.4.0 through 4.5.1.
+// See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064
+// __cplusplus should actually be accurate now.
+// See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1773
+#elif defined(__GNUC__) && (((__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ >= 40501) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || __cplusplus >= 201103L)
+ #define SK_TYPED_ENUMS
+#endif
+
+//Define what a typed enum looks like.
+#ifdef SK_TYPED_ENUMS
+
+ #define SK_TYPED_ENUM_VALUES(data, elem) \
+ SK_PAIR_FIRST(elem) = SK_PAIR_SECOND(elem),
+
+ #define SK_TYPED_ENUM_IDS(data, elem) \
+ elem,
+
+ #define SK_TYPED_ENUM_IDS_L(data, elem) \
+ elem
+
+ #define SK_TYPED_ENUM(enumName, enumType, enumSeq, idSeq) \
+ enum enumName : enumType { \
+ SK_SEQ_FOREACH(SK_TYPED_ENUM_VALUES, _, enumSeq) \
+ } SK_SEQ_FOREACH_L(SK_TYPED_ENUM_IDS, SK_TYPED_ENUM_IDS_L, _, idSeq);
+
+#else
+
+ #define SK_TYPED_ENUM_VALUES(enumType, elem) \
+ static const enumType SK_PAIR_FIRST(elem) = SK_PAIR_SECOND(elem);
+
+ #define SK_TYPED_ENUM_IDS(enumType, elem) \
+ enumType elem;
+
+ #define SK_TYPED_ENUM(enumName, enumType, enumSeq, idSeq) \
+ SK_SEQ_FOREACH(SK_TYPED_ENUM_VALUES, enumType, enumSeq) \
+ SK_SEQ_FOREACH(SK_TYPED_ENUM_IDS, enumType, idSeq)
+
+#endif
+
+#endif