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
| Name | Kind | Module | Description |
|---|---|---|---|
has_math | function | foresight_math | Whether text holds math (next_math). |
Contents
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
MISSING_ADVANCE | real(kind=R8P) | parameter | Advance of a character no face has [em]. |
Derived Types
placed_glyph
A glyph of a text.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
face | integer(kind=I4P) | Face holding it, 1-8, MATH_FACE (foresight_math); 0 for a rule. | |
glyph | integer(kind=I4P) | Glyph index (0: a character no face has, drawn as nothing). | |
unicode | integer(kind=I4P) | Character. | |
x | real(kind=R8P) | Origin along the baseline from the text's start [px]. | |
y | real(kind=R8P) | Origin across the baseline [px, downward]. | |
size | real(kind=R8P) | Font size [px]. | |
width | real(kind=R8P) | A rule's width [px] (its origin its top left). | |
height | real(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.
subroutine layout_text(text, markup, face, base, sup, glyphs, count, width, math)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
text | character(len=*) | in | Text, UTF-8. | |
markup | logical | in | Enhanced markup read. | |
face | integer(kind=I4P) | in | Base face, 1-8. | |
base | real(kind=R8P) | in | Base font size [px]. | |
sup | character(len=*) | in | Superscript, empty for none. | |
glyphs | type(placed_glyph) | out | allocatable | Glyphs. |
count | integer(kind=I4P) | out | Glyphs placed. | |
width | real(kind=R8P) | out | Width [px]. | |
math | logical | in | optional | $...$ 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
subroutine decode(text, k, code, n)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
text | character(len=*) | in | UTF-8 text. | |
k | integer(kind=I4P) | in | First byte. | |
code | integer(kind=I4P) | out | Code point. | |
n | integer(kind=I4P) | out | Bytes. |
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)
function math_text_width(text, markup, face, base, sup) result(width)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
text | character(len=*) | in | Text, UTF-8. | |
markup | logical | in | Enhanced markup read. | |
face | integer(kind=I4P) | in | Base face, 1-8. | |
base | real(kind=R8P) | in | Base font size [px]. | |
sup | character(len=*) | in | Superscript, empty for none. |
Call graph
unescape_dollars
text with \$ as $.
Attributes: pure
Returns: character(len=:)
function unescape_dollars(text) result(plain)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
text | character(len=*) | in | Text. |
Call graph