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 |
Calculate the pixel width of text using STB TrueType with UTF-8 support
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | text |
Calculate the pixel height of text using STB TrueType
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | text |
Get the ratio of font ascent to total height This is used to properly center text vertically
Clean up STB TrueType font system
Render text to image using STB TrueType with UTF-8 support
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=1), | intent(inout) | :: | image_data(*) | |||
integer, | intent(in) | :: | width | |||
integer, | intent(in) | :: | height | |||
integer, | intent(in) | :: | x | |||
integer, | intent(in) | :: | y | |||
character(len=*), | intent(in) | :: | text | |||
integer(kind=1), | intent(in) | :: | r | |||
integer(kind=1), | intent(in) | :: | g | |||
integer(kind=1), | intent(in) | :: | b |
Render rotated text to PNG image using STB TrueType with UTF-8 support
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=1), | intent(inout) | :: | image_data(*) | |||
integer, | intent(in) | :: | width | |||
integer, | intent(in) | :: | height | |||
integer, | intent(in) | :: | x | |||
integer, | intent(in) | :: | y | |||
character(len=*), | intent(in) | :: | text | |||
integer(kind=1), | intent(in) | :: | r | |||
integer(kind=1), | intent(in) | :: | g | |||
integer(kind=1), | intent(in) | :: | b | |||
real(kind=wp), | intent(in) | :: | angle |
Get font metrics in pixels for current font
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 |