| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=int8), | public, | allocatable | :: | data(:) | |||
| integer, | public | :: | fontstart | = | 0 | ||
| integer, | public | :: | num_glyphs | = | 0 | ||
| integer, | public | :: | loca | = | 0 | ||
| integer, | public | :: | head | = | 0 | ||
| integer, | public | :: | glyf | = | 0 | ||
| integer, | public | :: | hhea | = | 0 | ||
| integer, | public | :: | hmtx | = | 0 | ||
| integer, | public | :: | kern | = | 0 | ||
| integer, | public | :: | gpos | = | 0 | ||
| integer, | public | :: | index_map | = | 0 | ||
| integer, | public | :: | index_to_loc_format | = | 0 | ||
| logical, | public | :: | initialized | = | .false. |
Load a TrueType font from file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(truetype_font_t), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | filepath |
Release all font resources.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(truetype_font_t), | intent(inout) | :: | self |
Get scale factor for desired pixel height.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(truetype_font_t), | intent(in) | :: | self | |||
| real(kind=dp), | intent(in) | :: | pixel_height |
Get vertical font metrics (unscaled).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(truetype_font_t), | intent(in) | :: | self | |||
| integer, | intent(out) | :: | ascent | |||
| integer, | intent(out) | :: | descent | |||
| integer, | intent(out) | :: | line_gap |
Get horizontal metrics for a codepoint (unscaled).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(truetype_font_t), | intent(in) | :: | self | |||
| integer, | intent(in) | :: | codepoint | |||
| integer, | intent(out) | :: | advance_width | |||
| integer, | intent(out) | :: | left_side_bearing |
Map a Unicode codepoint to a glyph index.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(truetype_font_t), | intent(in) | :: | self | |||
| integer, | intent(in) | :: | codepoint |
Get bitmap bounding box for a codepoint.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(truetype_font_t), | intent(in) | :: | self | |||
| integer, | intent(in) | :: | codepoint | |||
| real(kind=dp), | intent(in) | :: | scale_x | |||
| real(kind=dp), | intent(in) | :: | scale_y | |||
| integer, | intent(out) | :: | ix0 | |||
| integer, | intent(out) | :: | iy0 | |||
| integer, | intent(out) | :: | ix1 | |||
| integer, | intent(out) | :: | iy1 |
Render a codepoint to an 8-bit grayscale bitmap. The bitmap is returned as an allocatable int8 array.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(truetype_font_t), | intent(in) | :: | self | |||
| real(kind=dp), | intent(in) | :: | scale_x | |||
| real(kind=dp), | intent(in) | :: | scale_y | |||
| 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 |
Render a codepoint into a user-provided buffer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(truetype_font_t), | intent(in) | :: | self | |||
| integer(kind=int8), | intent(inout) | :: | output(:) | |||
| integer, | intent(in) | :: | out_w | |||
| integer, | intent(in) | :: | out_h | |||
| integer, | intent(in) | :: | out_stride | |||
| real(kind=dp), | intent(in) | :: | scale_x | |||
| real(kind=dp), | intent(in) | :: | scale_y | |||
| integer, | intent(in) | :: | codepoint |