Initialize STB TrueType font system with robust font discovery
Find font by name in typical system locations
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | font_name | |||
| character(len=256), | intent(out) | :: | font_path |
Find any available font using same priority order as system initialization
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=256), | intent(out) | :: | font_path |
Get font ascent ratio for baseline positioning
Get font scale for a specific pixel height
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | pixel_height |
Set preferred font and reinitialize if needed. Call before rendering to switch fonts for a style mode.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | font_name |
Clean up text system resources
Get font metrics in pixels for current font and scale
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(out) | :: | ascent_pixels | |||
| real(kind=wp), | intent(out) | :: | descent_pixels | |||
| real(kind=wp), | intent(out) | :: | line_gap_pixels | |||
| logical, | intent(out) | :: | success |
Rasterise codepoint at the primary-font scale, drawing it from a
fallback font when the primary font has no such glyph.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | scale | |||
| integer, | intent(in) | :: | codepoint | |||
| integer(kind=int8), | intent(out), | allocatable | :: | bitmap(:) | ||
| integer, | intent(out) | :: | width | |||
| integer, | intent(out) | :: | height | |||
| integer, | intent(out) | :: | xoff | |||
| integer, | intent(out) | :: | yoff |
Horizontal metrics in primary-font units, from the font that draws the glyph.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | codepoint | |||
| integer, | intent(out) | :: | advance_width | |||
| integer, | intent(out) | :: | left_side_bearing |
Bitmap box at the primary-font scale, from the drawing font.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | codepoint | |||
| real(kind=wp), | intent(in) | :: | scale | |||
| integer, | intent(out) | :: | ix0 | |||
| integer, | intent(out) | :: | iy0 | |||
| integer, | intent(out) | :: | ix1 | |||
| integer, | intent(out) | :: | iy1 |