fontfamily
fontfamily(name)
Input: name · Output: no output
What it is
Sets the figure-wide font (string name, inherited by every title/label/tick/legend). "default"/"sans" and "print"/"serif" are curated stacks (screen sans, paper/journal serif); any other string passes through verbatim as a literal CSS font-family. Every curated stack falls back to Latin Modern Math for Greek letters and mathematical operators, because none of the text faces covers them — Latin Modern has no μ at all — and savefig(embed_fonts=true) embeds that fallback too, but only for the symbols a given figure actually paints.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
fontfamily(name) | name stringnot documented yet | no output | "default"/"sans" and "print"/"serif" are curated stacks (screen sans, paper/journal serif); any other string passes through verbatim as a literal CSS font-family. Every curated stack falls back to Latin Modern Math for Greek letters and mathematical operators, because none of the text faces covers them — Latin Modern has no μ at all — and savefig(embed_fonts=true) embeds that fallback too, but only for the symbols a given figure actually paints. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
figure()
t = linspace(0, 1, 200)
plot(t, sin(2 * pi * 5 * t))
xticks([0, 0.5, 1])
xticklabels("start", "mid", "end")
yticks([-1, 0, 1])
yticklabels("low", "zero", "high")
fontfamily("sans")
fontsize(tick = 10, label = 12, title = 14)
figure_background("#f7f7f7")
colormap("viridis")
colorbar()
grid()
box()
subplot(1, 1, 1)
xscale("linear")
yscale("linear")
title("Styled panel")
· plot: figure 8 (200 points)
from plotting
How it works
fontfamily("Georgia, serif") — sets once on the figure's root <svg> (see plotting::render_svg), inherited by every title/label/tick/legend text element; no per-series plumbing. "default"/"sans" and "print"/"serif" are shorthands for Qu's two curated stacks (elegant sans for screen, elegant serif for a paper/journal feel); "tikz"/"latex" and "academic" add a Latin Modern serif/sans pair (LaTeX's own default typeface family) for a figure meant to sit inside a LaTeX paper or an academic poster — anything else passes through verbatim as a literal CSS font-family value.
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.