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 5 #ifndef OTS_SILL_H_ 6 #define OTS_SILL_H_ 7 8 #include "ots.h" 9 #include "graphite.h" 10 11 #include <vector> 12 13 namespace ots { 14 15 class OpenTypeSILL : public Table { 16 public: OpenTypeSILL(Font * font,uint32_t tag)17 explicit OpenTypeSILL(Font* font, uint32_t tag) 18 : Table(font, tag, tag) { } 19 20 bool Parse(const uint8_t* data, size_t length); 21 bool Serialize(OTSStream* out); 22 23 private: 24 struct LanguageEntry : public TablePart<OpenTypeSILL> { LanguageEntryLanguageEntry25 explicit LanguageEntry(OpenTypeSILL* parent) 26 : TablePart<OpenTypeSILL>(parent) { } 27 bool ParsePart(Buffer &table); 28 bool SerializePart(OTSStream* out) const; 29 uint8_t langcode[4]; 30 uint16_t numSettings; 31 uint16_t offset; 32 }; 33 struct LangFeatureSetting : public TablePart<OpenTypeSILL> { LangFeatureSettingLangFeatureSetting34 explicit LangFeatureSetting(OpenTypeSILL* parent) 35 : TablePart<OpenTypeSILL>(parent) { } 36 bool ParsePart(Buffer &table); 37 bool SerializePart(OTSStream* out) const; 38 uint32_t featureId; 39 int16_t value; 40 uint16_t reserved; 41 }; 42 uint32_t version; 43 uint16_t numLangs; 44 uint16_t searchRange; 45 uint16_t entrySelector; 46 uint16_t rangeShift; 47 std::vector<LanguageEntry> entries; 48 std::vector<LangFeatureSetting> settings; 49 }; 50 51 } // namespace ots 52 53 #endif // OTS_SILL_H_ 54