fortplot_tt_outlines Module

TrueType glyph outline extraction. Parses the glyf table to extract vertex data (moves, lines, quadratic bezier curves) for simple and composite glyphs. Fortran port of stbtt__GetGlyphShapeTT from stb_truetype.h lines 1658-1895.



Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: TT_VMOVE = 1
integer, public, parameter :: TT_VLINE = 2
integer, public, parameter :: TT_VCURVE = 3

Derived Types

type, public ::  tt_vertex_t

Components

Type Visibility Attributes Name Initial
integer, public :: x
integer, public :: y
integer, public :: cx
integer, public :: cy
integer, public :: vtype

Functions

public pure function tt_set_vertex(vtype, x, y, cx, cy) result(v)

Construct a vertex with the given type and coordinates.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: vtype
integer, intent(in) :: x
integer, intent(in) :: y
integer, intent(in) :: cx
integer, intent(in) :: cy

Return Value type(tt_vertex_t)


Subroutines

public subroutine tt_get_glyph_shape(data, loca, glyf, index_to_loc_format, num_glyphs, glyph_index, vertices, nvertices)

Extract glyph outline as an array of move/line/curve vertices. Handles simple glyphs (numberOfContours > 0) and composite glyphs (numberOfContours < 0) with recursive component resolution.

Arguments

Type IntentOptional 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
type(tt_vertex_t), intent(out), allocatable :: vertices(:)
integer, intent(out) :: nvertices