sill.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright (c) 2009-2017 The OTS Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef OTS_SILL_H_
  5. #define OTS_SILL_H_
  6. #include "ots.h"
  7. #include "graphite.h"
  8. #include <vector>
  9. namespace ots {
  10. class OpenTypeSILL : public Table {
  11. public:
  12. explicit OpenTypeSILL(Font* font, uint32_t tag)
  13. : Table(font, tag, tag) { }
  14. bool Parse(const uint8_t* data, size_t length);
  15. bool Serialize(OTSStream* out);
  16. private:
  17. struct LanguageEntry : public TablePart<OpenTypeSILL> {
  18. explicit LanguageEntry(OpenTypeSILL* parent)
  19. : TablePart<OpenTypeSILL>(parent) { }
  20. bool ParsePart(Buffer &table);
  21. bool SerializePart(OTSStream* out) const;
  22. uint8_t langcode[4];
  23. uint16_t numSettings;
  24. uint16_t offset;
  25. };
  26. struct LangFeatureSetting : public TablePart<OpenTypeSILL> {
  27. explicit LangFeatureSetting(OpenTypeSILL* parent)
  28. : TablePart<OpenTypeSILL>(parent) { }
  29. bool ParsePart(Buffer &table);
  30. bool SerializePart(OTSStream* out) const;
  31. uint32_t featureId;
  32. int16_t value;
  33. uint16_t reserved;
  34. };
  35. uint32_t version;
  36. uint16_t numLangs;
  37. uint16_t searchRange;
  38. uint16_t entrySelector;
  39. uint16_t rangeShift;
  40. std::vector<LanguageEntry> entries;
  41. std::vector<LangFeatureSetting> settings;
  42. };
  43. } // namespace ots
  44. #endif // OTS_SILL_H_