Skip to content

foresight_font ​

foresight_font, gnuplot's font specs ("family:Bold:Italic,size") per text element, and their SVG attributes.

As gnuplot 6.0's svg terminal: the size after the first comma, :Bold and :Italic (or bold, italic) the weight and the style, the rest the family. A family is written to the SVG as given (the reader's fonts render it); font files (a path, .ttf) and gnuplot's mbfont: sets are not families an SVG can name: left out, as an empty family is.

Widths come from the compiled-in faces (foresight_fontdata): Liberation Sans (Arial's metrics) for the sans families and every family foresight does not have, Latin Modern Roman for the serif ones (family_face), each in four faces (regular, bold, italic, bold italic); text_advance sums the advance widths of a UTF-8 text and the kerning of its pairs, a character Liberation Sans lacks taken from Latin Modern, one no face has counting 0.556 em.

Source: src/lib/foresight_font.F90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
FAMILY_SANSinteger(kind=I4P)parameterLiberation Sans, faces 1-4.
FAMILY_SERIFinteger(kind=I4P)parameterLatin Modern Roman, faces 5-8.
MISSING_ADVANCEreal(kind=R8P)parameterAdvance of a character no face has [em].

Derived Types ​

font_object ​

A text element's font: a size, a family, the weight and the style; unset parts take the page's.

Components

NameTypeAttributesDescription
sizereal(kind=R8P)Size [px], 0 the page's.
familycharacter(len=48)CSS family, empty the page's.
boldlogicalBold.
italiclogicalItalic.

Type-Bound Procedures

NameAttributesDescription
is_setpass(self)Whether any part is set.
size_pxpass(self)The size [px], the page's if unset.

Subroutines ​

family_face ​

The compiled-in family standing for the CSS family (case and blanks ignored): Latin Modern Roman for serif, Latin Modern Roman, LM Roman, CMU Serif, Computer Modern; Liberation Sans for every other one, known telling whether the family is one of Liberation Sans' (empty, sans, sans-serif, Arial, Helvetica, Liberation Sans, Arimo) or a fallback.

Attributes: pure

fortran
subroutine family_face(family, index, known)

Arguments

NameTypeIntentAttributesDescription
familycharacter(len=*)inCSS family.
indexinteger(kind=I4P)outFAMILY_SANS or FAMILY_SERIF.
knownlogicaloutThe family is compiled in (not a fallback).

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 ​

is_set ​

Whether any part of the font is set.

Attributes: elemental

Returns: logical

fortran
function is_set(self) result(yes)

Arguments

NameTypeIntentAttributesDescription
selfclass(font_object)inFont.

Call graph

size_px ​

The size [px]: the font's, or page if unset.

Attributes: elemental

Returns: real(kind=R8P)

fortran
function size_px(self, page) result(size)

Arguments

NameTypeIntentAttributesDescription
selfclass(font_object)inFont.
pagereal(kind=R8P)inPage font size [px].

Call graph

font_of ​

The font of gnuplot's spec "family:Bold:Italic,size" (each part optional: ",8", ":Bold", "Times,14").

Attributes: pure

Returns: type(font_object)

fortran
function font_of(spec) result(font)

Arguments

NameTypeIntentAttributesDescription
speccharacter(len=*)inFont spec.

Call graph

font_attributes ​

The SVG attributes of font (leading blank each), its size size [px] if set (0: none): font-size, font-family (quoted when it holds a blank), font-weight, font-style.

Attributes: pure

Returns: character(len=:)

fortran
function font_attributes(font, size) result(text)

Arguments

NameTypeIntentAttributesDescription
fonttype(font_object)inFont.
sizereal(kind=R8P)inSize to write [px], 0 for none.

Call graph

face_of ​

The compiled-in face (foresight_fontdata, 1-8) of font: its family (family_face), weight and style.

Attributes: elemental

Returns: integer(kind=I4P)

fortran
function face_of(font) result(face)

Arguments

NameTypeIntentAttributesDescription
fonttype(font_object)inFont.

Call graph

text_advance ​

The width of the UTF-8 text set in face at size, in the unit of size: the advance widths of its characters and the kerning of each pair. A character a sans face lacks is taken from the serif face of the same style (Latin Modern, whose data holds the math symbols), not kerned; one no face has counts 0.556 em.

Attributes: pure

Returns: real(kind=R8P)

fortran
function text_advance(text, face, size) result(width)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inUTF-8 text.
faceinteger(kind=I4P)inFace (foresight_fontdata, 1-8).
sizereal(kind=R8P)inFont size (em).

Call graph

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