blog/cpp/fonts/core/tables/table.h

65 lines
1.1 KiB
C++

#ifndef __TABLE_H__
#define __TABLE_H__
#include "name/name.h"
#include "../../reader/reader.h"
#include <string>
#include "cmap/cmap.h"
#include "base/base.h"
#include "glyf/glyf.h"
#include "head/head.h"
#include "name/name.h"
#include "loca/loca.h"
#include "maxp/maxp.h"
struct table
{
std::string name;
uint32_t sum;
uint32_t offset;
uint32_t length;
};
class FontTable
{
private:
std::vector<table> _tables;
HeadTable* _head;
NameTable* _name;
BaseHeader1* _base;
CmapTable* _cmap;
MaxpTable* _maxp;
LocaTable* _loca;
public:
FontTable(){};
~FontTable(){
if(_head!=nullptr){
delete _head;
}
if(_name != nullptr){
delete _name;
}
if(_base != nullptr){
delete _base;
}
if(_cmap!= nullptr){
delete _cmap;
}
if(_maxp!=nullptr){
delete _maxp;
}
if(_loca!=nullptr){
delete _loca;
}
};
void display();
void read(reader*, uint16_t);
std::vector<table> tables();
};
#endif