|
scimesh 0.3.4
Headless CPU-only 3D software renderer for scientific mesh visualization
|
TrueType font loading, glyph rasterization and text measurement. More...


Go to the source code of this file.
Classes | |
| struct | scimesh::FontMetrics |
| Vertical metrics of a font at a given pixel size. More... | |
| struct | scimesh::GlyphBitmap |
| One rasterized glyph: an 8-bit coverage bitmap plus placement info. More... | |
| class | scimesh::Font |
| A TrueType font, loaded at a fixed pixel size, with a glyph cache. More... | |
Namespaces | |
| namespace | scimesh |
Functions | |
| std::string | scimesh::resolve_font_path (const std::string &path) |
| Turn a possibly empty font path into a path that exists. | |
| std::string | scimesh::default_font_path () |
Path of the bundled default font, or as overridden by the SCIMESH_FONT environment variable. | |
| Font | scimesh::cached_font (const std::string &path, float pixel_size) |
| Load a font, re-using an already loaded one when possible. | |
| void | scimesh::clear_font_cache () |
| Drop all fonts from the process-wide font cache. | |
TrueType font loading, glyph rasterization and text measurement.
scimesh draws text labels by rasterizing glyphs with stb_truetype (a single-header, public-domain TrueType parser) and blending the resulting 8-bit coverage bitmaps into the output image. No system font, font server or graphics stack is involved, so text rendering works headless exactly like the rest of the renderer.
The package bundles Inter-Regular.ttf (SIL Open Font License 1.1), see default_font_path(), so labels work out of the box. Any other .ttf file can be used instead — pass its path to TextLayer::font_file, or set the SCIMESH_FONT environment variable to override the default.
This header is the low-level font API: loading, metrics, glyph coverage bitmaps and text measurement. Text placement (world vs. screen space, anchoring, depth testing, halos) lives in TextLayer, see text.h.
Definition in file font.h.