|
scimesh 0.3.4
Headless CPU-only 3D software renderer for scientific mesh visualization
|
Implementation of the text layer (see text.h). More...
#include <scimesh/text.h>#include <scimesh/math_utils.h>#include <algorithm>#include <cmath>#include <cstdint>#include <limits>#include <stdexcept>#include <vector>
Go to the source code of this file.
Namespaces | |
| namespace | scimesh |
| namespace | scimesh::detail |
| Internal helpers of the text renderer. | |
Functions | |
| void | scimesh::draw_text (Image &image, const std::string &text, const Font &font, float x, float baseline_y, const TextDrawStyle &style=TextDrawStyle()) |
| Draw text into an image at a given position and baseline. | |
| TextExtent | scimesh::measure_text (const std::string &text, float size, const std::string &font_file="", float line_spacing=1.2f) |
| Measure a (possibly multi-line) string in a given font and size. | |
| void | scimesh::detail::render_text_layers (const std::vector< TextNodeRef > &layers, Image &output, const Mat4 &view_projection, float pixel_scale, const std::vector< float > &z_buffer, const Color &default_color) |
| Draw all text layers into an already rendered image. | |
Implementation of the text layer (see text.h).
Rendering works in "screen" coordinates with the origin at the top left and y growing downwards, which is both what ndc_to_screen() returns and the row order of Image (row 0 is the top row of the written file). Glyph bitmaps from stb_truetype are top-down as well, so no flipping is involved anywhere.
Definition in file text.cpp.