Skip to content

feat(board): support arbitrary text sizes - #352

Draft
triprjt wants to merge 2 commits into
vcmf:mainfrom
triprjt:feat/arbitrary-text-sizing
Draft

triprjt wants to merge 2 commits into
vcmf:mainfrom
triprjt:feat/arbitrary-text-sizing

Conversation

@triprjt

@triprjt triprjt commented Oct 5, 2026

Copy link
Copy Markdown

What & why

Adds arbitrary text sizing to the board instead of limiting users to S/M/L/XL:

  • adds a numeric pixel-size input beside the existing presets
  • preserves explicit sizes throughout board style types, markdown rendering, and textarea editing
  • accepts and measures numeric font sizes in the backend
  • works with the companion canvas-harness change so corner-dragging standalone text scales the font proportionally, similar to Excalidraw

This addresses #350.

Companion dependency PR: winlp4ever/canvas-harness#46

This PR is intentionally a draft until the companion library change is merged and released, at which point the @canvas-harness/* dependency can be updated to that release.

Related issue

Closes #350

How was it tested?

  • added backend coverage for measuring text at an explicit 72 px font size
  • verified numeric font-size editing and proportional corner-resize behavior in a self-hosted Dim0 deployment
  • verified existing preset sizes continue to render and edit normally

Checklist

  • Branched off main
  • PR title follows Conventional Commits (type(scope): message)
  • Ran the app locally and confirmed the change works
  • Change is focused on one thing
  • Updated docs/comments if behavior changed

@winlp4ever

Copy link
Copy Markdown
Contributor

nice, this follows the plan 👍 I know it's blocked on canvas-harness#46, and the NaN/tsc errors on the branch should go away once that's released. some things to sort out in the meantime:

  1. validate on the backend. font_size: FontSize | float accepts 0, negatives and inf, and inf crashes the agent layout (ceil(inf)). use a constrained float (8–256), same range as the harness.
  2. don't save on every keystroke. typing "24" applies 2px first, then 24, which means two undo entries + two sync ops and the text collapses for a moment. commit on blur/enter instead, and add min/max on the input.
  3. old clients. desktop builds and cached PWAs on harness 0.2.0 will render numeric sizes as NaN, and their auto-fit can sync h: null back. we need a plan here, e.g. a min client version check, or not writing numbers until the bump has been out for a release or two. happy to talk through it.
  4. drop the canvas-lite-markdown.tsx changes. nothing imports that file anymore, the harness does the real rendering, so those changes don't do anything.
  5. one line-height ratio. use the harness resolver on the frontend instead of re-deriving * 1.25, and in text_measure.py add a comment pointing at the harness constant so they don't drift.
  6. docstrings on getLineHeightPx, getMarkdownLineHeightPx and fontSizeToTwClass (repo rule in AGENTS.md).

once #46 is out, bump @canvas-harness/* here and I'll do another pass

@codecov

codecov Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@triprjt

triprjt commented Oct 6, 2026 •

Copy link
Copy Markdown
Author

Addressed the actionable review items in 921c35d:

  • Backend explicit font sizes are now finite and constrained to 8–256, for both Style and LinkStyle, with validation tests for lower/upper bounds, out-of-range values, and NaN/infinity.
  • Text measurement now clamps/falls back defensively, preserves preset line heights when a numeric value exactly matches a preset, and uses a named NUMERIC_LINE_HEIGHT_RATIO aligned with canvas-harness.
  • The font-size field now keeps a local draft and commits only on blur or Enter. It rounds/clamps to 8–256, restores the current value when left empty, and has focused interaction tests.
  • Removed the unrelated/dead canvas-lite-markdown.tsx changes from the combined PR diff.
  • Kept frontend conversion through the canvas-harness resolver and added the requested documentation.

The package bump is still intentionally pending merge and release of canvas-harness PR #46. Until that release exists, this Dim0 PR should remain a draft; local type-check validation used the built artifacts from #46 without committing vendored output or dependency changes.

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.

feat(webui): allow arbitrary text font sizes and Excalidraw-like resize scaling

2 participants