In short
A short chapter that teaches how to read the signs of logic and set theory. The book's typefaces have none of those signs, so a second typeface fills them in, on screen and in the printed PDF.
What you'll build
The first chapter of a pocket primer of logic, on a 155 × 235 mm page: a claret band with the chapter's signs set large, then four sections that read ∀, ∃, ∈, ∪, ∅ and ℵ aloud, with the formulas in the running text and displayed between paragraphs. The book is set in Crimson Pro, its headings in Cormorant Garamond and its labels in IBM Plex Sans Condensed. Not one of the three has ∀, ∈ or a Greek letter in the files Fontsource serves. One setting, symbolFont, lists Noto Sans Math after each of them, so every sign comes from the same face in the body, the headings, the running heads and the table cells, and the PDF prints them all.
This recipe answers
- How do I print logic and set signs (∀, ∈, ℵ) and Greek that my text font lacks, instead of empty boxes in the PDF?
The short answer
// None of the three faces has ∀, ∈, ℵ or Greek. config.symbolFont (below) lists Noto Sans
// Math after every family the document names: what a face lacks is drawn from it, at the
// face's size and colour, in the canvas, the PDF, the HTML and the EPUB.
const SYMBOLS = 'Noto Sans Math';
// Fontsource serves Noto Sans Math whole in its "latin" file, and the kit would declare
// that file for the Latin range only. The screen and the PDF take it here with no range,
// so every glyph in it can be used.
const symbolFile = async () =>
`${await fontsourceAt('noto-sans-math')}files/noto-sans-math-latin-400-normal.woff2`;
const resolve = async (family, ...face) =>
(family === SYMBOLS ? [{ source: await symbolFile() }] : fontsourceResolver(family, ...face));
const pdfFonts = async (family, ...face) => (family !== SYMBOLS
? fontsourceProvider(family, ...face)
: decompressWoff2(new Uint8Array(await (await fetch(await symbolFile())).arrayBuffer())));
One symbol font behind every face, on the canvas and in the PDF
Ingredients
- Features
- Symbol fontFonts embedded in the PDFFonts before layoutSuperscripts and subscriptsParagraph stylesTables from dataTable styleDesigned openersHeading attributesRunning heads and foliosMirrored marginsSemantic colour palettePDF export
- Also uses
- Figures exactly hereFigure and Table in your languageHeads by page roleCustom resource types
- Type
- Crimson Pro, Cormorant Garamond, IBM Plex Sans Condensed, Noto Sans Math (SIL OFL 1.1)
- Assets
- None: every picture is drawn in code
Method
#1 · One symbol font behind every face
The code of this step is the short answer above. symbolFont: 'Noto Sans Math' (symbol font) puts the family after every family the config names, so a character the face lacks is drawn from Noto Sans Math at the face's size and colour, and the rest of the line stays in the face. Fontsource serves Noto Sans Math whole in its file called latin, 3,033 characters, but the kit declares that file for the Latin range only, and the browser would then not ask it for ∀. The pen's resolve and pdfFonts hand the same file over with no range, on screen and to renderToPdf. Only the characters a face lacks change face: Crimson Pro has ¬, so the negation in the text stays in Crimson Pro.
#2 · A first build without it shows what is missing
// Each paragraph that sets a character its face lacks is a glyphFallbackAt warning with its
// page; with no symbol font it names no family that draws them, and the PDF would print
// empty boxes. The pages shown are the second build's.
const fonts = { ...kitFonts(FONTS), resolve }; // the kit's resolver, with the symbol file
const bare = await buildDocumentWithFonts({ markdown, resources }, { ...config, symbolFont: '' },
fonts);
console.info((bare.contentWarnings ?? []).filter((w) => w.kind === 'glyphFallbackAt')
.map(formatWarning).join('\n'));
The first build leaves symbolFont empty and prints its glyphFallbackAt warnings, one for each paragraph, heading or table that sets characters its face has no glyph for, with the page and the characters. The English edition reports eighteen: fourteen paragraphs in Crimson Pro, three headings in Cormorant Garamond and the header row of Table 1.1 in IBM Plex Sans Condensed bold. Without a family that draws them, the canvas takes the signs from a font of the reader's system and the PDF prints an empty box for each. The second build, with the symbol font, is the one on the page; its warnings name "Noto Sans Math" as the family that draws them.
#3 · The signs on the opener are text
const BAND = 78; // mm from the trim to the foot of the band
const onBand = { color: col('paper'), align: 'left' };
const below = (id, y, width) => ({ anchor: { to: `#${id}`, edge: 'below' }, offset: { y: mm(y) },
size: { width: mm(width) } });
const opener = { enabled: true, minHeight: mm(BAND - TOP + 2), slot: { elements: [
{ kind: 'box', id: 'band', style: { backgroundColor: col('accent') },
placement: { anchor: { to: 'bleed', edge: 'top-left' }, size: { height: mm(BAND) } } },
{ kind: 'text', id: 'kicker', content: '{attr.kicker}', ...onBand, fontFamily: LABEL,
fontWeight: 600, fontSize: pt(8.5), letterSpacing: pt(1.8), textTransform: 'uppercase',
placement: { anchor: { to: 'container', edge: 'top-left' }, offset: { y: mm(2) } } },
{ kind: 'text', id: 'title', content: '{titleText}', ...onBand, fontFamily: DISPLAY,
fontWeight: 600, fontSize: pt(38), lineHeight: 1.02, placement: below('kicker', 3, 110) },
// The signs are text in Cormorant Garamond, which has none of them: Noto Sans Math draws
// every one, at 30 pt, in the band's white.
{ kind: 'text', id: 'signs', content: '{attr.signs}', ...onBand, fontFamily: DISPLAY,
fontSize: pt(30), lineHeight: 1, letterSpacing: pt(9), placement: below('title', 7, 114) },
] } };
The line of seven signs under the title is a design text in Cormorant Garamond at 30 pt, fed by the heading's signs attribute. Cormorant Garamond has none of them, so all seven come from the symbol font, in the band's white. The tracking of 9 pt spreads them across the measure.
#4 · Table cells and running heads take the same face
const [T, F] = t({ en: ['T', 'F'], es: ['V', 'F'] });
const connectives = [['¬*p*', (p) => !p], ['*p* ∧ *q*', (p, q) => p && q],
['*p* ∨ *q*', (p, q) => p || q], ['*p* → *q*', (p, q) => !p || q],
['*p* ↔ *q*', (p, q) => p === q]];
const cell = (content, isHeader = false) => ({ content, align: 'center', isHeader });
const truth = [[true, true], [true, false], [false, true], [false, false]].map(([p, q]) =>
[p, q, ...connectives.map(([, f]) => f(p, q))].map((v) => cell(v ? T : F)));
const table = (id, rows, columnWidths, caption, position) => ({ id, typeId: 'table',
kind: 'table', caption, createdAt: 0, updatedAt: 0, placement: { position },
table: { model: { headerRowCount: 1, columnWidths, rows } } });
const resources = [
table('truth', [['*p*', '*q*', ...connectives.map(([s]) => s)].map((s) => cell(s, true)),
...truth],
[1, 1, 1.3, 1.6, 1.6, 1.6, 1.6], t({ en: 'The five connectives, row by row.',
es: 'Las cinco conectivas, fila a fila.' }), 'top'), // to the head of a page
table('signs', parseTSV(signs.trim()).rows.map((row, r) => row.map(({ content }, c) => ({
content, align: c === 0 ? 'center' : 'left', isHeader: r === 0 }))), [0.8, 2.1, 5.3],
t({ en: 'Where the signs come from.', es: 'De dónde vienen los signos.' }), 'here'),
];
The truth table is built from the connectives themselves: each column header is the formula, and each cell is what the formula gives for that row. The header cells are IBM Plex Sans Condensed bold italic and the body cells Crimson Pro; the symbol font serves both. Its one regular face draws for every weight and slant, so ∧ in the bold header and ∈ in an italic formula are the same upright sign. The recto running head prints the section in force, {firstMark.h2}, and SETS: ∈, ∪, ∩ AND ∅ on page 3 takes its signs from Noto Sans Math as well.

The whole recipe
// ═══ Postext Cookbook · Nº 185 · Logic signs from a symbol font ═════════════════════
// https://postext.dev/en/cookbook/symbol-font-for-logic
// Code: MIT · Text: original (CC BY 4.0) · Pictures: none
// Fonts: Crimson Pro, Cormorant Garamond, IBM Plex, Noto Sans Math (OFL) · Needs postext ≥ 1.73.0
// A primer of logical notation set in faces that have no ∀, no ∈, no ℵ and no Greek:
// symbolFont names Noto Sans Math, which draws those characters on the canvas and in the PDF.
import {
buildDocumentWithFonts, renderPageToCanvas, defaultResourceTypes, parseTSV, formatWarning,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'symbol-font-for-logic';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
const palette = {
ink: '#1f1c22', // text: a cool near-black
accent: '#7b2a3b', // claret: the opener band, labels, the table heads
tint: '#f4ece9', // the even rows of the truth table
rule: '#c3b4b2', // hairlines
muted: '#6a6064', // running heads, the colophon
paper: '#ffffff',
};
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [
...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
{ id: 'main-color', name: 'accent (defaults)', value: { hex: palette.accent, model: 'hex' } },
];
const TEXT = 'Crimson Pro', DISPLAY = 'Cormorant Garamond', LABEL = 'IBM Plex Sans Condensed';
const TRIM = [155, 235], INNER = 20, OUTER = 21, TOP = 23; // mm: a trade-size primer
const LEAD = 15; // pt: the body leading
// #region answer: one symbol font behind every face, on the canvas and in the PDF
// None of the three faces has ∀, ∈, ℵ or Greek. config.symbolFont (below) lists Noto Sans
// Math after every family the document names: what a face lacks is drawn from it, at the
// face's size and colour, in the canvas, the PDF, the HTML and the EPUB.
const SYMBOLS = 'Noto Sans Math';
// Fontsource serves Noto Sans Math whole in its "latin" file, and the kit would declare
// that file for the Latin range only. The screen and the PDF take it here with no range,
// so every glyph in it can be used.
const symbolFile = async () =>
`${await fontsourceAt('noto-sans-math')}files/noto-sans-math-latin-400-normal.woff2`;
const resolve = async (family, ...face) =>
(family === SYMBOLS ? [{ source: await symbolFile() }] : fontsourceResolver(family, ...face));
const pdfFonts = async (family, ...face) => (family !== SYMBOLS
? fontsourceProvider(family, ...face)
: decompressWoff2(new Uint8Array(await (await fetch(await symbolFile())).arrayBuffer())));
// #endregion
The composed script.js runs as it is: paste it into any page’s module script, or open the recipe on CodePen. Recipe folder on GitHub ↗ (opens in a new tab)
Variations
#Leave out the first build
Once the warnings are read, one build is enough.
-const bare = await buildDocumentWithFonts({ markdown, resources }, { ...config, symbolFont: '' },
- fonts);
-console.info((bare.contentWarnings ?? []).filter((w) => w.kind === 'glyphFallbackAt')
- .map(formatWarning).join('\n'));Pitfalls
Layout warning · glyphFallbackAt
Characters the font lacks, here
Why. A paragraph sets characters its text face has no glyph for: mathematical letters and operators (∪, ℵ), Greek in a Latin face, arrows (glyphFallback names the face, this the paragraph). supplier names the family that draws them, usually the symbolFont; without one, the PDF prints them as empty boxes.
Fix. Name a symbolFont that has them (Noto Sans Math covers most mathematics), or choose a text family that does. If a character is wrong (a Hebrew alef where the author meant a complement), correct the text. Docs →
- A face whose Fontsource files include Greek (Source Serif 4, Alegreya) sets φ and Γ itself, and the kit loads that file when the text has Greek: only the signs go to the symbol font then. Crimson Pro has no Greek file, so its Greek comes from Noto Sans Math.
- The symbol font has one upright regular face. A bold heading or an italic formula sets its signs in that face, which is how mathematics prints them.
Credits
- Recipe
- Ignacio Ferro
- Text
- The primer of logical notation, in English and Spanish · Ignacio Ferro · CC BY 4.0
- Fonts
- Crimson Pro (SIL OFL 1.1) · Cormorant Garamond (SIL OFL 1.1) · IBM Plex Sans Condensed (SIL OFL 1.1) · Noto Sans Math (SIL OFL 1.1)
Edit this write-up ↗ (opens in a new tab)Recipe folder on GitHub ↗ (opens in a new tab)


