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

90 lines
2.8 KiB
C++

#ifndef __TABLE_HEAD_H__
#define __TABLE_HEAD_H__
#include "../../../reader/reader.h"
class HeadTable
{
private:
uint16 _majorVersion;
uint16 _minorVersion;
Fixed _fontRevision;
uint32 _checksumAdjustment;
uint32 _magicNumber;
uint16 _flags;
uint16 _unitsPerEm;
LONGDATETIME _created;
LONGDATETIME _modified;
int16 _xMin;
int16 _yMin;
int16 _xMax;
int16 _yMax;
uint16 _maxStyle;
uint16 _lowestRecPPEM;
int16 _fontDirectHint;
int16 _indexToLocFormat;
int16 _glyphDataFormat;
public:
HeadTable() : _majorVersion(0),
_minorVersion(0),
_fontRevision(),
_checksumAdjustment(0),
_magicNumber(0),
_flags(0),
_unitsPerEm(0),
_created(0),
_modified(0),
_xMin(0),
_yMin(0),
_xMax(0),
_yMax(0),
_maxStyle(0),
_lowestRecPPEM(0),
_fontDirectHint(0),
_indexToLocFormat(0),
_glyphDataFormat(0) {};
~HeadTable() {};
HeadTable(reader *rd) { read(rd); }
void read(reader *rd)
{
_majorVersion = rd->readUint16();
_minorVersion = rd->readUint16();
_fontRevision = rd->readFixed();
_checksumAdjustment = rd->readUint32();
_magicNumber = rd->readUint32();
_flags = rd->readUint16();
_unitsPerEm = rd->readUint16();
_created = rd->readUint64();
_modified = rd->readUint64();
_xMin = rd->readInt16();
_yMin = rd->readInt16();
_xMax = rd->readInt16();
_yMax = rd->readInt16();
_maxStyle = rd->readUint16();
_lowestRecPPEM = rd->readUint16();
_fontDirectHint = rd->readInt16();
_indexToLocFormat = rd->readInt16();
_glyphDataFormat = rd->readInt16();
}
uint16 majorVersion() { return _majorVersion; }
uint16 minorVersion() { return _minorVersion; }
Fixed fontRevision() { return _fontRevision; }
uint32 checksumAdjustment() { return _checksumAdjustment; }
uint32 magicNumber() { return _magicNumber; }
uint16 flags() { return _flags; }
uint16 unitsPerEm() { return _unitsPerEm; }
LONGDATETIME created() { return _created; }
LONGDATETIME modified() { return _modified; }
int16 xMin() { return _xMin; }
int16 yMin() { return _yMin; }
int16 xMax() { return _xMax; }
int16 yMax() { return _yMax; }
uint16 maxStyle() { return _maxStyle; }
uint16 lowestRecPPEM() { return _lowestRecPPEM; }
int16 fontDirectHint() { return _fontDirectHint; }
int16 indexToLocFormat() { return _indexToLocFormat; }
int16 glyphDataFormat() { return _glyphDataFormat; }
};
#endif