Skip to content

docs: document the font option of table cells - #1799

Merged
blikblum merged 1 commit into
foliojs:masterfrom
lbesecker195:docs/table-cell-font-options
Sep 14, 2026
Merged

blikblum merged 1 commit into
foliojs:masterfrom
lbesecker195:docs/table-cell-font-options

Conversation

@lbesecker195

@lbesecker195 lbesecker195 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Documentation for #1737.

The table docs list the cell font option only as "Font options for the cell". In #1737, font: { family: 'FAR' } with a font registered as FAR rendered in Helvetica. font: { src: 'FAR' }, suggested in the issue, worked, and the thread confirmed the keys aren't documented anywhere yet.

docs/table.md now 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 of doc.font().
  • family: the font inside a collection or variable font given in src, like the second argument of doc.font(). It only applies when a src is set on the cell, its row, or its column, so a registered font name belongs in src.
  • 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 normalizeCell from #1770: a more specific src resets family, while family or size on 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:

cell font font used
{ src: 'Rob' } with registerFont('Rob', 'tests/fonts/Roboto-Regular.ttf') Roboto-Regular
{ family: 'Rob' } with the same registration Helvetica, and doc.font() is never called with Rob
{ src: 'tests/fonts/Roboto-Medium.ttf' } Roboto-Medium
{ src: 'Courier-Bold' } Courier-Bold

The new code block comes after the last ![n]() example in table.md, and both docs generators reset their code block list per file, so the generated example images keep their indices.

Checklist:

  • Unit Tests N/A
  • Documentation
  • Update CHANGELOG.md N/A
  • Ready to be merged

🤖 Generated with Claude Code

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>
@blikblum
blikblum merged commit 7810e27 into foliojs:master Sep 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants