SkOTTable_fvar.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright 2017 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_fvar_DEFINED
  8. #define SkOTTable_fvar_DEFINED
  9. #include "src/core/SkEndian.h"
  10. #include "src/sfnt/SkOTTableTypes.h"
  11. #pragma pack(push, 1)
  12. struct SkOTTableFontVariations {
  13. static const SK_OT_CHAR TAG0 = 'f';
  14. static const SK_OT_CHAR TAG1 = 'v';
  15. static const SK_OT_CHAR TAG2 = 'a';
  16. static const SK_OT_CHAR TAG3 = 'r';
  17. static const SK_OT_ULONG TAG = SkOTTableTAG<SkOTTableFontVariations>::value;
  18. SK_OT_USHORT majorVersion;
  19. SK_OT_USHORT minorVersion;
  20. SK_OT_USHORT offsetToAxesArray;
  21. SK_OT_USHORT reserved;
  22. SK_OT_USHORT axisCount;
  23. SK_OT_USHORT axisSize; // Must be 0x0014 in v1.0
  24. SK_OT_USHORT instanceCount;
  25. SK_OT_USHORT instanceSize; // Must be axisCount * sizeof(Fixed) + (4 | 6)
  26. struct VariationAxisRecord {
  27. SK_OT_ULONG axisTag;
  28. SK_OT_Fixed minValue;
  29. SK_OT_Fixed defaultValue;
  30. SK_OT_Fixed maxValue;
  31. SK_OT_USHORT flags; // Must be 0
  32. SK_OT_USHORT axisNameID;
  33. }; // axes[axisCount];
  34. template <size_t AxisCount> struct InstanceRecord {
  35. SK_OT_USHORT subfamilyNameID;
  36. SK_OT_USHORT flags; // Must be 0
  37. SK_OT_Fixed coordinates[AxisCount];
  38. SK_OT_USHORT postScriptNameID;
  39. }; // instances[instanceCount];
  40. };
  41. #pragma pack(pop)
  42. #include <stddef.h>
  43. static_assert(offsetof(SkOTTableFontVariations, instanceSize) == 14, "SkOTTableFontVariations_instanceSize_not_at_14");
  44. static_assert(sizeof(SkOTTableFontVariations) == 16, "sizeof_SkOTTableFontVariations_not_16");
  45. #endif