MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ get_or_rasterize() [2/2]

const GlyphMetrics * MayaFlux::Portal::Text::GlyphAtlas::get_or_rasterize ( FT_ULong  codepoint)

Convenience: look up by Unicode codepoint.

Tries the primary face first, then each fallback face in registration order, returning the first hit. Prefer the glyph_index overload when integrating with HarfBuzz output (primary face only, no fallback).

Parameters
codepointUnicode codepoint (e.g. U+0041 for 'A').
Returns
Pointer to cached GlyphMetrics, or nullptr if no face (primary or fallback) has this codepoint.

Definition at line 23 of file GlyphAtlas.cpp.

24{
25 if (!m_face.is_loaded()) {
27 "GlyphAtlas::get_or_rasterize: FontFace not loaded");
28 return nullptr;
29 }
30
31 if (const FT_UInt idx = FT_Get_Char_Index(m_face.get_face(), codepoint); idx != 0) {
32 return get_or_rasterize_from(m_face, idx);
33 }
34
35 for (FontFace* fallback : m_fallbacks) {
36 if (!fallback || !fallback->is_loaded()) {
37 continue;
38 }
39 if (const FT_UInt idx = FT_Get_Char_Index(fallback->get_face(), codepoint); idx != 0) {
40 return get_or_rasterize_from(*fallback, idx);
41 }
42 }
43
45 "GlyphAtlas: no glyph for codepoint U+{:04X} in primary or {} fallback face(s)",
46 static_cast<uint32_t>(codepoint), m_fallbacks.size());
47 return nullptr;
48}
#define MF_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
FT_Face get_face() const
Raw FT_Face handle for use by GlyphAtlas.
Definition FontFace.hpp:57
bool is_loaded() const
Returns true after a successful load() call.
Definition FontFace.hpp:51
std::vector< FontFace * > m_fallbacks
const GlyphMetrics * get_or_rasterize_from(FontFace &face, FT_UInt glyph_index)
@ API
API calls from external code.
@ Portal
High-level user-facing API layer.

References MayaFlux::Journal::API, MayaFlux::Portal::Text::FontFace::get_face(), get_or_rasterize_from(), MayaFlux::Portal::Text::FontFace::is_loaded(), m_face, m_fallbacks, MF_ERROR, MF_WARN, and MayaFlux::Journal::Portal.

+ Here is the call graph for this function: