Skip to content

foresight_textlayout ​

foresight_textlayout, a text's glyphs placed along its baseline.

The layout of the devices that draw text from the compiled-in glyphs (the SVG device's fontglyphs): gnuplot's enhanced runs (sizes, shifts, step-backs, faces; invisible runs advance without glyphs), each character's glyph in its face or, for one Liberation Sans lacks, Latin Modern's of the same style, kerned with the previous glyph of the same face (the rules of foresight_font text_advance, so the layout's widths are the measured ones); a superscript at 0.75 size raised 0.3375 font sizes. With math, the $...$ runs are TeX math (foresight_math): their glyphs (in the math font, MATH_FACE, or the serif text faces) and rules (fraction bars, radical rules: face 0) placed as LaTeX sets them; \$ is a dollar.

Source: src/lib/foresight_textlayout.F90

Dependencies

Re-exports ​

NameKindModuleDescription
has_mathfunctionforesight_mathWhether text holds math (next_math).

Contents ​

Variables ​

NameTypeAttributesDescription
MISSING_ADVANCEreal(kind=R8P)parameterAdvance of a character no face has [em].

Derived Types ​

placed_glyph ​

A glyph of a text.

Components

NameTypeAttributesDescription
faceinteger(kind=I4P)Face holding it, 1-8, MATH_FACE (foresight_math); 0 for a rule.
glyphinteger(kind=I4P)Glyph index (0: a character no face has, drawn as nothing).
unicodeinteger(kind=I4P)Character.
xreal(kind=R8P)Origin along the baseline from the text's start [px].
yreal(kind=R8P)Origin across the baseline [px, downward].
sizereal(kind=R8P)Font size [px].
widthreal(kind=R8P)A rule's width [px] (its origin its top left).
heightreal(kind=R8P)A rule's height [px].

Subroutines ​

layout_text ​

The glyphs of the UTF-8 text (enhanced markup read if markup) in face at base [px], its superscript sup after it: glyphs(1:count) from the text's start, and its width [px] (as text_advance and markup_width); with math, its $...$ runs set as TeX math.

fortran
subroutine layout_text(text, markup, face, base, sup, glyphs, count, width, math)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText, UTF-8.
markuplogicalinEnhanced markup read.
faceinteger(kind=I4P)inBase face, 1-8.
basereal(kind=R8P)inBase font size [px].
supcharacter(len=*)inSuperscript, empty for none.
glyphstype(placed_glyph)outallocatableGlyphs.
countinteger(kind=I4P)outGlyphs placed.
widthreal(kind=R8P)outWidth [px].
mathlogicalinoptional$...$ runs are TeX math.

Call graph

decode ​

The code point of the UTF-8 character at byte k of text and its bytes (a malformed byte: its own code).

Attributes: pure

fortran
subroutine decode(text, k, code, n)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inUTF-8 text.
kinteger(kind=I4P)inFirst byte.
codeinteger(kind=I4P)outCode point.
ninteger(kind=I4P)outBytes.

Call graph

Functions ​

math_text_width ​

The width [px] of a text holding math (layout_text's with math): its text runs measured as text_advance and markup_width measure them (markup: enhanced), its math runs as foresight_math sets them, its superscript.

Attributes: pure

Returns: real(kind=R8P)

fortran
function math_text_width(text, markup, face, base, sup) result(width)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText, UTF-8.
markuplogicalinEnhanced markup read.
faceinteger(kind=I4P)inBase face, 1-8.
basereal(kind=R8P)inBase font size [px].
supcharacter(len=*)inSuperscript, empty for none.

Call graph

unescape_dollars ​

text with \$ as $.

Attributes: pure

Returns: character(len=:)

fortran
function unescape_dollars(text) result(plain)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.

Call graph

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