1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/sfnt/SkOTTable_head.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,150 @@ 1.4 +/* 1.5 + * Copyright 2012 Google Inc. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license that can be 1.8 + * found in the LICENSE file. 1.9 + */ 1.10 + 1.11 +#ifndef SkOTTable_head_DEFINED 1.12 +#define SkOTTable_head_DEFINED 1.13 + 1.14 +#include "SkEndian.h" 1.15 +#include "SkOTTableTypes.h" 1.16 +#include "SkTypedEnum.h" 1.17 + 1.18 +#pragma pack(push, 1) 1.19 + 1.20 +struct SkOTTableHead { 1.21 + static const SK_OT_CHAR TAG0 = 'h'; 1.22 + static const SK_OT_CHAR TAG1 = 'e'; 1.23 + static const SK_OT_CHAR TAG2 = 'a'; 1.24 + static const SK_OT_CHAR TAG3 = 'd'; 1.25 + static const SK_OT_ULONG TAG = SkOTTableTAG<SkOTTableHead>::value; 1.26 + 1.27 + SK_OT_Fixed version; 1.28 + static const SK_OT_Fixed version1 = SkTEndian_SwapBE32(0x00010000); 1.29 + SK_OT_Fixed fontRevision; 1.30 + static const uint32_t fontChecksum = 0xB1B0AFBA; //checksum of all TT fonts 1.31 + SK_OT_ULONG checksumAdjustment; 1.32 + SK_OT_ULONG magicNumber; 1.33 + static const SK_OT_ULONG magicNumberConst = SkTEndian_SwapBE32(0x5F0F3CF5); 1.34 + union Flags { 1.35 + struct Field { 1.36 + //8-15 1.37 + SK_OT_BYTE_BITFIELD( 1.38 + GXMetamorphosis_Apple, 1.39 + HasStrongRTL_Apple, 1.40 + HasIndicStyleRearrangement, 1.41 + AgfaMicroTypeExpressProcessed, 1.42 + FontConverted, 1.43 + DesignedForClearType, 1.44 + LastResort, 1.45 + Reserved15) 1.46 + //0-7 1.47 + SK_OT_BYTE_BITFIELD( 1.48 + BaselineAtY0, 1.49 + LeftSidebearingAtX0, 1.50 + InstructionsDependOnPointSize, 1.51 + IntegerScaling, 1.52 + InstructionsAlterAdvanceWidth, 1.53 + VerticalCenteredGlyphs_Apple, 1.54 + Reserved06, 1.55 + RequiresLayout_Apple) 1.56 + } field; 1.57 + struct Raw { 1.58 + static const SK_OT_USHORT BaselineAtY0Mask = SkTEndian_SwapBE16(1 << 0); 1.59 + static const SK_OT_USHORT LeftSidebearingAtX0Mask = SkTEndian_SwapBE16(1 << 1); 1.60 + static const SK_OT_USHORT InstructionsDependOnPointSizeMask = SkTEndian_SwapBE16(1 << 2); 1.61 + static const SK_OT_USHORT IntegerScalingMask = SkTEndian_SwapBE16(1 << 3); 1.62 + static const SK_OT_USHORT InstructionsAlterAdvanceWidthMask = SkTEndian_SwapBE16(1 << 4); 1.63 + static const SK_OT_USHORT VerticalCenteredGlyphs_AppleMask = SkTEndian_SwapBE16(1 << 5); 1.64 + //Reserved 1.65 + static const SK_OT_USHORT RequiresLayout_AppleMask = SkTEndian_SwapBE16(1 << 7); 1.66 + 1.67 + static const SK_OT_USHORT GXMetamorphosis_AppleMask = SkTEndian_SwapBE16(1 << 8); 1.68 + static const SK_OT_USHORT HasStrongRTL_AppleMask = SkTEndian_SwapBE16(1 << 9); 1.69 + static const SK_OT_USHORT HasIndicStyleRearrangementMask = SkTEndian_SwapBE16(1 << 10); 1.70 + static const SK_OT_USHORT AgfaMicroTypeExpressProcessedMask = SkTEndian_SwapBE16(1 << 11); 1.71 + static const SK_OT_USHORT FontConvertedMask = SkTEndian_SwapBE16(1 << 12); 1.72 + static const SK_OT_USHORT DesignedForClearTypeMask = SkTEndian_SwapBE16(1 << 13); 1.73 + static const SK_OT_USHORT LastResortMask = SkTEndian_SwapBE16(1 << 14); 1.74 + //Reserved 1.75 + SK_OT_USHORT value; 1.76 + } raw; 1.77 + } flags; 1.78 + SK_OT_USHORT unitsPerEm; 1.79 + SK_OT_LONGDATETIME created; 1.80 + SK_OT_LONGDATETIME modified; 1.81 + SK_OT_SHORT xMin; 1.82 + SK_OT_SHORT yMin; 1.83 + SK_OT_SHORT xMax; 1.84 + SK_OT_SHORT yMax; 1.85 + union MacStyle { 1.86 + struct Field { 1.87 + //8-15 1.88 + SK_OT_BYTE_BITFIELD( 1.89 + Reserved08, 1.90 + Reserved09, 1.91 + Reserved10, 1.92 + Reserved11, 1.93 + Reserved12, 1.94 + Reserved13, 1.95 + Reserved14, 1.96 + Reserved15) 1.97 + //0-7 1.98 + SK_OT_BYTE_BITFIELD( 1.99 + Bold, 1.100 + Italic, 1.101 + Underline, 1.102 + Outline, 1.103 + Shadow, 1.104 + Condensed, 1.105 + Extended, 1.106 + Reserved07) 1.107 + } field; 1.108 + struct Raw { 1.109 + static const SK_OT_USHORT BoldMask = SkTEndian_SwapBE16(1); 1.110 + static const SK_OT_USHORT ItalicMask = SkTEndian_SwapBE16(1 << 1); 1.111 + static const SK_OT_USHORT UnderlineMask = SkTEndian_SwapBE16(1 << 2); 1.112 + static const SK_OT_USHORT OutlineMask = SkTEndian_SwapBE16(1 << 3); 1.113 + static const SK_OT_USHORT ShadowMask = SkTEndian_SwapBE16(1 << 4); 1.114 + static const SK_OT_USHORT CondensedMask = SkTEndian_SwapBE16(1 << 5); 1.115 + static const SK_OT_USHORT ExtendedMask = SkTEndian_SwapBE16(1 << 6); 1.116 + 1.117 + SK_OT_USHORT value; 1.118 + } raw; 1.119 + } macStyle; 1.120 + SK_OT_USHORT lowestRecPPEM; 1.121 + struct FontDirectionHint { 1.122 + SK_TYPED_ENUM(Value, SK_OT_SHORT, 1.123 + ((FullyMixedDirectionalGlyphs, SkTEndian_SwapBE16(0))) 1.124 + ((OnlyStronglyLTR, SkTEndian_SwapBE16(1))) 1.125 + ((StronglyLTR, SkTEndian_SwapBE16(2))) 1.126 + ((OnlyStronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16((uint16_t)-1)))) 1.127 + ((StronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16((uint16_t)-2)))) 1.128 + SK_SEQ_END, 1.129 + (value)SK_SEQ_END) 1.130 + } fontDirectionHint; 1.131 + struct IndexToLocFormat { 1.132 + SK_TYPED_ENUM(Value, SK_OT_SHORT, 1.133 + ((ShortOffsets, SkTEndian_SwapBE16(0))) 1.134 + ((LongOffsets, SkTEndian_SwapBE16(1))) 1.135 + SK_SEQ_END, 1.136 + (value)SK_SEQ_END) 1.137 + } indexToLocFormat; 1.138 + struct GlyphDataFormat { 1.139 + SK_TYPED_ENUM(Value, SK_OT_SHORT, 1.140 + ((CurrentFormat, SkTEndian_SwapBE16(0))) 1.141 + SK_SEQ_END, 1.142 + (value)SK_SEQ_END) 1.143 + } glyphDataFormat; 1.144 +}; 1.145 + 1.146 +#pragma pack(pop) 1.147 + 1.148 + 1.149 +#include <stddef.h> 1.150 +SK_COMPILE_ASSERT(offsetof(SkOTTableHead, glyphDataFormat) == 52, SkOTTableHead_glyphDataFormat_not_at_52); 1.151 +SK_COMPILE_ASSERT(sizeof(SkOTTableHead) == 54, sizeof_SkOTTableHead_not_54); 1.152 + 1.153 +#endif