Skip to main content

Module font

Module font 

Source
Expand description

Built-in font metrics lookup tables and text/label sizing ported from Graphviz 16.1.0 (lib/common/textspan_lut.c, lib/common/textspan.c, lib/common/ps_font_equiv.h, and lib/common/labels.c).

Structs§

LabelSubstContext
Context for Graphviz object-based escape sequence substitution (\N, \G, \T, \H, \E, \L).
PostscriptFontAlias
PostScript font alias entry (PostscriptAlias in lib/common/textspan.h).
TextLabelLayout
Measured layout of a multiline Graphviz label in points.
TextLineLayout
Measured layout of a single line within a multiline text label.

Enums§

TextJustify
Horizontal justification of a single line in a Graphviz label.

Constants§

DEFAULT_FONT_NAME
Default font family name in Graphviz (Times-Roman).
DEFAULT_FONT_SIZE
Default font size in points (14.0).
DEFAULT_LABEL_FONT_SIZE
Default head/tail label font size in points (11.0).
LINESPACING
Line spacing multiplier (1.20) from lib/common/const.h.
MIN_FONT_SIZE
Minimum allowed font size in points (1.0).
POSTSCRIPT_FONT_ALIASES
Standard PostScript font equivalence table (postscript_alias[] from lib/common/textspan.c, generated from ps_font_equiv.h by scripts/gen-font-tables.py).

Functions§

charset_is_latin1
Returns true if a graph’s charset attribute selects Latin-1 (findCharset in lib/common/input.c: latin-1, latin1, l1, ISO-8859-1, ISO_8859-1, ISO8859-1, ISO-IR-100, case-insensitively).
convert_label_text
The label text conversion of make_label for a graph of charset cs (latin1ToUTF8 for Latin-1, htmlEntityUTF8 otherwise).
decode_html_entities
Decodes HTML character entity references, matching htmlEntityUTF8 in lib/common/utils.c (kept under its historical name for existing callers).
estimate_text_size
Estimates the (width, height) in points of a single-line text span for a given font_name and font_size, matching estimate_textspan_size in lib/common/textspan.c.
estimate_text_size_styled
estimate_textspan_size from lib/common/textspan.c with explicit bold/italic flags (HTML_BF/HTML_IF): (fontsize * width_1pt, fontsize * LINESPACING).
estimate_text_width_1pt
estimate_text_width_1pt from lib/common/textspan_lut.c: width of text at 1pt.
html_entity_utf8
htmlEntityUTF8 from lib/common/utils.c: replaces HTML entities (&, {, {) by their UTF-8 encoding. Works on the input’s bytes (see crate::charset): a lead byte without its continuation bytes, or a byte >= 0xF8, is converted as if it were Latin-1, with C’s once-per-graph warning.
latin1_to_utf8
latin1ToUTF8 from lib/common/utils.c (used when charset=latin1): translates HTML entities and re-encodes every byte >= 0x7F of the input (see crate::charset) as if it were a Latin-1 code point.
make_simple_label
make_simple_label from lib/common/labels.c: splits text (already object- and entity-substituted) into lines on \n, \l, \r and literal newlines, reducing every other \c to c. width/height are C’s lp->dimen.
make_simple_label_cs
make_simple_label for a graph of charset cs. C scans bytes; with charset=big5 a byte in 0xA1..=0xFE takes the next byte with it, so that byte is never an escape.
make_text_label
Plain-text branch of make_label from lib/common/labels.c: object escape substitution, charset conversion (latin1ToUTF8 for charset=latin1, else htmlEntityUTF8) and make_simple_label.
measure_multiline_label
Measures a multiline Graphviz label for a node named node_name.
measure_multiline_label_with_context
Measures a multiline plain-text Graphviz label in the charset of the graph being laid out (charset::current); see make_text_label.
strdup_and_subst_obj
strdup_and_subst_obj from lib/common/labels.c: object escapes plus \\ -> \ (used for URL, tooltip, id, … attributes).
substitute_object_escapes
Substitutes Graphviz object escapes (\N, \G, \T, \H, \E, \L) while preserving line-formatting escapes (\n, \l, \r, \\) for make_simple_label; this is strdup_and_subst_obj0(str, obj, 0) from lib/common/labels.c.
translate_postscript_fontname
translate_postscript_fontname from lib/common/textspan.c: bsearch of the alias table with strcasecmp. The name is used verbatim (no trimming), as in C.