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

84 lines
2.9 KiB
C
Raw Normal View History

2024-09-13 15:10:58 +08:00
#ifndef __TABLE_MAXP_H__
#define __TABLE_MAXP_H__
#include "../../../reader/reader.h"
class MaxpTable
{
private:
Version16Dot16 _version;
uint16 _numGlyphs;
public:
MaxpTable() : _version(0x00005000), _numGlyphs(0) {};
~MaxpTable() {};
MaxpTable(uint32 n) : _version(n), _numGlyphs(0) {};
MaxpTable(reader *rd) { read(rd); }
void read(reader *rd)
{
_version = rd->readVersion16Dot16();
_numGlyphs = rd->readUint16();
}
Version16Dot16 version() { return _version; }
uint16 numGlyphs() { return _numGlyphs; }
};
#define MaxpTable0Dot5 MaxpTable
class MaxpTable1Dot0 : public MaxpTable
{
private:
uint16 _maxPoints;
uint16 _maxContours;
uint16 _maxCompositePoints;
uint16 _maxCompositeContours;
uint16 _maxZones;
uint16 _maxTwilightPoints;
uint16 _maxStorage;
uint16 _maxFunctionDefs;
uint16 _maxInstructionDefs;
uint16 _maxStackElements;
uint16 _maxSizeOfInstructions;
uint16 _maxComponentElemets;
uint16 _maxComponentDepth;
public:
MaxpTable1Dot0() : MaxpTable(0x00010000), _maxComponentDepth(0), _maxComponentElemets(0), _maxCompositeContours(0),
_maxCompositePoints(0), _maxContours(0), _maxFunctionDefs(0), _maxInstructionDefs(0),
_maxPoints(0), _maxSizeOfInstructions(0), _maxStackElements(0), _maxStorage(0),
_maxTwilightPoints(0), _maxZones(0) {};
~MaxpTable1Dot0() {};
MaxpTable1Dot0(reader *rd) { read(rd); }
void read(reader *rd)
{
MaxpTable::read(rd);
_maxPoints = rd->readUint16();
_maxContours = rd->readUint16();
_maxCompositePoints = rd->readUint16();
_maxCompositeContours = rd->readUint16();
_maxZones = rd->readUint16();
_maxTwilightPoints = rd->readUint16();
_maxStorage = rd->readUint16();
_maxFunctionDefs = rd->readUint16();
_maxInstructionDefs = rd->readUint16();
_maxStackElements = rd->readUint16();
_maxSizeOfInstructions = rd->readUint16();
_maxComponentElemets = rd->readUint16();
_maxComponentDepth = rd->readUint16();
}
uint16 maxPoints() { return _maxPoints; }
uint16 maxContours() { return _maxContours; }
uint16 maxCompositePoints() { return _maxCompositePoints; }
uint16 maxCompositeContours() { return _maxCompositeContours; }
uint16 maxZones() { return _maxZones; }
uint16 maxTwilightPoints() { return _maxTwilightPoints; }
uint16 maxStorage() { return _maxStorage; }
uint16 maxFunctionDefs() { return _maxFunctionDefs; }
uint16 maxInstructionDefs() { return _maxInstructionDefs; }
uint16 maxStackElements() { return _maxStackElements; }
uint16 maxSizeOfInstructions() { return _maxSizeOfInstructions; }
uint16 maxComponentElemets() { return _maxComponentElemets; }
uint16 maxComponentDepth() { return _maxComponentDepth; }
};
#endif