#include "table.h" #include "table_name.h" #include "../reader/buffer.h" #include void FontTable::display() { std::cout<<"table lists:"<display(); break; default: break; } } } void FontTable::read(reader *rd, uint16_t count) { for (auto i = 0; i < count; i++) { table t; t.name = rd->readString(4); t.sum = rd->readUint32(); t.offset = rd->readUint32(); t.length = rd->readUint32(); _tables.push_back(t); } //读取表详情 for (auto it: _tables) { auto iter = tableNameMap.find(it.name); if (iter == tableNameMap.end()) { continue; } auto id = (*iter).second; switch (id) { case tableName::name: { if(!rd->seek(it.offset)){ throw "seek file failed"; }; auto data = rd->readString(it.length); buffer nameReader(data); _name = new NameTable(); _name->read(&nameReader, it.length); } break; case tableName::cmap: { break; } case tableName::BASE: { break; } case tableName::head: { break; } case tableName::maxp: { break; } case tableName::glyf: { break; } default: break; } } } std::vector FontTable::tables(){ return _tables; }