#ifndef __COMMON_FONT_HPP__ #define __COMMON_FONT_HPP__ #include "PAK.hpp" #include "athena/FileWriter.hpp" namespace DataSpec::DNAFont { struct GlyphRect : BigDNA { AT_DECL_DNA_YAML Value left; Value top; Value right; Value bottom; }; struct IGlyph : BigDNAV { AT_DECL_DNA_YAML Value m_character; GlyphRect m_glyphRect; atUint16 character() const { return m_character; } float left() const { return m_glyphRect.left; } float top() const { return m_glyphRect.top; } float right() const { return m_glyphRect.right; } float bottom() const { return m_glyphRect.bottom; } GlyphRect rect() const { return m_glyphRect; } virtual int layer() { return 0; } virtual atInt32 leftPadding() const=0; virtual atInt32 advance() const =0; virtual atInt32 rightPadding() const=0; virtual atInt32 width() const=0; virtual atInt32 height() const=0; virtual atInt32 baseline() const=0; virtual atInt32 kerningIndex() const =0; }; struct GlyphMP1 : IGlyph { AT_DECL_DNA_YAML AT_DECL_DNAV Value m_leftPadding; Value m_advance; Value m_rightPadding; Value m_width; Value m_height; Value m_baseline; Value m_kerningIndex; atInt32 leftPadding() const { return m_leftPadding; } atInt32 advance() const { return m_advance; } atInt32 rightPadding() const { return m_rightPadding; } atInt32 width() const { return m_width; } atInt32 height() const { return m_height; } atInt32 baseline() const { return m_baseline; } atInt32 kerningIndex() const { return m_kerningIndex; } }; struct GlyphMP2 : IGlyph { AT_DECL_DNA_YAML AT_DECL_DNAV Value m_layer; Value m_leftPadding; Value m_advance; Value m_rightPadding; Value m_width; Value m_height; Value m_baseline; Value m_kerningIndex; atInt32 layer() const { return m_layer; } atInt32 leftPadding() const { return m_leftPadding; } atInt32 advance() const { return m_advance; } atInt32 rightPadding() const { return m_rightPadding; } atInt32 width() const { return m_width; } atInt32 height() const { return m_height; } atInt32 baseline() const { return m_baseline; } atInt32 kerningIndex() const { return m_kerningIndex; } }; struct KerningInfo : BigDNA { AT_DECL_DNA_YAML Value thisChar; Value nextChar; Value adjust; }; template struct AT_SPECIALIZE_PARMS(DataSpec::UniqueID32, DataSpec::UniqueID64) FONT : BigDNA { AT_DECL_EXPLICIT_DNA_YAML AT_SUBDECL_DNA Value version; Value unknown1; Value lineHeight; Value verticalOffset; Value lineMargin; Value unknown2; Value unknown3; Value unknown4; Value fontSize; // in points String<-1> name; Value textureId; Value textureFormat; Value glyphCount; std::vector> glyphs; Value kerningInfoCount; Vector kerningInfo; void gatherDependencies(std::vector& pathsOut) const { g_curSpec->flattenDependencies(textureId, pathsOut); } }; template bool ExtractFONT(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath); template bool WriteFONT(const FONT& font, const hecl::ProjectPath& outPath); } #endif // __COMMON_FONT_HPP__