79 static void *
operator new(
size_t nSize);
88 static void operator delete(
void *pBlock);
336 Mat *pMat,
const HxStr &chars,
float flRows,
float flCols,
float flSize,
float flSpace);
416 std::map<char, CharInfo> mCharMap;
460extern Font *(*g_pfnNewFont)(
const HxStr &name);
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Sink that the engine formats its diagnostic and failure text into.
Definition dbg.h:33
float mU0
Definition font.h:134
float mV0
Definition font.h:135
float mV1
Definition font.h:137
float mAdvance
Definition font.h:132
float mU1
Definition font.h:136
CharInfo()=default
Construct zeroed metrics, the value a new mCharMap entry starts with.
CharInfo(int nRow, int nCol, const Font *pFont)
Measure the glyph occupying one cell of the atlas of pFont.
Glyph atlas, either a host font description or a grid of cells inside a material texture.
Definition font.h:59
Mat * mMat
Material whose first texture supplies the glyph atlas.
Definition font.h:420
void GetCharUV(char ch, Vector2 &uv0, Vector2 &uv1)
Report the two texture-coordinate corners of one character.
Font(const HxStr &name)
Construct a Default font with a one-cell grid.
float GetCharAdvance(char ch)
Report the horizontal advance of one character.
float mSpace
Tracking added after every glyph, in the same units as mSize.
Definition font.h:432
virtual const HxStr & ClassName() const
Report the class key a .rnd file writes for a font.
virtual void Load(Stream &stream)
Read this font from stream.
void BuildCharMap()
Measure every character of mChars and record its metrics in mCharMap.
virtual void SetBuiltin(int nHeight, FontWeight weight, int nItalic, FontFamily family, const HxStr &name)
Describe a Builtin host font.
Type mType
Which of the two descriptions this font supplies.
Definition font.h:393
virtual void Replace(Object *pFrom, Object *pTo)
Retarget the material when it is the object being replaced.
void SetMat(Mat *pMat)
Replace the glyph atlas material.
virtual ~Font()
Drop the reference on the material and release the character map.
Type
Which of the two descriptions a font supplies.
Definition font.h:69
@ kFontTypeMaterial
Definition font.h:69
@ kFontTypeDefault
Definition font.h:69
@ kFontTypeBuiltin
Definition font.h:69
void SetSize(float flSize)
Change the height one cell occupies.
virtual void Save(Stream &stream)
Write this font to stream at revision 2.
virtual void DumpText(Dbg &sink)
Write a description of this font to sink.
float mSize
Height one cell occupies, in the units Rnd::Text builds its mesh in.
Definition font.h:429
void SetAtlas(Mat *pMat, const HxStr &chars, float flRows, float flCols, float flSize, float flSpace)
Describe a Material font's glyph atlas in one call.
float mCols
Cell columns of the glyph atlas.
Definition font.h:426
float mRows
Cell rows of the glyph atlas.
Definition font.h:423
virtual void Copy(const Object *pSource, unsigned nFlags)
Copy the state of pSource into this font.
virtual void GetBuiltin(int *nHeightOut, FontWeight *weightOut, int *nItalicOut, FontFamily *familyOut, HxStr &nameOut)
Report the Builtin host font description.
Surface description a Rnd::Mesh draws with.
Definition mat.h:36
Base of every object the renderer can load, resolve by name, and serialise.
Definition object.h:43
Object()
Construct an unnamed object.
Byte stream that every renderer object serialises itself through.
Definition stream.h:31
The rendering engine.
Definition animhelper.h:3
Font * NewFont(const HxStr &name)
Allocate and construct a font.
Object * CreateRegisteredFont(const HxStr &name)
Build a font for the registered "Font" class.
Font * NewFontThroughHook(const HxStr &name)
Build a font through g_pfnNewFont.
FontWeight
Stroke weight of a Builtin font.
Definition font.h:27
@ kFontWeightBold
Definition font.h:27
@ kFontWeightThin
Definition font.h:27
@ kFontWeightNormal
Definition font.h:27
HxStr g_fontClassName
Registered class name of Rnd::Font, the string "Font".
FontFamily
Typeface family of a Builtin font.
Definition font.h:35
@ kFontFamilyModern
Definition font.h:36
@ kFontFamilyRoman
Definition font.h:37
@ kFontFamilySwiss
Definition font.h:38
@ kFontFamilyScript
Definition font.h:39
void RegisterFontClass()
Point g_pfnNewFont at NewFont() and register the "Font" class with Rnd::Manager.
Two-component vector, used for texture coordinates.
Definition vector2.h:10