[−][src]Module stb::easy_font
Quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc Intended for when you just want to get some text displaying in a 3D app as quickly as possible.
Rust implementation notes:
stb_easy_font_print
accepts a buffer for quads with the size of your choice.
Currently stb
C API offers no way to predict buffer's size depending on text string.
If the buffer is not large enought, quads will be truncated.
Structs
Vertex | Font quad vertex. You can ignore z and color if you get them from elsewhere. This format was chosen in the hopes it would make it easier for you to reuse existing vertex-buffer-drawing code. |
Functions
stb_easy_font_height | Takes a string and returns the vertical size (which can vary if |
stb_easy_font_print | Takes a string (which can contain '\n') and fills out a vertex buffer with renderable data to
draw the string. Output data assumes increasing x is rightwards, increasing y is downwards.
The vertex data is divided into quads, i.e. there are four vertices in the vertex buffer for each quad.
If you pass in |
stb_easy_font_spacing | Use positive values to expand the space between characters, and small negative values (no smaller than -1.5) to contract the space between characters. E.g. spacing = 1 adds one "pixel" of spacing between the characters. spacing = -1 is reasonable but feels a bit too compact to me; -0.5 is a reasonable compromise as long as you're scaling the font up. |
stb_easy_font_width | Takes a string and returns the horizontal size |