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

◆ decompose_glyph() [2/2]

MAYAFLUX_API GlyphOutline MayaFlux::Portal::Text::decompose_glyph ( uint32_t  codepoint,
float  tolerance = 0.5F 
)

Decompose a Unicode codepoint using the default atlas pixel size.

Convenience overload that reads pixel_size from TypeFaceFoundry's default atlas. Requires set_default_font() to have been called.

Parameters
codepointUnicode codepoint.
toleranceFlatness tolerance in pixels.
Returns
GlyphOutline, or empty outline on failure.

Definition at line 231 of file GlyphOutline.cpp.

232{
233 auto* atlas = TypeFaceFoundry::instance().get_default_glyph_atlas();
234 if (!atlas) {
235 MF_ERROR(Journal::Component::Portal, Journal::Context::API,
236 "decompose_glyph: no default font set");
237 return GlyphOutline { .codepoint = codepoint };
238 }
239
240 auto& foundry = TypeFaceFoundry::instance();
241
242 FontFace* face = foundry.get_default_face();
243 if (!face) {
244 MF_ERROR(Journal::Component::Portal, Journal::Context::API,
245 "decompose_glyph: default face is null");
246 return GlyphOutline { .codepoint = codepoint };
247 }
248
249 return decompose_glyph(*face, codepoint, atlas->pixel_size(), tolerance);
250}
#define MF_ERROR(comp, ctx,...)
float tolerance
GlyphOutline decompose_glyph(FontFace &face, uint32_t codepoint, uint32_t pixel_size, float tolerance)
Decompose a Unicode codepoint into a tessellated polyline outline.
Vector outline for a single glyph as a flat polyline sequence.

References MayaFlux::Journal::API, MayaFlux::Portal::Text::GlyphOutline::codepoint, decompose_glyph(), MayaFlux::Portal::Text::TypeFaceFoundry::get_default_glyph_atlas(), MayaFlux::Portal::Text::TypeFaceFoundry::instance(), MF_ERROR, MayaFlux::Journal::Portal, and tolerance.

+ Here is the call graph for this function: