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

◆ set_default_font() [2/2]

MAYAFLUX_API bool MayaFlux::Portal::Text::set_default_font ( std::string_view  family,
std::string_view  style,
uint32_t  pixel_size,
uint32_t  atlas_size = 512 
)

Locate a system font by family and style, then load it as the default.

Delegates font path resolution to find_font, then calls the path-based overload. Returns false and logs if the family cannot be located on the current platform.

Parameters
familyFont family name, e.g. "JetBrains Mono".
styleStyle hint, e.g. "Medium", "Bold".
pixel_sizeGlyph height in pixels.
atlas_sizeAtlas texture dimension (power of two, default 512).
Returns
true on success.

Definition at line 82 of file Text.cpp.

87{
88 const auto path = find_font(family, style);
89 if (!path) {
90 MF_ERROR(Journal::Component::Portal, Journal::Context::API,
91 "set_default_font: could not locate '{}{}{}' on this system",
92 family,
93 style.empty() ? "" : " ",
94 style);
95 return false;
96 }
97 return set_default_font(*path, pixel_size, atlas_size);
98}
#define MF_ERROR(comp, ctx,...)
MAYAFLUX_API std::optional< std::string > find_font(std::string_view family, std::string_view style={})
Locate a system font file by family name and optional style.

References MayaFlux::Journal::API, find_font(), MF_ERROR, MayaFlux::Journal::Portal, and set_default_font().

Referenced by initialize(), and set_default_font().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: