NAME
lam_font_core - liblamina font management
- Font loading and lifecycle functions.
SYNOPSIS
Functions
Load a bitmap font from an image file.
Load a TrueType/OpenType font via FreeType2.
Attach a fallback TTF font for missing codepoints.
Return 1 if font_ref is a FreeType TTF/OTF font, 0 otherwise.
Query the line height (pixels) for a font at a given pixel size.
Query the typographic ascent (baseline offset from top, pixels).
Unload a font and free its resources.
Detailed Description
Font loading and lifecycle functions.
Function Documentation
int lam_font_add_fallback (uint32_t font_ref, uint32_t fallback_ref)
Attach a fallback TTF font for missing codepoints.
Parameters
font_ref Primary TTF font handle.
fallback_ref Fallback TTF font handle.
Returns
0 on success, -1 on error.
void lam_font_close (uint32_t font_ref)
Unload a font and free its resources.
Parameters
font_ref Font handle returned by lam_font_open() or lam_font_open_ttf().
uint32_t lam_font_line_height (uint32_t font_ref, uint32_t px_size)
Query the line height (pixels) for a font at a given pixel size. For bitmap fonts, px_size acts as integer scale (0 => 1). For TTF fonts, px_size == 0 uses the font's default pixel size.
uint32_t lam_font_open (const char * png_path, unsigned cell_w, unsigned cell_h, uint8_t first, uint8_t last)
Load a bitmap font from an image file. Loads a pre-rendered font atlas (e.g. generated from BDF) and registers it in liblamina’s internal font table.
Parameters
png_path Path to the font atlas (PNG).
cell_w Width of each glyph cell.
cell_h Height of each glyph cell.
first First character code in the atlas.
last Last character code in the atlas.
Returns
Font handle (font_ref) or CM_MISS on error.
uint32_t lam_font_open_ttf (const char * ttf_path, uint32_t px_size)
Load a TrueType/OpenType font via FreeType2. Supports proportional and monospace fonts, full UTF-8 decoding, dynamic glyph atlas caching, and fallback chains.
Parameters
ttf_path Path to a .ttf/.otf font file.
px_size Default pixel height (e.g. 14 or 16; 0 defaults to 16).
Returns
Font handle (font_ref) or CM_MISS on error.
Author
Generated automatically by Doxygen for liblamina from the source code.