#pragma once #include #include #include "DataSpec/DNACommon/DNACommon.hpp" #include namespace DataSpec { class PAKEntryReadStream; } namespace hecl { class ProjectPath; } namespace DataSpec::DNAFont { struct GlyphRect : BigDNA { AT_DECL_DNA_YAML Value left; Value top; Value right; Value bottom; }; struct IGlyph : BigDNAVYaml { AT_DECL_DNA_YAMLV 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 atInt32 layer() const { 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_YAMLV Value m_leftPadding; Value m_advance; Value m_rightPadding; Value m_width; Value m_height; Value m_baseline; Value m_kerningIndex; atInt32 leftPadding() const override { return m_leftPadding; } atInt32 advance() const override { return m_advance; } atInt32 rightPadding() const override { return m_rightPadding; } atInt32 width() const override { return m_width; } atInt32 height() const override { return m_height; } atInt32 baseline() const override { return m_baseline; } atInt32 kerningIndex() const override { return m_kerningIndex; } }; struct GlyphMP2 : IGlyph { AT_DECL_DNA_YAMLV 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 override { return m_layer; } atInt32 leftPadding() const override { return m_leftPadding; } atInt32 advance() const override { return m_advance; } atInt32 rightPadding() const override { return m_rightPadding; } atInt32 width() const override { return m_width; } atInt32 height() const override { return m_height; } atInt32 baseline() const override { return m_baseline; } atInt32 kerningIndex() const override { 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); } // namespace DataSpec::DNAFont