MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Portal::Text Namespace Reference

Classes

class  FontFace
 Owns a single FT_Face loaded from a file path. More...
 
class  GlyphAtlas
 Rasterizes and packs glyphs from a FontFace into a TextureContainer. More...
 
struct  GlyphMetrics
 Per-glyph layout and UV data produced by GlyphAtlas. More...
 
struct  GlyphQuad
 Screen-space quad for one rasterized glyph. More...
 
struct  LayoutResult
 Result of lay_out(), carrying the quads and the final pen position. More...
 
struct  PressParams
 Construction parameters for press(). More...
 
class  TypeFaceFoundry
 Singleton owner of the FT_Library handle. More...
 

Enumerations

enum class  ImpressResult : uint8_t { Ok , Overflow }
 Result of an impress() call. More...
 
enum class  RedrawPolicy : uint8_t { Clip , Fit }
 Policy controlling TextBuffer reuse behaviour in repress(). More...
 

Functions

std::shared_ptr< LayoutResultcreate_layout (std::string_view text, float pen_x=0.F, float pen_y=0.F, uint32_t wrap_w=0)
 Lay out a UTF-8 string into screen-space glyph quads using the default atlas.
 
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.
 
GlyphAtlasget_default_atlas ()
 Return the default GlyphAtlas, or nullptr if set_default_font() has not been called successfully.
 
ImpressResult impress (const std::shared_ptr< Buffers::TextBuffer > &target, std::string_view text, glm::vec4 color={ 1.F, 1.F, 1.F, 1.F })
 Append a UTF-8 string into an existing TextBuffer at the current cursor.
 
bool initialize (std::optional< Core::TextConfig > config)
 Initialize Portal::Text.
 
void ink_quads (const std::shared_ptr< Buffers::TextBuffer > &target, std::span< const GlyphQuad > quads, glm::vec4 color)
 Rasterize a mutated quad span into an existing TextBuffer.
 
bool is_initialized ()
 Returns true after a successful initialize() call.
 
LayoutResult lay_out (std::string_view text, GlyphAtlas &atlas, float pen_x=0.F, float pen_y=0.F, uint32_t wrap_w=0)
 Lay out a UTF-8 string into a sequence of screen-space quads.
 
std::shared_ptr< Buffers::TextBufferpress (std::string_view text, const PressParams &params={})
 Composite a UTF-8 string into a new TextBuffer.
 
void rasterize_quads (std::span< const GlyphQuad > quads, GlyphAtlas &atlas, glm::vec4 color, uint8_t *dst, uint32_t buf_w, uint32_t buf_h)
 Write glyph quads into a caller-provided RGBA8 pixel buffer.
 
bool repress (const std::shared_ptr< Buffers::TextBuffer > &target, std::string_view text, glm::vec4 color={ 1.F, 1.F, 1.F, 1.F }, RedrawPolicy policy=RedrawPolicy::Clip)
 Re-composite a UTF-8 string into an existing TextBuffer.
 
bool set_default_font (const std::string &font_path, uint32_t pixel_size=24, uint32_t atlas_size=512)
 Load a font file and create the default GlyphAtlas at a given size.
 
bool 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.
 
void shutdown ()
 Shutdown Portal::Text.