SkOTTable_OS_2_VA.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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_VA_DEFINED
  8. #define SkOTTable_OS_2_VA_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. //Original V0 TT
  15. struct SkOTTableOS2_VA {
  16. SK_OT_USHORT version;
  17. //SkOTTableOS2_VA::VERSION and SkOTTableOS2_V0::VERSION are both 0.
  18. //The only way to differentiate these two versions is by the size of the table.
  19. static const SK_OT_USHORT VERSION = SkTEndian_SwapBE16(0);
  20. SK_OT_SHORT xAvgCharWidth;
  21. struct WeightClass {
  22. enum Value : SK_OT_USHORT {
  23. UltraLight = SkTEndian_SwapBE16(1),
  24. ExtraLight = SkTEndian_SwapBE16(2),
  25. Light = SkTEndian_SwapBE16(3),
  26. SemiLight = SkTEndian_SwapBE16(4),
  27. Medium = SkTEndian_SwapBE16(5),
  28. SemiBold = SkTEndian_SwapBE16(6),
  29. Bold = SkTEndian_SwapBE16(7),
  30. ExtraBold = SkTEndian_SwapBE16(8),
  31. UltraBold = SkTEndian_SwapBE16(9),
  32. SK_SEQ_END,
  33. } value;
  34. } usWeightClass;
  35. struct WidthClass {
  36. enum Value : SK_OT_USHORT {
  37. UltraCondensed = SkTEndian_SwapBE16(1),
  38. ExtraCondensed = SkTEndian_SwapBE16(2),
  39. Condensed = SkTEndian_SwapBE16(3),
  40. SemiCondensed = SkTEndian_SwapBE16(4),
  41. Medium = SkTEndian_SwapBE16(5),
  42. SemiExpanded = SkTEndian_SwapBE16(6),
  43. Expanded = SkTEndian_SwapBE16(7),
  44. ExtraExpanded = SkTEndian_SwapBE16(8),
  45. UltraExpanded = SkTEndian_SwapBE16(9),
  46. SK_SEQ_END,
  47. } value;
  48. } usWidthClass;
  49. union Type {
  50. struct Field {
  51. //8-15
  52. SK_OT_BYTE_BITFIELD(
  53. Reserved08,
  54. Reserved09,
  55. Reserved10,
  56. Reserved11,
  57. Reserved12,
  58. Reserved13,
  59. Reserved14,
  60. Reserved15)
  61. //0-7
  62. SK_OT_BYTE_BITFIELD(
  63. Reserved00,
  64. Restricted,
  65. PreviewPrint,
  66. Editable,
  67. Reserved04,
  68. Reserved05,
  69. Reserved06,
  70. Reserved07)
  71. } field;
  72. struct Raw {
  73. static const SK_OT_USHORT Installable = 0;
  74. static const SK_OT_USHORT RestrictedMask = SkOTSetUSHORTBit<1>::value;
  75. static const SK_OT_USHORT PreviewPrintMask = SkOTSetUSHORTBit<2>::value;
  76. static const SK_OT_USHORT EditableMask = SkOTSetUSHORTBit<3>::value;
  77. SK_OT_USHORT value;
  78. } raw;
  79. } fsType;
  80. SK_OT_SHORT ySubscriptXSize;
  81. SK_OT_SHORT ySubscriptYSize;
  82. SK_OT_SHORT ySubscriptXOffset;
  83. SK_OT_SHORT ySubscriptYOffset;
  84. SK_OT_SHORT ySuperscriptXSize;
  85. SK_OT_SHORT ySuperscriptYSize;
  86. SK_OT_SHORT ySuperscriptXOffset;
  87. SK_OT_SHORT ySuperscriptYOffset;
  88. SK_OT_SHORT yStrikeoutSize;
  89. SK_OT_SHORT yStrikeoutPosition;
  90. SkIBMFamilyClass sFamilyClass;
  91. SkPanose panose;
  92. SK_OT_ULONG ulCharRange[4];
  93. SK_OT_CHAR achVendID[4];
  94. union Selection {
  95. struct Field {
  96. //8-15
  97. SK_OT_BYTE_BITFIELD(
  98. Reserved08,
  99. Reserved09,
  100. Reserved10,
  101. Reserved11,
  102. Reserved12,
  103. Reserved13,
  104. Reserved14,
  105. Reserved15)
  106. //0-7
  107. SK_OT_BYTE_BITFIELD(
  108. Italic,
  109. Underscore,
  110. Negative,
  111. Outlined,
  112. Strikeout,
  113. Bold,
  114. Reserved06,
  115. Reserved07)
  116. } field;
  117. struct Raw {
  118. static const SK_OT_USHORT ItalicMask = SkOTSetUSHORTBit<0>::value;
  119. static const SK_OT_USHORT UnderscoreMask = SkOTSetUSHORTBit<1>::value;
  120. static const SK_OT_USHORT NegativeMask = SkOTSetUSHORTBit<2>::value;
  121. static const SK_OT_USHORT OutlinedMask = SkOTSetUSHORTBit<3>::value;
  122. static const SK_OT_USHORT StrikeoutMask = SkOTSetUSHORTBit<4>::value;
  123. static const SK_OT_USHORT BoldMask = SkOTSetUSHORTBit<5>::value;
  124. SK_OT_USHORT value;
  125. } raw;
  126. } fsSelection;
  127. SK_OT_USHORT usFirstCharIndex;
  128. SK_OT_USHORT usLastCharIndex;
  129. };
  130. #pragma pack(pop)
  131. static_assert(sizeof(SkOTTableOS2_VA) == 68, "sizeof_SkOTTableOS2_VA_not_68");
  132. #endif