fortplot_tt_tables Module

TrueType table lookup and font initialization. Validates font signatures, finds tables in the table directory, and initializes a font by locating all required tables and the cmap encoding.



Functions

public pure function tt_is_font(data, offset) result(is_valid)

Check if data at offset contains a valid TrueType/OpenType signature. Recognizes: 00-01-00-00 (standard), "true", "typ1", "OTTO".

Arguments

Type IntentOptional Attributes Name
integer(kind=int8), intent(in) :: data(:)
integer, intent(in) :: offset

Return Value logical

public pure function tt_find_table(data, fontstart, tag) result(table_offset)

Find a table by its 4-byte tag in the table directory. Returns the table byte offset, or 0 if not found.

Arguments

Type IntentOptional Attributes Name
integer(kind=int8), intent(in) :: data(:)
integer, intent(in) :: fontstart
character(len=4), intent(in) :: tag

Return Value integer

public pure function tt_get_font_offset_for_index(data, index) result(offset)

Get font byte offset for a given index in a TTC collection. For a standalone font, index 0 returns 0. Returns -1 if the index is out of range or data is invalid.

Arguments

Type IntentOptional Attributes Name
integer(kind=int8), intent(in) :: data(:)
integer, intent(in) :: index

Return Value integer


Subroutines

public pure subroutine tt_init_font_tables(data, fontstart, loca, head, glyf, hhea, hmtx, kern, gpos, index_map, index_to_loc_format, num_glyphs, success)

Initialize a TrueType font by locating all required tables and the cmap encoding subtable. Sets success=.false. if required tables are missing, no glyf table is present (CFF not supported), or no usable cmap encoding is found.

Arguments

Type IntentOptional Attributes Name
integer(kind=int8), intent(in) :: data(:)
integer, intent(in) :: fontstart
integer, intent(out) :: loca
integer, intent(out) :: head
integer, intent(out) :: glyf
integer, intent(out) :: hhea
integer, intent(out) :: hmtx
integer, intent(out) :: kern
integer, intent(out) :: gpos
integer, intent(out) :: index_map
integer, intent(out) :: index_to_loc_format
integer, intent(out) :: num_glyphs
logical, intent(out) :: success