TrueType font metrics: scale factors, vertical/horizontal metrics, glyph offsets, and bounding boxes. Pure Fortran implementations operating directly on the font byte array via fortplot_tt_binary.
Compute scale factor to achieve a desired pixel height. Uses ascent - descent from the hhea table.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int8), | intent(in) | :: | data(:) | |||
| integer, | intent(in) | :: | hhea | |||
| real(kind=dp), | intent(in) | :: | height |
Get byte offset to a glyph in the glyf table. Returns -1 for empty glyphs or invalid indices.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int8), | intent(in) | :: | data(:) | |||
| integer, | intent(in) | :: | loca | |||
| integer, | intent(in) | :: | glyf | |||
| integer, | intent(in) | :: | index_to_loc_format | |||
| integer, | intent(in) | :: | num_glyphs | |||
| integer, | intent(in) | :: | glyph_index |
Read vertical font metrics (unscaled) from the hhea table.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int8), | intent(in) | :: | data(:) | |||
| integer, | intent(in) | :: | hhea | |||
| integer, | intent(out) | :: | ascent | |||
| integer, | intent(out) | :: | descent | |||
| integer, | intent(out) | :: | line_gap |
Read horizontal metrics for a glyph (unscaled) from the hmtx table. Glyphs beyond numOfLongHorMetrics share the last advance width.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int8), | intent(in) | :: | data(:) | |||
| integer, | intent(in) | :: | hhea | |||
| integer, | intent(in) | :: | hmtx | |||
| integer, | intent(in) | :: | glyph_index | |||
| integer, | intent(out) | :: | advance_width | |||
| integer, | intent(out) | :: | left_side_bearing |
Get bounding box of a glyph in unscaled font coordinates.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int8), | intent(in) | :: | data(:) | |||
| integer, | intent(in) | :: | loca | |||
| integer, | intent(in) | :: | glyf | |||
| integer, | intent(in) | :: | index_to_loc_format | |||
| integer, | intent(in) | :: | num_glyphs | |||
| integer, | intent(in) | :: | glyph_index | |||
| integer, | intent(out) | :: | x0 | |||
| integer, | intent(out) | :: | y0 | |||
| integer, | intent(out) | :: | x1 | |||
| integer, | intent(out) | :: | y1 | |||
| logical, | intent(out) | :: | found |
Get bitmap bounding box in pixel coordinates (y-flipped).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int8), | intent(in) | :: | data(:) | |||
| integer, | intent(in) | :: | loca | |||
| integer, | intent(in) | :: | glyf | |||
| integer, | intent(in) | :: | index_to_loc_format | |||
| integer, | intent(in) | :: | num_glyphs | |||
| integer, | intent(in) | :: | glyph_index | |||
| 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 |