Skip to content

foresight_enhanced ​

foresight_enhanced, gnuplot's enhanced text: the markup of titles, labels and key entries as styled runs.

As gnuplot 6.0 (its svg terminal): ^ a superscript and _ a subscript of the next character or {group}, at 0.8 times the size, raised 0.5 or lowered 0.3 of the current size (nested: again); {/Font:Bold=N text} changes the font (/Symbol the Greek letters, written here as Unicode letters where gnuplot writes the Symbol font), its size (=N absolute, *F relative), weight (:Bold) and style (:Italic); @ makes the next element take no room (the one after it written over it, as a@^b_c); & makes the next element invisible, keeping its room; ~a{.8-} overprints the second element on the first, raised by the fraction of the size; \ makes the next character literal. Widths come from the compiled-in fonts (foresight_font): each run in its face (its family, else the base one; its weight and style, or the base ones) at its size, kerned.

Source: src/lib/foresight_enhanced.F90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
HEXcharacter(len=*)parameterHexadecimal digits.

Derived Types ​

enhanced_run ​

A piece of text in one style.

Components

NameTypeAttributesDescription
sizereal(kind=R8P)Size, times the base size.
shiftreal(kind=R8P)Baseline offset up, times the base size.
backreal(kind=R8P)Step back before it, times the base size.
boldlogicalBold.
italiclogicalItalic.
hiddenlogicalInvisible, its room kept (&).
phantomlogicalNo room taken (@): the next run steps back over it.
symbollogicalIn the Symbol font: the Greek letters (Latin in text).
textcharacter(len=:)allocatableText.
familycharacter(len=:)allocatableFont family, empty for the default.

style_state ​

The style of the text being read.

Components

NameTypeAttributesDescription
sizereal(kind=R8P)Size, times the base size.
shiftreal(kind=R8P)Baseline offset up, times the base size.
boldlogicalBold.
italiclogicalItalic.
hiddenlogicalInvisible.
phantomlogicalNo room taken.
symbollogicalThe Greek letters of the Symbol font.
familycharacter(len=:)allocatableFont family, empty for the default.

Subroutines ​

enhanced_runs ​

The runs of the enhanced text.

Attributes: pure

fortran
subroutine enhanced_runs(text, runs)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText with markup.
runstype(enhanced_run)outallocatableRuns.

Call graph

sequence ​

The elements from pos to the end of text, or to the } closing a group (group, pos left after it).

Attributes: pure, recursive

fortran
subroutine sequence(text, pos, state, runs, group)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.
posinteger(kind=I4P)inoutNext character.
statetype(style_state)inStyle.
runstype(enhanced_run)inoutallocatableRuns.
grouplogicalinInside {...}.

Call graph

element ​

One element at pos: a character, an escaped one, a {group}, a font group, or a markup construct. Code point.

Attributes: pure, recursive

fortran
subroutine element(text, pos, state, runs)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.
posinteger(kind=I4P)inoutNext character.
statetype(style_state)inStyle.
runstype(enhanced_run)inoutallocatableRuns.

Call graph

font_spec ​

/Font:Bold:Italic=N or a relative size *F after { (at pos, left on the text after the blank ending it): the style.

Attributes: pure

fortran
subroutine font_spec(text, pos, state)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.
posinteger(kind=I4P)inoutNext character.
statetype(style_state)inoutStyle.

Call graph

put ​

Append piece in state, joined to the last run if the style is the same.

Attributes: pure

fortran
subroutine put(piece, state, runs)

Arguments

NameTypeIntentAttributesDescription
piececharacter(len=*)inText.
statetype(style_state)inStyle.
runstype(enhanced_run)inoutallocatableRuns.

Call graph

Functions ​

has_markup ​

Whether text holds a character of the markup (^ _ { } @ & ~ \).

Attributes: pure

Returns: logical

fortran
function has_markup(text) result(yes)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.

Call graph

runs_width ​

Width of runs [base size], each run in its face (run_face) at its size; phantom runs take none (all do with all).

Attributes: pure

Returns: real(kind=R8P)

fortran
function runs_width(runs, all, base) result(w)

Arguments

NameTypeIntentAttributesDescription
runstype(enhanced_run)inRuns.
alllogicalinoptionalPhantom runs counted.
baseinteger(kind=I4P)inoptionalBase face (foresight_fontdata, 1-8), 1 if absent.

Call graph

run_face ​

The face of run (foresight_fontdata, 1-8): its family if set, else the base face's; bold or italic if the run or the base face is.

Attributes: pure

Returns: integer(kind=I4P)

fortran
function run_face(run, base) result(face)

Arguments

NameTypeIntentAttributesDescription
runtype(enhanced_run)inRun.
baseinteger(kind=I4P)inBase face, 1-8.

Call graph

markup_width ​

Width of the enhanced text [px] at font_size, its runs in their faces (base, 1-8, the face of the text without markup; 1 if absent).

Attributes: pure

Returns: real(kind=R8P)

fortran
function markup_width(text, font_size, base) result(width)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText with markup.
font_sizereal(kind=R8P)inBase font size [px].
baseinteger(kind=I4P)inoptionalBase face.

Call graph

markup_literal ​

The text read as it is by the enhanced text parser: every markup character escaped with a backslash (the noenhanced texts whose width is measured where the device cannot be told).

Attributes: pure

Returns: character(len=:)

fortran
function markup_literal(text) result(literal)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.

markup_plain ​

The visible characters of the enhanced text, the markup dropped (the text devices; the Symbol font as its Latin letters, as gnuplot's dumb terminal).

Attributes: pure

Returns: character(len=:)

fortran
function markup_plain(text) result(plain)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText with markup.

Call graph

markup_svg ​

The SVG <tspan> elements of the enhanced text at font_size [px], as gnuplot's svg terminal writes them: a font size and a dy where they change, dx stepping back, fill="none" for the invisible runs; the texts XML escaped. (No escape function as an argument: nvfortran 26.9 crashes passing a function with a deferred-length result, see foresight#3.)

Attributes: pure

Returns: character(len=:)

fortran
function markup_svg(text, font_size) result(svg)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText with markup.
font_sizereal(kind=R8P)inBase font size [px].

Call graph

shown ​

The text of run as drawn: the Greek letters in the Symbol font.

Attributes: pure

Returns: character(len=:)

fortran
function shown(run) result(text)

Arguments

NameTypeIntentAttributesDescription
runtype(enhanced_run)inRun.

Call graph

greek ​

The letters of text as the Greek letters of the Symbol font (Adobe's encoding), in UTF-8, and the characters 160-255 as its symbols (\362 the integral, \245 infinity); others as they are.

Attributes: pure

Returns: character(len=:)

fortran
function greek(text) result(g)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inLatin letters.

Call graph

utf8_length ​

Bytes of the UTF-8 character starting with lead.

Attributes: pure

Returns: integer(kind=I4P)

fortran
function utf8_length(lead) result(n)

Arguments

NameTypeIntentAttributesDescription
leadcharacter(len=1)inFirst byte.

Call graph

characters ​

Characters of the UTF-8 text (continuation bytes not counted).

Attributes: pure

Returns: integer(kind=I4P)

fortran
function characters(text) result(n)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.

Call graph

number_of ​

The leading decimal number of text, 0 if none.

Attributes: pure

Returns: real(kind=R8P)

fortran
function number_of(text) result(v)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.

Call graph

fixed ​

v with two decimals, no trailing zeros (gnuplot writes 9.6, -6.00).

Attributes: pure

Returns: character(len=:)

fortran
function fixed(v) result(s)

Arguments

NameTypeIntentAttributesDescription
vreal(kind=R8P)inValue.

Call graph

Released under the GPL v3, BSD 2-Clause, BSD 3-Clause or MIT License.