Struct AsciiFont
Defined in File stbfont.h
Inheritance Relationships
Base Type
public CE::Text::Legacy::Font(Struct Font)
Struct Documentation
-
struct AsciiFont : public CE::Text::Legacy::Font
Declaration:
finalBaked ASCII glyph quads, advances, and alpha atlas.
Layout reads immutable metrics, so published text commands can share a font without changing it.
Public Functions
-
explicit AsciiFont(AsciiFontData data)
Retain/move baked resources and copy advances/line height.
Reject missing geometry/atlas; metrics are copied without validation. Native use requires the resources’ backend domain.
-
~AsciiFont() override = default
Release retained handles; callers’ resource copies remain independently owned.
-
virtual std::vector<GlyphPlacement> layout(std::string_view text, LayoutOptions options = LayoutOptions{}) const override
Declaration:
[[nodiscard]]Return owned baked pixel offsets after UTF-8 decoding.
Newline moves down one line, CR is ignored, tab advances four spaces, and each unsupported scalar/malformed subpart selects ?. Spaces advance without a quad. alternate_bank throws; no shaping or non-ASCII glyphs are supplied.
-
inline const CE::Rendering::Geometry::Buffer2D &glyph_geometry() const
Declaration:
[[nodiscard]]Borrow baked geometry; keep the font or a retained geometry handle alive.
Native access requires the live backend domain.
-
inline const CE::Rendering::Resources::Image &glyph_atlas() const
Declaration:
[[nodiscard]]Borrow the baked atlas; keep the font or copied atlas handle alive for the reference lifetime.
-
template<typename SubmitGlyph>
inline void for_each_glyph(std::string_view text, SubmitGlyph &&submit) const Synchronously invoke submit(index,x,y) for each visible baked glyph using the layout decoding/newline/tab policy.
Index addresses a six-vertex quad; X/Y use local Y-up pixels. No text/callback is retained and the font is unchanged. Callback/allocation failures propagate; prior callback effects are not rolled back.
- Template Parameters:
SubmitGlyph – Callable accepting a glyph-slot index and two float offsets.
Public Static Functions
Declaration:
[[nodiscard]]Bake printable ASCII from the first face of the supplied file at positive font_size pixels, then upload on the provider owner/current context.
Empty material requests the provider’s default text material. File, bake, provider and allocation failures throw; no cache entry is published and transient native uploads retire normally. Discovery is optional and bundled fonts use the same path.
See also
-
explicit AsciiFont(AsciiFontData data)