docs: document the font option of table cells - #1799
Merged
blikblum merged 1 commit intoSep 14, 2026
Merged
Conversation
The cell options only said "Font options for the cell". Describe src, family and size, show how to use a registered font, and note how the font of a cell combines with its row and column. Fixes foliojs#1737 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Documentation for #1737.
The table docs list the cell
fontoption only as "Font options for the cell". In #1737,font: { family: 'FAR' }with a font registered asFARrendered in Helvetica.font: { src: 'FAR' }, suggested in the issue, worked, and the thread confirmed the keys aren't documented anywhere yet.docs/table.mdnow describes the keys under "Cell options":src: a registered font name, a standard font name, or a font file path or buffer, like the first argument ofdoc.font().family: the font inside a collection or variable font given insrc, like the second argument ofdoc.font(). It only applies when asrcis set on the cell, its row, or its column, so a registered font name belongs insrc.size: the font size.After the option list, a short example uses a registered font by name, and one sentence explains how cell, row and column fonts combine. That matches the resolution in
normalizeCellfrom #1770: a more specificsrcresetsfamily, whilefamilyorsizeon their own refine what is inherited.To check the text, I rendered a one-cell table for each form and recorded the
doc.font()calls and the font used for the text:font{ src: 'Rob' }withregisterFont('Rob', 'tests/fonts/Roboto-Regular.ttf'){ family: 'Rob' }with the same registrationdoc.font()is never called withRob{ src: 'tests/fonts/Roboto-Medium.ttf' }{ src: 'Courier-Bold' }The new code block comes after the last
![n]()example intable.md, and both docs generators reset their code block list per file, so the generated example images keep their indices.Checklist:
🤖 Generated with Claude Code