#ifndef __TABLE_BASE_HEADER_H__ #define __TABLE_BASE_HEADER_H__ #include "../../../reader/reader.h" class BaseHeader1 { private: uint16_t _majorVersion; uint16_t _minorVersion; Offset16 _horizAxisOffset; Offset16 _vertAxisOffset; public: BaseHeader1():_majorVersion(1),_minorVersion(0),_horizAxisOffset(0),_vertAxisOffset(0){}; ~BaseHeader1(){}; BaseHeader1(reader* rd){read(rd);}; void read(reader *rd){ if(_majorVersion!=1||_minorVersion!=0)return; _majorVersion = rd->readUint16(); _minorVersion = rd->readUint16(); _horizAxisOffset = rd->readUint16(); _vertAxisOffset = rd->readUint16(); }; uint16_t majorVersion()const{return _majorVersion;}; uint16_t minorVersion()const{return _minorVersion;}; uint16_t horizAxisOffset()const{return _horizAxisOffset;}; uint16_t vertAxisOffset()const{return _vertAxisOffset;}; }; // class BaseHeader1_1: public BaseHeader1 { private: uint32_t _itemVarStoreOffset; public: BaseHeader1_1():_itemVarStoreOffset(0){}; ~BaseHeader1_1(){}; BaseHeader1_1(reader* rd):BaseHeader1(rd){read(rd);}; void read(reader* rd){ _itemVarStoreOffset = rd->readUint32(); } uint32_t itemVarStoreOffset()const{return _itemVarStoreOffset;}; }; // class AxisTable { private: uint16_t _baseTagListOffset; uint16_t _baseScriptListOffset; public: AxisTable():_baseScriptListOffset(0),_baseTagListOffset(0){}; ~AxisTable(){}; AxisTable(reader* rd){read(rd);}; void read(reader* rd){ _baseTagListOffset = rd->readUint16(); _baseScriptListOffset = rd->readUint16(); } uint16_t baseTagListOffset()const{return _baseTagListOffset;}; uint16_t baseScriptListOffset()const{return _baseScriptListOffset;}; }; class BaseTagList { private: uint16_t _baseTagCount; std::vector _baselineTags; public: BaseTagList():_baseTagCount(0){}; ~BaseTagList(){}; BaseTagList(reader*rd){read(rd);}; void read(reader *rd){ _baseTagCount = rd->readUint16(); for(auto i=0;i<_baseTagCount;i++){ Tag t = rd->readTag(); _baselineTags.push_back(t); } } uint16 baseTagCount(){return _baseTagCount;}; std::vector baselineTags(){return _baselineTags;}; }; class BaseScriptRecord { private: Tag _baseScriptTag; Offset16 _baseScriptOffset; public: BaseScriptRecord():_baseScriptOffset(0){}; ~BaseScriptRecord(){}; BaseScriptRecord(reader*rd){read(rd);}; void read(reader* rd){ _baseScriptTag = rd->readTag(); _baseScriptOffset = rd->readOffset16(); }; }; class BaseScriptList { private: uint16 _baseScriptCount; std::vector _baseScriptRecords; public: BaseScriptList():_baseScriptCount(0){}; ~BaseScriptList(){}; BaseScriptList(reader *rd){read(rd);}; void read(reader *rd){ _baseScriptCount = rd->readUint16(); for(auto i = 0; i<_baseScriptCount; i++){ BaseScriptRecord bs(rd); _baseScriptRecords.push_back(rd); } } uint16 baseScriptCount(){return _baseScriptCount;}; std::vector baseScriptRecords(){return _baseScriptRecords;}; }; class BaseValues { private: uint16 _defaultBaselineIndex; uint16 _baseCoordCount; std::vector _baseCoordOffset; public: BaseValues():_defaultBaselineIndex(0),_baseCoordCount(0){}; ~BaseValues(){}; BaseValues(reader*rd){read(rd);}; void read(reader*rd){ _defaultBaselineIndex = rd->readUint16(); _baseCoordCount = rd->readUint16(); for(auto i=0;i<_baseCoordCount; i++){ Offset16 f = rd->readOffset16(); _baseCoordOffset.push_back(f); } } uint16 defaultBaselineIndex(){return _defaultBaselineIndex;}; uint16 baseCoordCount(){return _baseCoordCount;}; std::vector baseCoordOffset(){return _baseCoordOffset;}; }; class BaseLangSys { private: Tag _baseLangSysTag; Offset16 _minMaxOffset; public: BaseLangSys():_minMaxOffset(0){}; ~BaseLangSys(){}; BaseLangSys(reader* rd){read(rd);}; void read(reader*rd){ _baseLangSysTag = rd->readTag(); _minMaxOffset = rd->readOffset16(); } Tag baseLangSysTag(){return _baseLangSysTag;}; Offset16 minMaxOffset(){return _minMaxOffset;}; }; class BaseScript { private: Offset16 _baseValuesOffset; Offset16 _defaultMinMaxOffset; uint16 _baseLangSysCount; std::vector _baseLangSysRecords; public: BaseScript():_baseLangSysCount(0),_defaultMinMaxOffset(0),_baseValuesOffset(0){}; ~BaseScript(){}; BaseScript(reader* rd){read(rd);}; void read(reader* rd){ _baseValuesOffset = rd->readOffset16(); _defaultMinMaxOffset = rd->readOffset16(); _baseLangSysCount = rd->readUint16(); for(auto i = 0; i<_baseLangSysCount;i++){ BaseLangSys bls(rd); _baseLangSysRecords.push_back(bls); } } Offset16 baseValueOffset(){return _baseValuesOffset;}; Offset16 defaultMinMaxOffset(){return _defaultMinMaxOffset;}; uint16 baseLangSysCount(){return _baseLangSysCount;}; std::vector baseLangSysRecords(){return _baseLangSysRecords;}; }; class MinMax { private: Offset16 _minCoordOffset; Offset16 _maxCoordOffset; uint16 _featMinMaxCount; std::vector _featMinMaxRecords; public: MinMax():_minCoordOffset(0),_maxCoordOffset(0),_featMinMaxCount(0){}; ~MinMax(){}; MinMax(reader *rd){read(rd);}; void read(reader *rd){ _minCoordOffset = rd->readOffset16(); _maxCoordOffset = rd->readOffset16(); _featMinMaxCount = rd->readUint16(); for(auto i=0; i<_featMinMaxCount;i++){ FeatMinMax fmm(rd); _featMinMaxRecords.push_back(fmm); } } Offset16 minCoordOffset(){return _minCoordOffset;}; Offset16 maxCoordOffset(){return _maxCoordOffset;}; uint16 featMinMaxCount(){return _featMinMaxCount;}; std::vector featMinMaxRecords(){return _featMinMaxRecords;}; }; class FeatMinMax { private: Tag _featureTag; Offset16 _minCoordOffset; Offset16 _maxCoordOffset; public: FeatMinMax():_minCoordOffset(0), _maxCoordOffset(0){}; ~FeatMinMax(){}; FeatMinMax(reader*rd){read(rd);}; void read(reader*rd){ _featureTag = rd->readTag(); _minCoordOffset =rd->readOffset16(); _maxCoordOffset = rd->readOffset16(); } Tag featureTag(){return _featureTag;}; Offset16 minCoordOffset(){return _minCoordOffset;} Offset16 maxCoordOffset(){return _maxCoordOffset;} }; class BaseCoord1 { private: uint16 _format; int16 _coordinate; public: BaseCoord1():_format(0),_coordinate(0){}; ~BaseCoord1(){}; BaseCoord1(reader*rd){read(rd);}; void read(reader*rd){ _format = rd->readUint16(); _coordinate = rd->readInt16(); } uint16 format(){return _format;} int16 cordinate(){return _coordinate;} }; class BaseCoord2: public BaseCoord1 { private: uint16 _referenceGlyph; uint16 _baseCoordPoint; public: BaseCoord2():_referenceGlyph(0),_baseCoordPoint(0){}; ~BaseCoord2(){}; BaseCoord2(reader*rd):BaseCoord1(rd){read(rd);}; void read(reader* rd){ _referenceGlyph = rd->readUint16(); _baseCoordPoint = rd->readUint16(); } uint16 referenceGlyph(){return _referenceGlyph;} uint16 baseCoordPoint(){return _baseCoordPoint;} }; class BaseCoord3 : public BaseCoord1 { private: Offset16 _deviceOffset; public: BaseCoord3():_deviceOffset(0){}; ~BaseCoord3(){}; BaseCoord3(reader *rd):BaseCoord1(rd){read(rd);}; void read(reader *rd){ _deviceOffset = rd->readOffset16(); } Offset16 deviceOffset(){return _deviceOffset;} }; #endif