feat(reports): draw_page adds a report in pen strokes (Hershey text + SVG) as a new page #65

Merged
jfro merged 10 commits from feat/62-ink-reports into main 2026-11-01 14:20:46 +00:00
Owner

Closes #62

The AI (the chat, or an agent over MCP) can now write a report onto a new page as pen strokes: Markdown text drawn in a Hershey single-stroke font, and sketches and charts it writes as SVG, inline in fenced ```svg blocks, drawn as their outlines. On the tablet it's ink like anything written there. Full write-up: docs/ink-reports.md.

Screenshots

All taken at 781c7f5 in the mock app (scripts/screenshots library, Chromium), the chat's drawn-page drafts over the app's own template drawings (Templates.svg/1, the same table of rules Ink.Report writes on). Sample is the report Markdown at the end of this description; long is it plus 20 more bullet rows, so it runs onto page 2 (2.3 pages on Lines medium).

Text just above the rules, zoomed 2× (from the full-size shots below; each row's baseline 5 px above its rule, so the ink stops 2–3 px short of it): Lines medium page 1, Lines medium page 2 (the template repeating 1872 down), Lines large page 3, Lines small, Checklist.

Full size, 1404 px wide (the draft's full-size popover, 1:1 with the tablet's pixels), sample on each lined template:

Lines small Lines medium Lines large Checklist

Desktop, 1440×900 (the popover as it opens):

Lines small Lines medium Lines large Checklist

Phone, 390×844:

Page 2 of the long report (popover scrolled to the second page's top), desktop on each template, and Lines medium on the phone:

Lines small Lines medium Lines large Checklist

(the whole long report on Lines medium, full size)

The draft card in the chat, desktop:

What's in it

  • Ink.Hershey: Futura Light (Roman Simplex) for body text, Futura Medium (Roman Duplex) for headings and bold, italics slanted. Font data vendored unchanged in priv/hershey/ (futural.jhf, futuram.jhf) with the distribution's hershey.txt and a README carrying its required acknowledgements. Read at compile time; no new deps. ASCII only: accents come off, smart quotes/dashes/bullets fold to ASCII, the rest is ?.
  • Ink.Path: SVG path data, every command (M L H V C S Q T A Z, absolute and relative), curves and arcs flattened (the spec's endpoint-to-center arc conversion, out-of-range radii scaled up).
  • Ink.SVG: path, line, polyline, polygon, rect (rounded too), circle, ellipse, text/tspan (in Hershey, by font-size and text-anchor); transforms (matrix, translate, scale, rotate with a center, skewX/Y) nested through g and svg; presentation attributes and style="" inherited; display/visibility. Parsed with :xmerl (OTP, added to extra_applications); a DOCTYPE or entity declaration refuses the drawing, so nothing is fetched or expanded. The viewBox is scaled into its place in the flow (the text width, or the svg's width in page pixels if it asks for less, at most 1400 tall), centered.
    • Fills are ignored, outlines only: a shape's pen color is its stroke's, or its fill's when it has none, so filled bars still show as outlines. Colors map to the nearest pen color (black/gray by lightness, else red, yellow, green, blue, pink by hue); white and near-white (backgrounds) aren't drawn.
  • Ink.Report: lays the Markdown (via Lines.Markdown, as typed pages read it) and the drawings out on a row grid from the template's TypedPages.Layouts margins, wrapping at its width. On a lined template the rows are its own rules (Templates.rules/1: Lines small 52, medium 78.75, large 96.94, Checklist 97.4 px, measured from the rM2 template images), starting on the rule nearest where typed text would and, past a page's last rule, carrying on from the next page's first (the template repeats every 1872); a title or drawing that would straddle the page edge starts on the next page; elsewhere 70 px; produces fineliner Strokes and the page's transcription.
  • Lines.Writer.ink_page/2: a v6 .rm page of one layer of line items, as the tablet writes a drawn page (no root text). rmscene reads it cleanly.
  • draw_page in the chat's tools (drafts, previewed and approved like add_page, card titled "New drawn page draft") and in AgentTools for keys that may write (adds straight away), on the same TypedPages add/commit path (kind: :drawn; new page_drafts.kind column, reversible migration). The chat's system prompt and the MCP instructions name it.
  • Transcription: recorded as a new :drawn source, the Markdown with each drawing replaced by its labels, so search finds it. A :drawn text stays current like a manual edit (an AI run doesn't replace it) and TranscribeWorker skips the page without calling the provider.
  • Logger: info per drawn page (document id, strokes, drawings, how far down, bytes, ms); warning when a report can't be drawn, with why; info when the worker skips a drawn page.

When it doesn't fit on one page

It carries on down the same page, as a page the tablet scrolls does (the app's renderer already grows the canvas to the content, and the draft card already fades long pages with "View the whole page"). That keeps one draft, one commit, one transcription, and "a new page at the end" stays true. The cap is 4 pages' height (7488 px); longer is refused with a message asking to shorten it or split it over more than one draw_page call. Markdown is capped at 60,000 characters (3× typed pages', for the SVG). Written down in docs/ink-reports.md.

Checks

  • mix precommit: 1067 passed, 1 excluded (live LanguageTool); 46 new tests: Hershey parsing/metrics/folding, path commands and arcs, every SVG shape, transforms, styles, colors, fitting, refusals, report layout (grid, wrapping, markers, formats inside a word, drawings centered and labelled, the 4-page cap), ink_page round trips, drafting/adding/agent draw_page/transcription source, worker skip.
  • rmscene reads the sample page: every block a known type, 614 line items in Layer 1, all FINELINER_2.
  • Browser, mock app at 781c7f5: the sample and a 2.3-page report on Lines small, medium, large and Checklist, popover at full size (1404), 1440×900 and 390×844, and the chat card, no JS errors (screenshots above). Measured on the full-size shots (inkgap.py): on every text row, pages 1 to 3 of all four templates, the ink stops 2 to 3 clear pixels above its rule (descenders aside).
  • Not checkable in the mock app: Add to notebook. The mock library's .content files don't re-encode byte for byte, so PageMove refuses to plan any add there, a typed control draft included (same error). The add path is covered by typed_pages_test.exs against the stub cloud (page 3 lands, same bytes uploaded, :drawn transcription current).
  • Ruled templates (4500c30, Jeremy's drift report): test/rm_analyzer/typed_pages/ruled_reports_test.exs drafts a 21-row report on Lines small, medium, large and Checklist and asserts rows 0, 10 and 20 land within 2 px of their rules; it failed on 85e7ccf (rows 70 apart everywhere). mix precommit: 1080 passed, 1 excluded.
  • Pages 2+ (bced797, Nye's F29): rows past the last rule used to keep the pitch over the page edge (18–37 px off page 2's rules on medium/large/Checklist). Now covered by the ruled-reports test (row 20 is on page 2 for large and Checklist) and three Ink.Report tests (carry-on, drawing and title not straddling); all fail without the fix. mix precommit: 1083 passed, 1 excluded.
  • Every row kind on the rules (c4862fa): ruled_reports_test.exs now takes the rules from Templates.rules/1, the table the app draws the templates from, and a new test per template draws # and ## titles, bullets at both levels, both checkboxes, a wrapped line and the line after a drawing, twice over onto later pages, and checks each row's letters end within 2 px of a rule (8 tests).
  • The page view's template on long pages: rendering the real page_preview component of a 2.3-page report in Chromium at 1404, 1354, 607, 342 (2×) and 300 px wide, every template rule down every page is within 1 page px (or ¾ of a device pixel) of where the page's own coordinates put it, on all four templates: the repeated template isn't stretched and doesn't drift.
  • Text lifted clear of the rules (Jeremy, Nov 1: the ink hugged the rules): one constant, Ink.Report @rule_lift 5 (page px, rM2 1404 wide), puts each row's baseline 5 above its rule on every lined template. Half the 3 px pen line, half the 1 px rule and round letters' dip below the baseline take 3, leaving a 2–3 px visible gap; a 2 px baseline lift (c8b9806) still touched in the renders. Descenders still cross the rule. ruled_reports_test.exs now expects every row kind's baseline 5 px (±1) above its rule on pages 1 to 3 of each template; it fails on c4862fa (8 of 8). mix precommit: 1087 passed, 1 excluded.
  • Not done: a tablet check (added to docs/verification.md).
Sample report Markdown
# Weekly sleep report
Seven nights from **Oct 24** to *Oct 30*: average 7.1 hours.

## Highlights
- Bedtime moved 20 minutes earlier
- Two short nights, both after late coffee
- [x] Kept the phone out of the bedroom
- [ ] Try a fixed wake time

## Hours per night
```svg
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 240" width="580">
  <line x1="40" y1="200" x2="390" y2="200" stroke="black"/>
  <line x1="40" y1="20" x2="40" y2="200" stroke="black"/>
  <g fill="steelblue">
    <rect x="55" y="60" width="34" height="140"/>
    <rect x="105" y="80" width="34" height="120"/>
    <rect x="155" y="110" width="34" height="90"/>
    <rect x="205" y="70" width="34" height="130"/>
    <rect x="255" y="125" width="34" height="75"/>
    <rect x="305" y="50" width="34" height="150"/>
    <rect x="355" y="90" width="30" height="110"/>
  </g>
  <g font-size="16" text-anchor="middle">
    <text x="72" y="222">Sa</text><text x="122" y="222">Su</text><text x="172" y="222">Mo</text>
    <text x="222" y="222">Tu</text><text x="272" y="222">We</text><text x="322" y="222">Th</text>
    <text x="370" y="222">Fr</text>
  </g>
  <text x="30" y="65" font-size="14" text-anchor="end">8h</text>
  <polyline points="72,60 122,80 172,110 222,70 272,125 322,50 370,90" stroke="red" fill="none"/>
</svg>
```

## A sketch of the desk
```svg
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 160" width="400">
  <path d="M20 120 H280 M40 120 V150 M260 120 V150" stroke="black"/>
  <rect x="110" y="40" width="80" height="55" rx="6" fill="none" stroke="black"/>
  <path d="M150 95 L150 120 M130 120 Q150 110 170 120" stroke="black" fill="none"/>
  <circle cx="240" cy="100" r="16" stroke="green" fill="none"/>
  <path d="M60 120 C60 80 90 80 90 120" stroke="blue" fill="none"/>
  <g transform="rotate(-15 50 60)"><text x="50" y="60" font-size="14">lamp</text></g>
  <path d="M225 84 A20 12 0 0 1 255 84" stroke="green" fill="none"/>
</svg>
```
Next week: note caffeine after 2 PM.
Closes #62 The AI (the chat, or an agent over MCP) can now write a report onto a new page **as pen strokes**: Markdown text drawn in a Hershey single-stroke font, and sketches and charts it writes as SVG, inline in fenced ```` ```svg ```` blocks, drawn as their outlines. On the tablet it's ink like anything written there. Full write-up: `docs/ink-reports.md`. ## Screenshots All taken at `781c7f5` in the mock app (`scripts/screenshots` library, Chromium), the chat's drawn-page drafts over the app's own template drawings (`Templates.svg/1`, the same table of rules `Ink.Report` writes on). **Sample** is the report Markdown at the end of this description; **long** is it plus 20 more bullet rows, so it runs onto page 2 (2.3 pages on Lines medium). **Text just above the rules, zoomed 2×** (from the full-size shots below; each row's baseline 5 px above its rule, so the ink stops 2–3 px short of it): Lines medium page 1, Lines medium page 2 (the template repeating 1872 down), Lines large page 3, Lines small, Checklist. <img src="https://git.knope.dev/attachments/15716864-1cb5-4a12-8f67-ad06156bc8f8" width="700"> <img src="https://git.knope.dev/attachments/b58969ca-f14b-4a21-bebd-906126ee7c35" width="700"> <img src="https://git.knope.dev/attachments/401d6fd2-46f4-414d-99b2-aaac709d4a86" width="700"> <img src="https://git.knope.dev/attachments/50ec2843-f5ce-458f-bad4-f99adfc69e6d" width="700"> <img src="https://git.knope.dev/attachments/4d043729-e95f-4f67-ae89-0f6e15a4440b" width="700"> **Full size, 1404 px wide** (the draft's full-size popover, 1:1 with the tablet's pixels), sample on each lined template: | Lines small | Lines medium | Lines large | Checklist | |---|---|---|---| | <a href="https://git.knope.dev/attachments/ffdd9218-7174-4047-8cf5-c9dda408eff9"><img src="https://git.knope.dev/attachments/ffdd9218-7174-4047-8cf5-c9dda408eff9" width="220"></a> | <a href="https://git.knope.dev/attachments/9547fe06-7f75-43a9-97cd-88e61fc7f645"><img src="https://git.knope.dev/attachments/9547fe06-7f75-43a9-97cd-88e61fc7f645" width="220"></a> | <a href="https://git.knope.dev/attachments/eecda73e-8b5c-4e7c-97c7-5795ee33a295"><img src="https://git.knope.dev/attachments/eecda73e-8b5c-4e7c-97c7-5795ee33a295" width="220"></a> | <a href="https://git.knope.dev/attachments/576feb31-4241-4dc9-ba98-6dc305a24450"><img src="https://git.knope.dev/attachments/576feb31-4241-4dc9-ba98-6dc305a24450" width="220"></a> | **Desktop, 1440×900** (the popover as it opens): | Lines small | Lines medium | Lines large | Checklist | |---|---|---|---| | <a href="https://git.knope.dev/attachments/18a5be06-a033-4e2a-91dd-2f6e6c52c8b0"><img src="https://git.knope.dev/attachments/18a5be06-a033-4e2a-91dd-2f6e6c52c8b0" width="300"></a> | <a href="https://git.knope.dev/attachments/4da98423-bae7-4af8-bb15-6a09eafac831"><img src="https://git.knope.dev/attachments/4da98423-bae7-4af8-bb15-6a09eafac831" width="300"></a> | <a href="https://git.knope.dev/attachments/7203b742-4c9b-4dae-a238-d45108bac04f"><img src="https://git.knope.dev/attachments/7203b742-4c9b-4dae-a238-d45108bac04f" width="300"></a> | <a href="https://git.knope.dev/attachments/82fd82cf-0fe3-4985-9227-872db03a2b90"><img src="https://git.knope.dev/attachments/82fd82cf-0fe3-4985-9227-872db03a2b90" width="300"></a> | **Phone, 390×844:** <img src="https://git.knope.dev/attachments/206bbf34-af5d-4cf9-8296-2106dd260dcd" width="190"> <img src="https://git.knope.dev/attachments/ecc21007-d1de-4097-978b-e358b0989676" width="190"> <img src="https://git.knope.dev/attachments/f425d948-1e96-4a2c-b9ee-517d97f08159" width="190"> <img src="https://git.knope.dev/attachments/4180ff33-b5bb-4fb5-82d0-a1fab1593ec9" width="190"> **Page 2 of the long report** (popover scrolled to the second page's top), desktop on each template, and Lines medium on the phone: | Lines small | Lines medium | Lines large | Checklist | |---|---|---|---| | <a href="https://git.knope.dev/attachments/7511cd30-e8eb-4656-8c3a-9fd787ba2744"><img src="https://git.knope.dev/attachments/7511cd30-e8eb-4656-8c3a-9fd787ba2744" width="300"></a> | <a href="https://git.knope.dev/attachments/b7f65123-ba37-43b6-9052-930b384ba9e2"><img src="https://git.knope.dev/attachments/b7f65123-ba37-43b6-9052-930b384ba9e2" width="300"></a> | <a href="https://git.knope.dev/attachments/9f8bb44b-3346-45ff-ac17-d6fd20b42b36"><img src="https://git.knope.dev/attachments/9f8bb44b-3346-45ff-ac17-d6fd20b42b36" width="300"></a> | <a href="https://git.knope.dev/attachments/9de84235-66c2-4982-9589-13492506f806"><img src="https://git.knope.dev/attachments/9de84235-66c2-4982-9589-13492506f806" width="300"></a> | <img src="https://git.knope.dev/attachments/6521f920-1577-4ffc-846e-c7a242b94f62" width="190"> <a href="https://git.knope.dev/attachments/e45cfc7a-bbaf-47aa-b986-ffaef8236eee"><img src="https://git.knope.dev/attachments/e45cfc7a-bbaf-47aa-b986-ffaef8236eee" width="190"></a> (the whole long report on Lines medium, full size) **The draft card in the chat**, desktop: <img src="https://git.knope.dev/attachments/f7fe56f7-0618-469d-8c39-b66676d1c500" width="420"> ## What's in it - **`Ink.Hershey`**: Futura Light (Roman Simplex) for body text, Futura Medium (Roman Duplex) for headings and bold, italics slanted. Font data vendored unchanged in `priv/hershey/` (`futural.jhf`, `futuram.jhf`) with the distribution's `hershey.txt` and a README carrying its required acknowledgements. Read at compile time; no new deps. ASCII only: accents come off, smart quotes/dashes/bullets fold to ASCII, the rest is `?`. - **`Ink.Path`**: SVG path data, every command (`M L H V C S Q T A Z`, absolute and relative), curves and arcs flattened (the spec's endpoint-to-center arc conversion, out-of-range radii scaled up). - **`Ink.SVG`**: `path`, `line`, `polyline`, `polygon`, `rect` (rounded too), `circle`, `ellipse`, `text`/`tspan` (in Hershey, by `font-size` and `text-anchor`); `transform`s (matrix, translate, scale, rotate with a center, skewX/Y) nested through `g` and `svg`; presentation attributes and `style=""` inherited; `display`/`visibility`. Parsed with `:xmerl` (OTP, added to `extra_applications`); a DOCTYPE or entity declaration refuses the drawing, so nothing is fetched or expanded. The viewBox is scaled into its place in the flow (the text width, or the svg's `width` in page pixels if it asks for less, at most 1400 tall), centered. - **Fills are ignored, outlines only**: a shape's pen color is its stroke's, or its fill's when it has none, so filled bars still show as outlines. Colors map to the nearest pen color (black/gray by lightness, else red, yellow, green, blue, pink by hue); white and near-white (backgrounds) aren't drawn. - **`Ink.Report`**: lays the Markdown (via `Lines.Markdown`, as typed pages read it) and the drawings out on a row grid from the template's `TypedPages.Layouts` margins, wrapping at its width. On a lined template the rows are its own rules (`Templates.rules/1`: Lines small 52, medium 78.75, large 96.94, Checklist 97.4 px, measured from the rM2 template images), starting on the rule nearest where typed text would and, past a page's last rule, carrying on from the next page's first (the template repeats every 1872); a title or drawing that would straddle the page edge starts on the next page; elsewhere 70 px; produces fineliner `Stroke`s and the page's transcription. - **`Lines.Writer.ink_page/2`**: a v6 `.rm` page of one layer of line items, as the tablet writes a drawn page (no root text). rmscene reads it cleanly. - **`draw_page`** in the chat's tools (drafts, previewed and approved like `add_page`, card titled "New drawn page draft") and in `AgentTools` for keys that may write (adds straight away), on the same `TypedPages` add/commit path (`kind: :drawn`; new `page_drafts.kind` column, reversible migration). The chat's system prompt and the MCP instructions name it. - **Transcription**: recorded as a new `:drawn` source, the Markdown with each drawing replaced by its labels, so search finds it. A `:drawn` text stays current like a manual edit (an AI run doesn't replace it) and `TranscribeWorker` skips the page without calling the provider. - **Logger**: info per drawn page (document id, strokes, drawings, how far down, bytes, ms); warning when a report can't be drawn, with why; info when the worker skips a drawn page. ## When it doesn't fit on one page It carries on down the same page, as a page the tablet scrolls does (the app's renderer already grows the canvas to the content, and the draft card already fades long pages with "View the whole page"). That keeps one draft, one commit, one transcription, and "a new page at the end" stays true. The cap is 4 pages' height (7488 px); longer is refused with a message asking to shorten it or split it over more than one `draw_page` call. Markdown is capped at 60,000 characters (3× typed pages', for the SVG). Written down in `docs/ink-reports.md`. ## Checks - `mix precommit`: 1067 passed, 1 excluded (live LanguageTool); 46 new tests: Hershey parsing/metrics/folding, path commands and arcs, every SVG shape, transforms, styles, colors, fitting, refusals, report layout (grid, wrapping, markers, formats inside a word, drawings centered and labelled, the 4-page cap), `ink_page` round trips, drafting/adding/agent `draw_page`/transcription source, worker skip. - rmscene reads the sample page: every block a known type, 614 line items in Layer 1, all `FINELINER_2`. - Browser, mock app at `781c7f5`: the sample and a 2.3-page report on Lines small, medium, large and Checklist, popover at full size (1404), 1440×900 and 390×844, and the chat card, no JS errors (screenshots above). Measured on the full-size shots (`inkgap.py`): on every text row, pages 1 to 3 of all four templates, the ink stops 2 to 3 clear pixels above its rule (descenders aside). - **Not checkable in the mock app**: *Add to notebook*. The mock library's `.content` files don't re-encode byte for byte, so `PageMove` refuses to plan **any** add there, a typed control draft included (same error). The add path is covered by `typed_pages_test.exs` against the stub cloud (page 3 lands, same bytes uploaded, `:drawn` transcription current). - **Ruled templates** (4500c30, Jeremy's drift report): `test/rm_analyzer/typed_pages/ruled_reports_test.exs` drafts a 21-row report on Lines small, medium, large and Checklist and asserts rows 0, 10 and 20 land within 2 px of their rules; it failed on 85e7ccf (rows 70 apart everywhere). `mix precommit`: 1080 passed, 1 excluded. - **Pages 2+** (bced797, Nye's F29): rows past the last rule used to keep the pitch over the page edge (18–37 px off page 2's rules on medium/large/Checklist). Now covered by the ruled-reports test (row 20 is on page 2 for large and Checklist) and three `Ink.Report` tests (carry-on, drawing and title not straddling); all fail without the fix. `mix precommit`: 1083 passed, 1 excluded. - **Every row kind on the rules** (`c4862fa`): `ruled_reports_test.exs` now takes the rules from `Templates.rules/1`, the table the app draws the templates from, and a new test per template draws `#` and `##` titles, bullets at both levels, both checkboxes, a wrapped line and the line after a drawing, twice over onto later pages, and checks each row's letters end within 2 px of a rule (8 tests). - **The page view's template on long pages**: rendering the real `page_preview` component of a 2.3-page report in Chromium at 1404, 1354, 607, 342 (2×) and 300 px wide, every template rule down every page is within 1 page px (or ¾ of a device pixel) of where the page's own coordinates put it, on all four templates: the repeated template isn't stretched and doesn't drift. - **Text lifted clear of the rules** (Jeremy, Nov 1: the ink hugged the rules): one constant, `Ink.Report` `@rule_lift` 5 (page px, rM2 1404 wide), puts each row's baseline 5 above its rule on every lined template. Half the 3 px pen line, half the 1 px rule and round letters' dip below the baseline take 3, leaving a 2–3 px visible gap; a 2 px baseline lift (c8b9806) still touched in the renders. Descenders still cross the rule. `ruled_reports_test.exs` now expects every row kind's baseline 5 px (±1) above its rule on pages 1 to 3 of each template; it fails on `c4862fa` (8 of 8). `mix precommit`: 1087 passed, 1 excluded. - **Not done**: a tablet check (added to `docs/verification.md`). <details><summary>Sample report Markdown</summary> ````markdown # Weekly sleep report Seven nights from **Oct 24** to *Oct 30*: average 7.1 hours. ## Highlights - Bedtime moved 20 minutes earlier - Two short nights, both after late coffee - [x] Kept the phone out of the bedroom - [ ] Try a fixed wake time ## Hours per night ```svg <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 240" width="580"> <line x1="40" y1="200" x2="390" y2="200" stroke="black"/> <line x1="40" y1="20" x2="40" y2="200" stroke="black"/> <g fill="steelblue"> <rect x="55" y="60" width="34" height="140"/> <rect x="105" y="80" width="34" height="120"/> <rect x="155" y="110" width="34" height="90"/> <rect x="205" y="70" width="34" height="130"/> <rect x="255" y="125" width="34" height="75"/> <rect x="305" y="50" width="34" height="150"/> <rect x="355" y="90" width="30" height="110"/> </g> <g font-size="16" text-anchor="middle"> <text x="72" y="222">Sa</text><text x="122" y="222">Su</text><text x="172" y="222">Mo</text> <text x="222" y="222">Tu</text><text x="272" y="222">We</text><text x="322" y="222">Th</text> <text x="370" y="222">Fr</text> </g> <text x="30" y="65" font-size="14" text-anchor="end">8h</text> <polyline points="72,60 122,80 172,110 222,70 272,125 322,50 370,90" stroke="red" fill="none"/> </svg> ``` ## A sketch of the desk ```svg <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 160" width="400"> <path d="M20 120 H280 M40 120 V150 M260 120 V150" stroke="black"/> <rect x="110" y="40" width="80" height="55" rx="6" fill="none" stroke="black"/> <path d="M150 95 L150 120 M130 120 Q150 110 170 120" stroke="black" fill="none"/> <circle cx="240" cy="100" r="16" stroke="green" fill="none"/> <path d="M60 120 C60 80 90 80 90 120" stroke="blue" fill="none"/> <g transform="rotate(-15 50 60)"><text x="50" y="60" font-size="14">lamp</text></g> <path d="M225 84 A20 12 0 0 1 255 84" stroke="green" fill="none"/> </svg> ``` Next week: note caffeine after 2 PM. ```` </details>
Ink.Report lays a report out on a page as fineliner strokes: Markdown text
in the Hershey single-stroke fonts (Futura Light and Medium, vendored under
priv/hershey with the distribution's note), and fenced svg blocks as their
shapes' outlines, every path command and transform included, colors mapped
to the pen palette. Lines.Writer.ink_page/2 writes the page file, one layer
of line items, as the tablet writes a page that's only been drawn on.
feat(reports): draw_page adds a report in pen strokes as a new page
Some checks failed
CI / test (pull_request) Has been cancelled
c3c9a7bb88
The chat drafts a drawn page with draw_page, previewed and approved like
add_page's typed ones, and an agent's key that may write adds one straight
away. It's a new page at the end of the notebook, on the typed pages path,
laid out by the template's TypedPages.Layouts margins; a report longer
than a page carries on down it, up to 4 pages' height. Its text is
recorded as a :drawn transcription, which AI runs leave current and
TranscribeWorker skips.

Closes #62
jfro added this to the v1.6.0 milestone 2026-10-31 20:58:04 +00:00
fix(ink): clip a drawing to its box and cap its points
Some checks failed
CI / test (pull_request) Has been cancelled
9d04142b97
A shape far past a small viewBox was densified out to wherever it went,
so one line to x=1e7 in viewBox 0 0 1 1 ran the BEAM out of memory.
Ink.SVG now cuts every polyline at the drawing's box (Liang-Barsky)
before adding points, refuses a drawing over 100,000 points, and turns
float overflow into an error for whoever wrote the SVG. Ink.Path stops a
path at a number too large for a float instead of crashing.

Refs #62
fix(ink): scan SVGs as UTF-8 bytes so non-ASCII text draws folded
Some checks failed
CI / test (pull_request) Has been cancelled
85e7ccf67a
fix(ink): write drawn reports on each lined template's rules
Some checks failed
CI / test (pull_request) Has been cancelled
4500c307e3
Rows were 70 px apart on every template, so on Lines small (52) and
medium (78.75) a report drifted off the rules line by line. Templates now
keeps each lined template's first rule and pitch in one table (also used
to draw them, and adding Lines large), and a drawn page's rows follow it,
starting on the rule nearest where typed text would.
fix(ink): carry drawn reports on to the next page's rules
All checks were successful
CI / test (pull_request) Successful in 55s
bced797c9e
Past a page's last rule, rows kept the template's pitch into the bottom
margin and over the page's edge, so on Lines medium, large and Checklist
page 2 sat 18-37 px off its rules (and in the Checklist's header). The
template repeats every 1872, so Templates.rules/1 now gives rule_count and
a row past the last rule goes to the next page's first. A title that would
split over the edge, or a drawing that would cross it, starts on the next
page.

Fixes F29 (Nye).
test(ink): check every row kind against the app's own template rules
Some checks failed
CI / test (pull_request) Has been cancelled
c4862fa215
ruled_reports_test now takes each lined template's rules from
Templates.rules/1, the table the app also draws the templates from,
rather than a copy. A new test per template draws titles, subheadings,
bullets at both levels, both checkboxes, a wrapped line and the line
after a drawing, twice over so rows run onto later pages, and checks
each row's letters end within 2 px of a rule.

Refs #62
fix(ink): lift drawn report text 2 px clear of the template rules
Some checks failed
CI / test (pull_request) Has been cancelled
c8b9806a42
Jeremy (Nov 1): the inked text hugged the rules. Every lined template
(Lines small/medium/large, Checklist) now puts each row's baseline
Ink.Report.rule_lift/0 (2 page px) above its rule; descenders still
cross it. The rules test expects rule - 2 (+-1) for every row kind on
pages 1 to 3.

Refs #62
fix(ink): lift drawn text so its ink, not its baseline, clears the rule by 2 px
Some checks failed
CI / test (pull_request) Has been cancelled
42b99f167d
At a 2 px baseline lift the 3 px fineliner line still touched the 1 px
rule in the rendered page. rule_lift is now 4: a 2 px clear gap plus
half the pen line and half the rule, measured in the app's renders on
all four lined templates, pages 1 to 3.

Refs #62
fix(ink): lift drawn text 5 px so its ink clears the rule by 2-3 px
All checks were successful
CI / test (pull_request) Successful in 53s
781c7f5158
At a 2 px baseline lift the 3 px fineliner line still touched the 1 px
rule in the rendered page. Half the pen line, half the rule and round
letters' dip below the baseline take 3 px, so rule_lift is 5: measured
in the app's renders, every row on pages 1 to 3 of all four lined
templates keeps 2 to 3 clear pixels above its rule.

Refs #62
jfro merged commit d94f3f1305 into main 2026-11-01 14:20:46 +00:00
jfro deleted branch feat/62-ink-reports 2026-11-01 14:20:46 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jfro/rm-analyzer!65
No description provided.