SkOTTable_OS_2_V0.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. * Copyright 2012 Google Inc.
  3. *
  4. * Use of this source code is governed by a BSD-style license that can be
  5. * found in the LICENSE file.
  6. */
  7. #ifndef SkOTTable_OS_2_V0_DEFINED
  8. #define SkOTTable_OS_2_V0_DEFINED
  9. #include "src/core/SkEndian.h"
  10. #include "src/sfnt/SkIBMFamilyClass.h"
  11. #include "src/sfnt/SkOTTableTypes.h"
  12. #include "src/sfnt/SkPanose.h"
  13. #pragma pack(push, 1)
  14. struct SkOTTableOS2_V0 {
  15. SK_OT_USHORT version;
  16. //SkOTTableOS2_VA::VERSION and SkOTTableOS2_V0::VERSION are both 0.
  17. //The only way to differentiate these two versions is by the size of the table.
  18. static const SK_OT_USHORT VERSION = SkTEndian_SwapBE16(0);
  19. SK_OT_SHORT xAvgCharWidth;
  20. struct WeightClass {
  21. enum Value : SK_OT_USHORT {
  22. Thin = SkTEndian_SwapBE16(100),
  23. ExtraLight = SkTEndian_SwapBE16(200),
  24. Light = SkTEndian_SwapBE16(300),
  25. Normal = SkTEndian_SwapBE16(400),
  26. Medium = SkTEndian_SwapBE16(500),
  27. SemiBold = SkTEndian_SwapBE16(600),
  28. Bold = SkTEndian_SwapBE16(700),
  29. ExtraBold = SkTEndian_SwapBE16(800),
  30. Black = SkTEndian_SwapBE16(900),
  31. };
  32. SK_OT_USHORT value;
  33. } usWeightClass;
  34. struct WidthClass {
  35. enum Value : SK_OT_USHORT {
  36. UltraCondensed = SkTEndian_SwapBE16(1),
  37. ExtraCondensed = SkTEndian_SwapBE16(2),
  38. Condensed = SkTEndian_SwapBE16(3),
  39. SemiCondensed = SkTEndian_SwapBE16(4),
  40. Medium = SkTEndian_SwapBE16(5),
  41. SemiExpanded = SkTEndian_SwapBE16(6),
  42. Expanded = SkTEndian_SwapBE16(7),
  43. ExtraExpanded = SkTEndian_SwapBE16(8),
  44. UltraExpanded = SkTEndian_SwapBE16(9),
  45. } value;
  46. } usWidthClass;
  47. union Type {
  48. struct Field {
  49. //8-15
  50. SK_OT_BYTE_BITFIELD(
  51. Reserved08,
  52. Reserved09,
  53. Reserved10,
  54. Reserved11,
  55. Reserved12,
  56. Reserved13,
  57. Reserved14,
  58. Reserved15)
  59. //0-7
  60. SK_OT_BYTE_BITFIELD(
  61. Reserved00,
  62. Restricted,
  63. PreviewPrint,
  64. Editable,
  65. Reserved04,
  66. Reserved05,
  67. Reserved06,
  68. Reserved07)
  69. } field;
  70. struct Raw {
  71. static const SK_OT_USHORT Installable = 0;
  72. static const SK_OT_USHORT RestrictedMask = SkOTSetUSHORTBit<1>::value;
  73. static const SK_OT_USHORT PreviewPrintMask = SkOTSetUSHORTBit<2>::value;
  74. static const SK_OT_USHORT EditableMask = SkOTSetUSHORTBit<3>::value;
  75. SK_OT_USHORT value;
  76. } raw;
  77. } fsType;
  78. SK_OT_SHORT ySubscriptXSize;
  79. SK_OT_SHORT ySubscriptYSize;
  80. SK_OT_SHORT ySubscriptXOffset;
  81. SK_OT_SHORT ySubscriptYOffset;
  82. SK_OT_SHORT ySuperscriptXSize;
  83. SK_OT_SHORT ySuperscriptYSize;
  84. SK_OT_SHORT ySuperscriptXOffset;
  85. SK_OT_SHORT ySuperscriptYOffset;
  86. SK_OT_SHORT yStrikeoutSize;
  87. SK_OT_SHORT yStrikeoutPosition;
  88. SkIBMFamilyClass sFamilyClass;
  89. SkPanose panose;
  90. SK_OT_ULONG ulCharRange[4];
  91. SK_OT_CHAR achVendID[4];
  92. union Selection {
  93. struct Field {
  94. //8-15
  95. SK_OT_BYTE_BITFIELD(
  96. Reserved08,
  97. Reserved09,
  98. Reserved10,
  99. Reserved11,
  100. Reserved12,
  101. Reserved13,
  102. Reserved14,
  103. Reserved15)
  104. //0-7
  105. SK_OT_BYTE_BITFIELD(
  106. Italic,
  107. Underscore,
  108. Negative,
  109. Outlined,
  110. Strikeout,
  111. Bold,
  112. Regular,
  113. Reserved07)
  114. } field;
  115. struct Raw {
  116. static const SK_OT_USHORT ItalicMask = SkOTSetUSHORTBit<0>::value;
  117. static const SK_OT_USHORT UnderscoreMask = SkOTSetUSHORTBit<1>::value;
  118. static const SK_OT_USHORT NegativeMask = SkOTSetUSHORTBit<2>::value;
  119. static const SK_OT_USHORT OutlinedMask = SkOTSetUSHORTBit<3>::value;
  120. static const SK_OT_USHORT StrikeoutMask = SkOTSetUSHORTBit<4>::value;
  121. static const SK_OT_USHORT BoldMask = SkOTSetUSHORTBit<5>::value;
  122. static const SK_OT_USHORT RegularMask = SkOTSetUSHORTBit<6>::value;
  123. SK_OT_USHORT value;
  124. } raw;
  125. } fsSelection;
  126. SK_OT_USHORT usFirstCharIndex;
  127. SK_OT_USHORT usLastCharIndex;
  128. //version0
  129. SK_OT_SHORT sTypoAscender;
  130. SK_OT_SHORT sTypoDescender;
  131. SK_OT_SHORT sTypoLineGap;
  132. SK_OT_USHORT usWinAscent;
  133. SK_OT_USHORT usWinDescent;
  134. };
  135. #pragma pack(pop)
  136. static_assert(sizeof(SkOTTableOS2_V0) == 78, "sizeof_SkOTTableOS2_V0_not_78");
  137. #endif