SkOTTable_OS_2.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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_DEFINED
  8. #define SkOTTable_OS_2_DEFINED
  9. #include "src/sfnt/SkOTTable_OS_2_V0.h"
  10. #include "src/sfnt/SkOTTable_OS_2_V1.h"
  11. #include "src/sfnt/SkOTTable_OS_2_V2.h"
  12. #include "src/sfnt/SkOTTable_OS_2_V3.h"
  13. #include "src/sfnt/SkOTTable_OS_2_V4.h"
  14. #include "src/sfnt/SkOTTable_OS_2_VA.h"
  15. #pragma pack(push, 1)
  16. struct SkOTTableOS2 {
  17. static constexpr SK_OT_CHAR TAG0 = 'O';
  18. static constexpr SK_OT_CHAR TAG1 = 'S';
  19. static constexpr SK_OT_CHAR TAG2 = '/';
  20. static constexpr SK_OT_CHAR TAG3 = '2';
  21. static constexpr SK_OT_ULONG TAG = SkOTTableTAG<SkOTTableOS2>::value;
  22. union Version {
  23. SK_OT_USHORT version;
  24. //original V0 TT
  25. struct VA : SkOTTableOS2_VA { } vA;
  26. struct V0 : SkOTTableOS2_V0 { } v0;
  27. struct V1 : SkOTTableOS2_V1 { } v1;
  28. struct V2 : SkOTTableOS2_V2 { } v2;
  29. //makes fsType 0-3 exclusive
  30. struct V3 : SkOTTableOS2_V3 { } v3;
  31. //defines fsSelection bits 7-9
  32. struct V4 : SkOTTableOS2_V4 { } v4;
  33. } version;
  34. };
  35. #pragma pack(pop)
  36. static_assert(sizeof(SkOTTableOS2::Version::VA) == 68, "sizeof_SkOTTableOS2__VA_not_68");
  37. static_assert(sizeof(SkOTTableOS2::Version::V0) == 78, "sizeof_SkOTTableOS2__V0_not_78");
  38. static_assert(sizeof(SkOTTableOS2::Version::V1) == 86, "sizeof_SkOTTableOS2__V1_not_86");
  39. static_assert(sizeof(SkOTTableOS2::Version::V2) == 96, "sizeof_SkOTTableOS2__V2_not_96");
  40. static_assert(sizeof(SkOTTableOS2::Version::V3) == 96, "sizeof_SkOTTableOS2__V3_not_96");
  41. static_assert(sizeof(SkOTTableOS2::Version::V4) == 96, "sizeof_SkOTTableOS2__V4_not_96");
  42. #endif