fortplot_mathtext Module

Mathematical text rendering with superscripts and subscripts Supports matplotlib-like syntax: x^2, y_i, x_{text}, y^{superscript}



Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: ELEMENT_NORMAL = 0
integer, public, parameter :: ELEMENT_SUPERSCRIPT = 1
integer, public, parameter :: ELEMENT_SUBSCRIPT = 2
integer, public, parameter :: ELEMENT_SQRT = 3
integer, public, parameter :: ELEMENT_FRACTION = 4
integer, public, parameter :: ELEMENT_SPACE = 5

Derived Types

type, public ::  mathtext_element_t

Components

Type Visibility Attributes Name Initial
character(len=:), public, allocatable :: text
character(len=:), public, allocatable :: denominator
integer, public :: element_type = ELEMENT_NORMAL
real(kind=wp), public :: font_size_ratio = 1.0_wp
real(kind=wp), public :: vertical_offset = 0.0_wp
logical, public :: italic = .false.

True for runs that originate inside a '$...$' math segment. matplotlib renders math variables in italic; backends apply a synthetic oblique shear to alphabetic glyphs of italic runs.


Functions

public recursive function parse_mathtext(input_text, math_mode) result(elements)

Parse mathematical text into renderable elements

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: input_text
logical, intent(in), optional :: math_mode

Return Value type(mathtext_element_t), allocatable, (:)

public pure function mathtext_scripts_share_anchor(elements, i) result(shared)

Arguments

Type IntentOptional Attributes Name
type(mathtext_element_t), intent(in) :: elements(:)
integer, intent(in) :: i

Return Value logical