Record the owner's acceptance of the blocks plan
The owner accepted every proposed default of docs/plans/blocks.md on 2026-12-01. Its open questions become numbered decisions, without the alternatives, and design.md's Planned next item 4 records them. The plan's acceptance edits are made: formatters.md's phase 5 points to the plan for more blocks, and its deferred list keeps only nested boxes and goldmark; job-store.md's phase 3a draws each block that has shipped in its golden PNGs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
619fce613c
commit
8b9e838675
4 files changed
+94
-107
No files matched your search
+59
-101
@@ -1,14 +1,6 @@
|
||||
# Plan: more blocks
|
||||
|
||||
Status: **planning; nothing is built.** Each block is built when it is needed, one at a time, so the five stages are independent. Each runs alone in its own session, briefed from its section, once the owner has answered its questions or accepted their assumed defaults:
|
||||
- questions 2 and 3 apply to every stage, and question 1 to stages 1-3, which add glyphs;
|
||||
- stage 1 (rule character) needs questions 4-6;
|
||||
- stage 2 (table) needs 7-14;
|
||||
- stage 3 (banner) needs 15-17;
|
||||
- stage 4 (inline spans) needs 18-21;
|
||||
- stage 5 (group) needs 22-26.
|
||||
|
||||
Each answer, or assumed default the owner accepts, goes at once into design.md's Planned next item for more blocks and leaves this list. Questions 1-3 are answered once, for every stage. Every paper check needs the owner's OK. A stage's last commit deletes its section here, and moves the stage's decisions from that Planned next item into design.md's bullet "Blocks are laid out when the job renders". When the owner accepts the plan, the edits under Overview, ON ACCEPTANCE, are made. Whichever stage finishes last deletes this plan, its findings with it, design.md's Planned next item for more blocks, and formatters.md's "More blocks" item if that plan is still there.
|
||||
Status: **planned; nothing is built.** The owner accepted every proposed default on 2026-12-01 (Decisions), and design.md's Planned next item for more blocks records them. Each block is built when it is needed, one at a time, so the five stages are independent. Each runs alone in its own session, briefed from its section, in any order; the Overview suggests one. Decisions 2 and 3 apply to every stage, and decision 1 to stages 1-3, which add glyphs. Stage 1 follows decisions 4-6, stage 2 decisions 7-14, stage 3 decisions 15-17, stage 4 decisions 18-21 and stage 5 decisions 22-26. Every paper check needs the owner's OK. A stage's last commit deletes its section here, and moves the stage's decisions from that Planned next item into design.md's bullet "Blocks are laid out when the job renders". Whichever stage finishes last deletes this plan, its findings with it, design.md's Planned next item for more blocks, and formatters.md's "More blocks" item if that plan is still there.
|
||||
|
||||
## Decisions (owner, 2026-11-30)
|
||||
|
||||
@@ -17,60 +9,50 @@ Each answer, or assumed default the owner accepts, goes at once into design.md's
|
||||
character.
|
||||
- **Each is built when it is needed, one at a time.**
|
||||
|
||||
## Open questions
|
||||
|
||||
Each has the default the plan assumes unless the owner says otherwise.
|
||||
The owner accepted the details below on 2026-12-01. They are numbered, so the rest of the plan can refer to them.
|
||||
|
||||
For every stage:
|
||||
|
||||
1. **Glyphs the code page lacks.** Assumed: each new glyph set falls back as the box styles do (glyphs.go:29-35): `double-h` and `double-v` to `double`, then `single`, then `ascii`. A set falls back whole when the code page lacks any of its glyphs, junctions included, as `bordersFor` already checks corners and lines (glyphs.go:40-57). A fallback is silent, as for boxes and rules; the preview shows the glyphs used. Investigation findings, GLYPHS BY CODE PAGE, lists what each page has.
|
||||
1. **Glyphs the code page lacks.** Each new glyph set falls back as the box styles do (glyphs.go:29-35): `double-h` and `double-v` to `double`, then `single`, then `ascii`. A set falls back whole when the code page lacks any of its glyphs, junctions included, as `bordersFor` already checks corners and lines (glyphs.go:40-57). A fallback is silent, as for boxes and rules; the preview shows the glyphs used. Investigation findings, GLYPHS BY CODE PAGE, lists what each page has.
|
||||
- cp858 is cp850 with `€` in place of `ı`, so every box, junction and shade glyph is the same. The goldens stay in cp437, cp850 and cp1252 (golden_test.go:22). Each of stages 1-3 adds a unit test that its glyph choice on cp858 equals cp850's.
|
||||
- Trade-off: a user on cp850 who asks for `double-h` gets `double` without being told.
|
||||
- Alternatives: a preview warning for every fallback, which today's boxes do not give; or cp858 goldens, which would repeat cp850's files.
|
||||
2. **Proving each block on paper.** Assumed: each stage adds one or two short receipts, `examples/<block>.json` and, where one would be long, a second. They show the new block's styles and edge cases. TestExampleJobs keeps every example valid with nothing printed as `?` (golden_test.go:62), so an example grows with the commits of its stage. With the owner's OK each prints on the TM-T88IV, one at a time. Once he passes one, its bytes are pinned in TestPaperReceipts (compat_test.go:100) as `testdata/paper/<block>.hex`, rendered with the cut feed it printed with (`cutFeed: 3`, the daemon's default). The pin folds into the stage's last feature commit (`git commit --fixup`, then `git rebase --autosquash main`), whose body says it was checked on paper on the TM-T88IV.
|
||||
2. **Proving each block on paper.** Each stage adds one or two short receipts, `examples/<block>.json` and, where one would be long, a second. They show the new block's styles and edge cases. TestExampleJobs keeps every example valid with nothing printed as `?` (golden_test.go:62), so an example grows with the commits of its stage. With the owner's OK each prints on the TM-T88IV, one at a time. Once he passes one, its bytes are pinned in TestPaperReceipts (compat_test.go:100) as `testdata/paper/<block>.hex`, rendered with the cut feed it printed with (`cutFeed: 3`, the daemon's default). The pin folds into the stage's last feature commit (`git commit --fixup`, then `git rebase --autosquash main`), whose body says it was checked on paper on the TM-T88IV.
|
||||
- Trade-off: one more pinned receipt per block, regenerated only after a new paper check.
|
||||
- Alternatives: a commit of its own for each pin, since the bytes can only be pinned after the paper check; one combined receipt once several blocks exist, which delays the first check.
|
||||
3. **Modules.** Assumed: no module changes in these stages. A module's output is pinned on paper (`testdata/paper/ntfy-*.hex`, `note.hex`), so changing it is a change of its own, with its own paper check, made when the owner asks. The candidates:
|
||||
3. **Modules.** No module changes in these stages. A module's output is pinned on paper (`testdata/paper/ntfy-*.hex`, `note.hex`), so changing it is a change of its own, with its own paper check, made when the owner asks. The candidates:
|
||||
- spans: the markdown subset keeps `**bold**` as bold instead of dropping the marks (markdown.go:53);
|
||||
- banner: the urgent card's `URGENT` heading, today a dark rule with a bold label (card.go:196);
|
||||
- table: a digest's rows, today text lines of time and title (digest.go:68).
|
||||
- Trade-off: the new blocks first reach receipts only through `/print`.
|
||||
- Alternative: adopt one candidate in the stage that builds its block.
|
||||
|
||||
Before stage 1, the rule character:
|
||||
For stage 1, the rule character:
|
||||
|
||||
4. **The field and the characters it takes.** Assumed: a new field `char` on `rule`, one character that repeats across the line in place of the style's pattern: `{"type": "rule", "char": "*", "text": "TODAY"}`. Validation is structural: exactly one rune as sent, which is not a control character, not a newline or tab, not a combining mark (Unicode Mn or Me), not a format character (Cf, such as the soft hyphen and the bidi controls) and not one of the invisible runes `normalize` drops (normalize.go:165-176). A space is allowed: a rule of spaces centres its label. `"char": ""` means unset, as an empty string does on every other field, so the tag is `maxLength=1` alone, which counts code points as validation does; TestBoundTagsMatchValidation learns to check a field with an upper bound only.
|
||||
4. **The field and the characters it takes.** A new field `char` on `rule`, one character that repeats across the line in place of the style's pattern: `{"type": "rule", "char": "*", "text": "TODAY"}`. Validation is structural: exactly one rune as sent, which is not a control character, not a newline or tab, not a combining mark (Unicode Mn or Me), not a format character (Cf, such as the soft hyphen and the bidi controls) and not one of the invisible runes `normalize` drops (normalize.go:165-176). A space is allowed: a rule of spaces centres its label. `"char": ""` means unset, as an empty string does on every other field, so the tag is `maxLength=1` alone, which counts code points as validation does; TestBoundTagsMatchValidation learns to check a field with an upper bound only.
|
||||
- A decomposed `é`, an `e` and a combining accent, is two runes and is refused, although NFC would compose it. Trade-off: a client must send composed text.
|
||||
- Alternatives: a `pattern` of up to 8 characters, as the `dashed` style's `- ` is a pattern of two; or opening the kv `leader` (block.go:321-330) to any character in the same change.
|
||||
5. **The fallback where the code page lacks the character.** Assumed: the character is composed to NFC first, as text is, so `Å` (U+212B) becomes `Å` (U+00C5). Then, in order, the character itself; its fold, when the fold is one character the page prints (`•` folds to `·`, normalize.go:26); then the pattern of the rule's `style`, which defaults to `single` and itself ends in `-` (glyphs.go:98-108). So `"char": "♦", "style": "double"` prints `═` on cp850 and `=` on cp1252. Folds of several characters (`→` to `->`, `€` to `EUR`) are not used as patterns. The fallback counts no `?`, so the preview gives no warning.
|
||||
5. **The fallback where the code page lacks the character.** The character is composed to NFC first, as text is, so `Å` (U+212B) becomes `Å` (U+00C5). Then, in order, the character itself; its fold, when the fold is one character the page prints (`•` folds to `·`, normalize.go:26); then the pattern of the rule's `style`, which defaults to `single` and itself ends in `-` (glyphs.go:98-108). So `"char": "♦", "style": "double"` prints `═` on cp850 and `=` on cp1252. Folds of several characters (`→` to `->`, `€` to `EUR`) are not used as patterns. The fallback counts no `?`, so the preview gives no warning.
|
||||
- Trade-off: a character the page lacks never prints as `?`, so a client does not learn it fell back unless it reads the preview.
|
||||
- Alternatives: fall back to `-` alone, ignoring `style`; or count it as an unknown character, so the preview warns.
|
||||
6. **Inside a box.** Assumed: `char` is refused on a divider inside a box (`field "char" does not apply to rule inside a box`). A divider joins the side borders with junctions (glyphs.go:77-94), and only `─` and `═` have junctions.
|
||||
6. **Inside a box.** `char` is refused on a divider inside a box (`field "char" does not apply to rule inside a box`). A divider joins the side borders with junctions (glyphs.go:77-94), and only `─` and `═` have junctions.
|
||||
- Trade-off: a card cannot have a `* * *` divider.
|
||||
- Alternative: allow it, drawn between the side borders inside the padding, `│ ************ │`, without junctions.
|
||||
|
||||
Before stage 2, the table:
|
||||
For stage 2, the table:
|
||||
|
||||
7. **The JSON shape.** Assumed (the names under question 14):
|
||||
7. **The JSON shape.** The names are those of decision 14:
|
||||
```json
|
||||
{"type": "table", "style": "double-h",
|
||||
"cols": [{"head": "Item"}, {"head": "Qty", "align": "right"}, {"head": "Price", "align": "right"}],
|
||||
"rows": [["Flat white", "2", "7.00"], ["Almond croissant", "1", "3.50"]],
|
||||
"foot": [["Total", "3", "10.50"]]}
|
||||
```
|
||||
- `cols` defines the columns, one object each: `head` (the header text, may be empty), `align` (`left`, `center` or `right`; default `left`), `width` (a fixed width in characters) and `grow` (question 9).
|
||||
- `cols` defines the columns, one object each: `head` (the header text, may be empty), `align` (`left`, `center` or `right`; default `left`), `width` (a fixed width in characters) and `grow` (decision 9).
|
||||
- `rows` are the body, each an array of exactly as many strings as `cols`; a cell may be empty.
|
||||
- `foot` are rows printed after a separator, in bold, for totals.
|
||||
- `columns`, `size`, `font`, `padding` and `fit` mean what they mean on a box.
|
||||
- The header row prints, in bold, when any `head` is not empty.
|
||||
- Trade-off: a row cannot be bold unless it is in `foot`, and one table has one header.
|
||||
- Alternatives: rows as objects, `{"cells": [...], "bold": true}`, which costs every row a wrapper; `bold_rows` as indexes into `rows`, as `done` indexes a list; `header` as an array of strings beside `aligns` and `widths` arrays.
|
||||
8. **Borders.** Assumed: `style` takes the box styles, `single`, `double`, `double-h`, `double-v` and `ascii`, and a new `none`. The default is `double-h`, the look the owner named: `╒═╤═╕`, `│`, `╞═╪═╡`, `╘═╧═╛`. The header and foot separators use the frame's horizontal line, so a `double-h` table has `╞═╪═╡`. No lines run between body rows.
|
||||
8. **Borders.** `style` takes the box styles, `single`, `double`, `double-h`, `double-v` and `ascii`, and a new `none`. The default is `double-h`, the look the owner named: `╒═╤═╕`, `│`, `╞═╪═╡`, `╘═╧═╛`. The header and foot separators use the frame's horizontal line, so a `double-h` table has `╞═╪═╡`. No lines run between body rows.
|
||||
- `none` draws no frame. Columns are separated by the blank cell where a vertical line would be, with the padding on each side, so the gap is 1 + 2 × `padding` spaces. The header and foot separators are a rule of `─` across the table, `-` where the page lacks it.
|
||||
- On cp850 and cp858, `double-h` and `double-v` print as `double` (`╔═╦═╗`, `╠═╬═╣`, `╚═╩═╝`). On cp1252 every frame is `ascii`: `+` at every corner and junction, `-` and `|`, and `=` for the separators when the style asked for double horizontal lines, as dividers do (glyphs.go:90-93).
|
||||
- Trade-off: the default differs from the box's, `single`.
|
||||
- Alternatives: `single` as the default; a `grid` field that rules a line between body rows, which doubles the paper a table takes.
|
||||
9. **Column widths.** Assumed: a column with `width` is fixed at that many characters; the others size by content. A column may set `grow`, a weight from 1 to 10, to take spare room; `grow` and `width` together are refused. Architecture, TABLE LAYOUT, gives the exact rule:
|
||||
9. **Column widths.** A column with `width` is fixed at that many characters; the others size by content. A column may set `grow`, a weight from 1 to 10, to take spare room; `grow` and `width` together are refused. Architecture, TABLE LAYOUT, gives the exact rule:
|
||||
- each auto column's least width is its longest word and its natural width its longest line, header included;
|
||||
- widths are given out in rounds, fixed widths and least widths first, then natural widths, each round shared in proportion to what each column still wants;
|
||||
- spare room goes to the columns with `grow` in proportion to it, or, when none has `grow`, to the first auto column, where receipts put the item's name. A table whose columns are all fixed shrinks to them and is centred.
|
||||
@@ -78,49 +60,40 @@ Before stage 2, the table:
|
||||
- Shares are whole characters, given by largest remainder, ties to the leftmost column, so a layout is the same on every run.
|
||||
- A fixed width is what a column gets when the room allows. On a line too narrow for every column's want, a fixed column shrinks with the others, so the table still fits.
|
||||
- Trade-off: a table whose widest column is not the first must say `grow`.
|
||||
- Alternatives: spare room shared equally among auto columns; a table as wide as its content by default, as `fit` is.
|
||||
10. **Wrapping in cells.** Assumed: each cell wraps at spaces to its column's width with today's `wrap` (layout.go:56-68); `\n` starts a new paragraph; only a word longer than the column splits. A row is as tall as its tallest cell; the others are filled with blank lines below their text. Each line of a cell is aligned as its column; header cells too. Cells are normalised as box text is (blocklayout.go:33-37), tabs expanded from the cell's own left edge.
|
||||
10. **Wrapping in cells.** Each cell wraps at spaces to its column's width with today's `wrap` (layout.go:56-68); `\n` starts a new paragraph; only a word longer than the column splits. A row is as tall as its tallest cell; the others are filled with blank lines below their text. Each line of a cell is aligned as its column; header cells too. Cells are normalised as box text is (blocklayout.go:33-37), tabs expanded from the cell's own left edge.
|
||||
- Trade-off: no vertical alignment other than top, and no alignment on a decimal point.
|
||||
- Alternatives: cut long cells with `...` on one line, as kv keys are cut; a `valign` per column.
|
||||
11. **When the columns do not fit the paper.** Layout never fails on a valid job (design.md, "Blocks are laid out when the job renders"; invariant 2 here), so a table always prints. Assumed, in order:
|
||||
11. **When the columns do not fit the paper.** Layout never fails on a valid job (design.md, "Blocks are laid out when the job renders"; invariant 2 here), so a table always prints. In order:
|
||||
- Padding goes first, as a narrow box gives up its padding before its content (blocklayout.go:139-141). It drops, one step at a time, while the room is less than every column's want: its longest word, or less where its natural or fixed width is less.
|
||||
- Each column needs its want counted up to 8 characters. While the room at padding 0 holds every column's need, the table keeps its columns, and only words longer than 8 characters can split.
|
||||
- Below that, the table prints stacked: each row as key-value lines, the column's `head` as the key and the cell as the value, laid out as a kv block is (blocklayout.go:386-410), with a `.` leader. Where a head would be cut, which `kvLines` does to a key longer than the width less 8, the whole table uses the narrow form instead: each head on a line of its own, the cell below it, right-aligned (blocklayout.go:475-490). A cell whose column has no head prints alone, on the left. Rows are separated by a rule in the frame's horizontal line; foot rows follow, in bold.
|
||||
- Question 7's table needs 8 + 3 + 5 = 16 characters for its cells and 4 for its borders, so it stacks below 20: on a TM-T88 at size 3 (14 characters), not at size 2 (21).
|
||||
- Decision 7's table needs 8 + 3 + 5 = 16 characters for its cells and 4 for its borders, so it stacks below 20: on a TM-T88 at size 3 (14 characters), not at size 2 (21).
|
||||
- Trade-off: a stacked table looks unlike the table asked for, but no word of up to 8 characters is split.
|
||||
- Alternatives: a need of 3 characters, which keeps the columns on narrower paper and splits more words; columns of 1 character with every word split; cells cut with `...`; refusing the job when it renders, which breaks invariant 2.
|
||||
12. **Limits.** Assumed: 1-8 columns; 1-100 rows; 0-10 foot rows; each row exactly as many cells as `cols`; `width` 0-255; `grow` 0-10; `padding` 0-3. A row with the wrong number of cells is a problem named by its index, `rows[3]: 2 cells, want 3`. Rows and cells do not count toward the 500-element limit, as kv pairs do not. The text a table holds is bounded by `webserver.body_limit` (4 MiB) and its lines by `format.max_lines`.
|
||||
12. **Limits.** 1-8 columns; 1-100 rows; 0-10 foot rows; each row exactly as many cells as `cols`; `width` 0-255; `grow` 0-10; `padding` 0-3. A row with the wrong number of cells is a problem named by its index, `rows[3]: 2 cells, want 3`. Rows and cells do not count toward the 500-element limit, as kv pairs do not. The text a table holds is bounded by `webserver.body_limit` (4 MiB) and its lines by `format.max_lines`.
|
||||
- Today `max_lines` is checked only once the whole job is laid out (render.go:148-151), so 500 tables each just under the limit, or one cell of 4 MiB in a narrow column, build about a million lines first. Stage 2 therefore first makes the renderer stop as soon as the lines so far, times the copies, pass `max_lines`, checked after each element, at each table row and inside a cell's wrap. The error then reads `receipt would print at least 2001 lines, limit is 2000`, which changes the message api.md quotes (api.md:195-198), under Changed in the CHANGELOG. The code, `too_many_lines`, stays.
|
||||
- The tags: `cols` `minItems=1,maxItems=8`; `rows` `minItems=1,maxItems=100`; `foot` `maxItems=10` alone, since no foot is the default; in `Column`, `width` `minimum=0,maximum=255`, `grow` `minimum=0,maximum=10` and `align` `enum=left,enum=center,enum=right`. No tag can say that a row has as many cells as `cols`; validation holds that rule, and the field's doc comment states it. TestBoundTagsMatchValidation gains rows for `Column`, and TestEnumTagsMatchValidation's `enumTag` (schema_test.go:16-29) takes the type, so that `Column.Align` is held too.
|
||||
- Trade-off: a long order of more than 100 lines needs two tables; a job over the limit is told only a lower bound on its lines.
|
||||
- Alternatives: 200 rows, as a list takes 200 items; a cap on each cell's length; the early stop for tables alone, keeping today's message for other jobs.
|
||||
13. **A table inside a box.** Assumed: allowed, one level, as kv and list are. It takes `cols`, `rows`, `foot`, `style` and `padding` there; `size` and `font` come from the box, and the table spans the box's content width. A table narrower than that, all fixed or `fit`, is centred in it and padded with spaces to it, so every box line keeps its width. A `fit` box measures the table at its natural width. A framed table inside a box draws its own frame inside the box's; api.md suggests `none` there.
|
||||
13. **A table inside a box.** Allowed, one level, as kv and list are. It takes `cols`, `rows`, `foot`, `style` and `padding` there; `size` and `font` come from the box, and the table spans the box's content width. A table narrower than that, all fixed or `fit`, is centred in it and padded with spaces to it, so every box line keeps its width. A `fit` box measures the table at its natural width. A framed table inside a box draws its own frame inside the box's; api.md suggests `none` there.
|
||||
- Trade-off: a framed table inside a frame is busy, and nothing stops it.
|
||||
- Alternatives: only `none` inside a box; or no table inside a box.
|
||||
14. **The JSON field names.** Assumed: `cols`, `rows`, `foot`, and in a column `head`, `align`, `width` and `grow`. Not `columns` for the column definitions: on every block `columns` is already the block's width in characters (job.go:170-173).
|
||||
14. **The JSON field names.** `cols`, `rows`, `foot`, and in a column `head`, `align`, `width` and `grow`. Not `columns` for the column definitions: on every block `columns` is already the block's width in characters (job.go:170-173).
|
||||
- Trade-off: `cols` beside `columns`, and `foot` (rows) beside a box's `footer` (text in its bottom border), can be misread.
|
||||
- Alternatives: `fields`; `head` and `body` for the rows, as HTML's `thead` and `tbody`; `total` for `foot`.
|
||||
|
||||
Before stage 3, the banner:
|
||||
For stage 3, the banner:
|
||||
|
||||
15. **What a banner is.** Assumed: large text that spans the line, for a heading such as `ORDER 42`: `{"type": "banner", "text": "ORDER 42"}`. Its fields are `text` (required), `style`, `size`, `align` (default `center`), `bold` and `font`. Three styles:
|
||||
15. **What a banner is.** Large text that spans the line, for a heading such as `ORDER 42`: `{"type": "banner", "text": "ORDER 42"}`. Its fields are `text` (required), `style`, `size`, `align` (default `center`), `bold` and `font`. Three styles:
|
||||
- `band`, the default: white on black. Each line is padded with spaces to the banner's columns, the text placed in it by `align`, and printed reversed, so the band covers the whole line.
|
||||
- `plain`: the large text alone.
|
||||
- `ruled`: a line of `▄` above and of `▀` below, at size 1, full width; `=` where the page lacks them (cp1252).
|
||||
- Every banner line, the `ruled` lines included, is sent centred (`ESC a 1`) with no margin spaces, so the printer centres it in its print area and the dots left over split evenly at both edges. They are fewer than one character at the line's size: 32 dots for 10 columns of size 4 on 512 dots. A `plain` line is sent with the `ESC a` of its `align` instead.
|
||||
- The banner's columns come from the smaller of the line's dots and the profile's, so that a `printer.columns` wider than the paper cannot make the printer wrap a band.
|
||||
- Trade-off: the band is narrower than the paper by up to one character less a dot, split between the edges. On the TM-T88's 512 dots in Font A that is 32 dots at sizes 4, 5 and 8, and 8 dots at the other sizes. With `printer.columns` narrower than the paper, a banner centres on the paper while the other blocks centre within the narrower line.
|
||||
- Alternatives: `invert` as the default style's name, beside the `invert` field a banner refuses; a frame of box borders at the banner's size, which on a TM-T88 at size 4 leaves 6 characters inside; a band from a raster image, which needs a bitmap font (job-store.md's preview image).
|
||||
16. **Its size.** Assumed: `size` is 1-8, or 0 for automatic. Automatic picks the largest size from 4 down to 2 at which every paragraph of the text fits on one line: the line holds `lineDots / (glyph × size)` characters, as `blockColumns` computes (render.go:484-486). On a TM-T88 in Font A that is 10, 14 or 21 characters; on 58 mm paper 8, 10 or 16. Text too long at size 2 wraps at size 2. Width and height are always equal.
|
||||
16. **Its size.** `size` is 1-8, or 0 for automatic. Automatic picks the largest size from 4 down to 2 at which every paragraph of the text fits on one line: the line holds `lineDots / (glyph × size)` characters, as `blockColumns` computes (render.go:484-486). On a TM-T88 in Font A that is 10, 14 or 21 characters; on 58 mm paper 8, 10 or 16. Text too long at size 2 wraps at size 2. Width and height are always equal.
|
||||
- Trade-off: automatic never goes past size 4, since each line of size 8 is 192 dots, 27 mm, of paper.
|
||||
- Alternatives: automatic up to 8; separate `width` and `height`, as text has.
|
||||
17. **Where a banner may go.** Assumed: at the top level and, once stage 5 has shipped, in a group; never in a box. A box prints every line at its one size (render.go:456), so its borders could not join a banner's lines.
|
||||
17. **Where a banner may go.** At the top level and, once stage 5 has shipped, in a group; never in a box. A box prints every line at its one size (render.go:456), so its borders could not join a banner's lines.
|
||||
- Trade-off: a card that wants a big heading puts the banner above the box.
|
||||
- Alternative: a banner child that prints between a box's lines, breaking the side borders, which no other child does.
|
||||
|
||||
Before stage 4, inline spans:
|
||||
For stage 4, inline spans:
|
||||
|
||||
18. **The shape.** Assumed: a `text` element takes `spans` in place of `text`: an array of runs, each with `text` (required, may hold `\n`), `bold`, `underline` (0-2), `invert`, and at the top level `size`, `width` and `height` (1-8 each):
|
||||
18. **The shape.** A `text` element takes `spans` in place of `text`: an array of runs, each with `text` (required, may hold `\n`), `bold`, `underline` (0-2), `invert`, and at the top level `size`, `width` and `height` (1-8 each):
|
||||
```json
|
||||
{"type": "text", "align": "center", "spans": [
|
||||
{"text": "Table 4 · "}, {"text": "2 guests", "bold": true},
|
||||
@@ -130,42 +103,33 @@ Before stage 4, inline spans:
|
||||
- The tags: `spans` `minItems=1,maxItems=100`; in `Span`, `text` `required,minLength=1`, `underline` `minimum=0,maximum=2`, and `size`, `width` and `height` `minimum=0,maximum=8`, 0 meaning the default.
|
||||
- Text today already continues a line with `"newline": false` and wraps across sizes (render.go:354-392, TestRenderInlineMixedSizesWraps). Spans add what that cannot do: a word that changes style part-way stays one word; a mixed line can be centred or right-aligned as one line, since `ESC a` takes effect only at the start of a line (Investigation findings, ESC/POS); spans work inside a box, where `"newline": false` is refused (job.go:295-297); and one element replaces several towards the 500-element limit.
|
||||
- Trade-off: a field that only `text` takes; the older types refuse it, as they refuse `optional` (block.go:93-96).
|
||||
- Alternatives: markup inside `text`, such as `**bold**`, behind a `markup: true` flag, since without one it would change what existing jobs print; per-span `font`.
|
||||
19. **Wrapping with mixed sizes.** Assumed: wrap measures in dots. A character of a run of width multiplier `w` takes `w × glyph` dots; a line holds `lineDots` dots, less the position already used, as today. Words are found across runs, so `**8**.50` is one word. Each run is normalised on its own, so a combining mark at the start of a run cannot compose with the run before it. The printer aligns characters of different heights on one line at their baseline (Investigation findings, ESC/POS).
|
||||
19. **Wrapping with mixed sizes.** Wrap measures in dots. A character of a run of width multiplier `w` takes `w × glyph` dots; a line holds `lineDots` dots, less the position already used, as today. Words are found across runs, so `**8**.50` is one word. Each run is normalised on its own, so a combining mark at the start of a run cannot compose with the run before it. The printer aligns characters of different heights on one line at their baseline (Investigation findings, ESC/POS).
|
||||
- For text of one size the new wrap gives exactly today's lines (layout.go:56-115), so the compat fixtures `wrap`, `inline` and `text-styles` keep their bytes. It keeps today's rules, each of which a test pins: a run of spaces fits whole or not at all, so `wrap(" word", 2, 10)` gives `["", "word"]`; a first word that does not fit a continued line leaves an empty first line; a word longer than the whole line moves to a fresh line before it splits at the edge; the last line keeps its trailing spaces, which `"newline": false` relies on; and where a character is wider than the whole line, as with `printer.columns` of 1 at size 2, the first line is empty and each character takes a line, as `wrap("ab", 0, 1)` gives `["", "a", "b"]`.
|
||||
- A tab fills with spaces of its run's width up to the next multiple of 8 such characters from the line's start, at least one; for text of one size that is today's `expandTabs` from `p.x / glyph` (render.go:373).
|
||||
- Stage 4's first commit makes the change alone. Today's `wrap` moves into a `_test.go` file as the reference that a property test compares with; a copy outside the tests, with no caller, would fail staticcheck.
|
||||
- Trade-off: none known.
|
||||
- Alternative: spans of one size only, measured in characters.
|
||||
20. **Spans in other blocks.** Assumed: spans only in `text`, at the top level and as a text child of a box. kv values, list items, table cells and banners stay plain strings.
|
||||
20. **Spans in other blocks.** Spans only in `text`, at the top level and as a text child of a box. kv values, list items, table cells and banners stay plain strings.
|
||||
- Trade-off: a bold word in a table cell must wait.
|
||||
- Alternative: each of those fields takes either a string or an array of spans, which needs a custom decoder that keeps unknown fields refused.
|
||||
21. **Sizes inside a box.** Assumed: inside a box, spans take `bold`, `underline` and `invert` only. A box lays out in cells of one size and prints each line at that size (render.go:456), and a taller span would leave the side borders short on its line.
|
||||
21. **Sizes inside a box.** Inside a box, spans take `bold`, `underline` and `invert` only. A box lays out in cells of one size and prints each line at that size (render.go:456), and a taller span would leave the side borders short on its line.
|
||||
- Trade-off: no large word inside a card.
|
||||
- Alternative: spans of `width` and `height` inside a box, with the borders and padding of that line printed at the line's height, so `│` stretches and joins.
|
||||
|
||||
Before stage 5, the group:
|
||||
For stage 5, the group:
|
||||
|
||||
22. **What a group holds.** Assumed: `{"type": "group", "title": "Kitchen", "children": [...]}`. Its children are at least one element of any top-level type but `group`, `raw` and `cut`. They have no limit of their own, as a box's children have none: children of a group and children of a box inside it count toward the 500-element limit. `children` is shared with a box, so a limit of a group's own could not go into its tag. A group cannot go inside a box. It prints its heading, then each child as if it stood at the top level.
|
||||
22. **What a group holds.** `{"type": "group", "title": "Kitchen", "children": [...]}`. Its children are at least one element of any top-level type but `group`, `raw` and `cut`. They have no limit of their own, as a box's children have none: children of a group and children of a box inside it count toward the 500-element limit. `children` is shared with a box, so a limit of a group's own could not go into its tag. A group cannot go inside a box. It prints its heading, then each child as if it stood at the top level.
|
||||
- The templates plan (the templates item of design.md's Planned next, docs/plans/templates.md) gets a container: one template value, such as one step of an `each`, can become several elements.
|
||||
- `raw` is refused because the token scope is checked on top-level elements only (server/auth.go:135-150); stage 5 makes that check walk groups too, so the refusal does not rest on validation alone. `cut` is refused so that a group is never split by a cut.
|
||||
- Trade-off: no group inside a group.
|
||||
- Alternatives: groups nested to a fixed depth; any type allowed, `raw` included; 1-100 children per group, stated in the doc comment only, which goes against putting every limit in a tag.
|
||||
23. **Keep-together.** Assumed: a group adds nothing beyond what every receipt has. A job renders to one stream and is sent on one connection (design.md:39-46), so no other job's lines can come between a group's lines, and a receipt has no pages to break across. A group refuses `cut` (question 22), so no cut falls inside one. The plan names keep-together only to record that it means nothing more on a receipt.
|
||||
23. **Keep-together.** A group adds nothing beyond what every receipt has. A job renders to one stream and is sent on one connection (design.md:39-46), so no other job's lines can come between a group's lines, and a receipt has no pages to break across. A group refuses `cut` (decision 22), so no cut falls inside one. The plan names keep-together only to record that it means nothing more on a receipt.
|
||||
- Trade-off: none known.
|
||||
- Alternatives: an ntfy digest's paper budget drops a group whole rather than part of it, which is a module's choice; page mode (`ESC L`), which nothing else uses and the preview does not read.
|
||||
24. **Shared style.** Assumed: the group's `font` and `size` (1-3) are the defaults for children that take them and do not set their own.
|
||||
24. **Shared style.** The group's `font` and `size` (1-3) are the defaults for children that take them and do not set their own.
|
||||
- `font`: `text`, `box`, `rule`, `kv`, `list`, and, once their stages have shipped, `table` and `banner`.
|
||||
- `size`: the same, less the banner, whose `0` means automatic, and less a `text` that sets `width`, `height` or `spans`, which carry their own sizes. A `qr`'s size is its module size, so it never takes the group's.
|
||||
- A child's own value wins, unlike a box, whose children may not set them (block.go:115-116).
|
||||
- Trade-off: a group's size can make a child's block wider than it was written for, as any size does.
|
||||
- Alternatives: `font` only; also `bold` and `align`, though `bold` is a plain boolean (job.go:87), so a child could not turn it off.
|
||||
25. **The heading.** Assumed: `title` prints as a rule with the title set in on the left, `── Kitchen ──────────`, in the group's font and size. `style` picks the rule's line from the rule styles, and `title_bold` prints the title bold. No title, no heading.
|
||||
25. **The heading.** `title` prints as a rule with the title set in on the left, `── Kitchen ──────────`, in the group's font and size. `style` picks the rule's line from the rule styles, and `title_bold` prints the title bold. No title, no heading.
|
||||
- Trade-off: one look for every heading.
|
||||
- Alternatives: a bold text line; a banner.
|
||||
26. **Paths in errors and warnings.** Assumed: a child is named by its path, `elements[2].children[1]`, and a box child inside it `elements[2].children[1].children[0]`, in validation problems, render errors and preview warnings. Images inside a group are loaded before anything renders, as every image is (render.go:175-193), keyed by path.
|
||||
26. **Paths in errors and warnings.** A child is named by its path, `elements[2].children[1]`, and a box child inside it `elements[2].children[1].children[0]`, in validation problems, render errors and preview warnings. Images inside a group are loaded before anything renders, as every image is (render.go:175-193), keyed by path.
|
||||
- Trade-off: none known.
|
||||
- Alternative: flatten groups before rendering and name children by their flat index, which no client wrote.
|
||||
|
||||
## Investigation findings
|
||||
|
||||
@@ -207,7 +171,7 @@ WHERE THE FINDINGS ARE UNSURE
|
||||
- Whether the lines of a reversed banner touch: stage 3's paper check settles it.
|
||||
|
||||
THE OTHER PLANS
|
||||
- job-store.md's preview image (its phase 3a) draws box drawing and shading from the cell geometry, every other glyph from a bitmap font. The new junctions are box drawing and need nothing more. Banners and spans need drawing at a run's `W` and `H`, which `escpos.Run` already carries (interpret.go:29-38). ON ACCEPTANCE adds this to that phase.
|
||||
- job-store.md's preview image (its phase 3a) draws box drawing and shading from the cell geometry, every other glyph from a bitmap font. The new junctions are box drawing and need nothing more. Banners and spans need drawing at a run's `W` and `H`, which `escpos.Run` already carries (interpret.go:29-38). That phase's golden PNGs include each block that has shipped.
|
||||
- printers.md: each printer renders with its own profile, so a table can stack on a narrow printer and not on a wide one. `format.max_lines` is global (printers.md, the keys that belong to each printer), so a table that stacks into more lines can fail on one printer of a multicast.
|
||||
- remote-printers.md, the decision on where rendering happens: main renders in full and the agent writes the bytes unchanged. Nothing here changes that.
|
||||
|
||||
@@ -242,7 +206,7 @@ What prints, on cp437 and a TM-T88 at size 1:
|
||||
Prep for 18:00
|
||||
```
|
||||
|
||||
The rule is `{"type": "rule", "char": "*", "text": "TODAY"}`, and the table question 7's example. Columns 2 and 3 are as wide as their widest cells, and the first takes the rest: 42 characters less 4 borders and 6 spaces of padding leave 32, of which `Qty` takes 3 and `Price` 5. The last two lines are a group's heading and its first child. A banner prints `ORDER 42` at size 4 as one white-on-black band of 10 characters, and spans print styled words within one wrapped line, which a text preview shows as plain text.
|
||||
The rule is `{"type": "rule", "char": "*", "text": "TODAY"}`, and the table is decision 7's example. Columns 2 and 3 are as wide as their widest cells, and the first takes the rest: 42 characters less 4 borders and 6 spaces of padding leave 32, of which `Qty` takes 3 and `Price` 5. The last two lines are a group's heading and its first child. A banner prints `ORDER 42` at size 4 as one white-on-black band of 10 characters, and spans print styled words within one wrapped line, which a text preview shows as plain text.
|
||||
|
||||
The same table at size 3, 14 characters wide, stacks. Its first row and the separator after it:
|
||||
|
||||
@@ -258,7 +222,7 @@ COMPATIBILITY
|
||||
- Every existing element, field and response keeps its meaning. TestRenderCompat, TestPaperReceipts and the block goldens keep their bytes.
|
||||
- New types and fields only. `/print` stays strictly decoded, so an older daemon refuses a job that uses them, as it refuses any unknown field.
|
||||
- The `style` enum gains `none`, `band`, `plain` and `ruled`; the `type` enum gains `table`, `banner` and `group`.
|
||||
- A job over `format.max_lines` is refused with a message that gives a lower bound on its lines (question 12).
|
||||
- A job over `format.max_lines` is refused with a message that gives a lower bound on its lines (decision 12).
|
||||
|
||||
INVARIANTS
|
||||
1. Nothing reaches the printer unless the whole receipt rendered. Every new block lays out inside `Renderer.render`, before `Render` returns a byte.
|
||||
@@ -268,12 +232,6 @@ INVARIANTS
|
||||
5. Text stays text. Every new string is normalised and stripped of control characters before it is encoded, and no new field sends bytes as given.
|
||||
6. Layout never panics. The fuzz target FuzzBlocks (fuzz_test.go:18) covers each new block. Its width check, every line as wide as the first and no wider than the line at the block's size (fuzz_test.go:67-79), holds for a table, framed or stacked, as it stands. A banner checks its text lines against its chosen size and its `ruled` lines against size 1. A text with spans checks that no line passes `lineDots` in dots. A group checks each child as it would at the top level.
|
||||
|
||||
ON ACCEPTANCE
|
||||
When the owner accepts this plan, these edits are made:
|
||||
- design.md: Planned next item for more blocks records the decisions accepted, as the remote-printers item does.
|
||||
- docs/plans/formatters.md: phase 5's "More blocks" item points here, and its deferred list keeps only "nested boxes" and goldmark.
|
||||
- docs/plans/job-store.md phase 3a: its golden PNGs include each block of docs/plans/blocks.md that has shipped, banners and spans drawn at a run's `W` and `H`.
|
||||
|
||||
## Architecture
|
||||
|
||||
FIELDS AND TYPES
|
||||
@@ -288,7 +246,7 @@ TABLE LAYOUT
|
||||
For a table of `n` columns, width `W` characters (`blockWidth`, blocklayout.go:59-64) and padding `p`:
|
||||
1. The room for cells is `R = W − (n + 1) − 2pn` for a frame, or `R = W − (n − 1)(1 + 2p)` for `none`.
|
||||
2. Each column wants `want = min(word, natural, width)` and needs `need = min(want, 8)`, each at least 1, where `word` is its longest word, `natural` its longest line and `width` its fixed width if set, the header included.
|
||||
3. `p` drops, one step at a time, while `R < Σ want` and `p > 0`. If `R < Σ need` at `p = 0`, the table stacks (question 11).
|
||||
3. `p` drops, one step at a time, while `R < Σ want` and `p > 0`. If `R < Σ need` at `p = 0`, the table stacks (decision 11).
|
||||
4. Each column starts at `need`. Round 1 brings fixed columns to `width` and auto columns to their least width, their longest word; round 2 brings auto columns to `natural`. A round that cannot be met in full shares the room left in proportion to what each column still wants, by largest remainder, ties to the left.
|
||||
5. Room still left goes to the `grow` columns in proportion, or to the first auto column, unless `fit` is set or every column is fixed; the table is then narrower than `W` and centred.
|
||||
6. Lines: the top border, the header and its separator, the body, the foot and its separator, the bottom border. Every line is exactly the table's width before centring, as box lines are (blocklayout.go:105-158). Borders, fills and padding are plain; header and foot cells are bold.
|
||||
@@ -297,22 +255,22 @@ BANNER PRINTING
|
||||
A banner is not a cell block: it prints its text lines at its size and its `ruled` lines at size 1, each sent with `ESC a 1` (a `plain` line with its `align`'s), reversed for `band`, with no margin spaces. Each line counts as one toward `max_lines`, as a line of large text does today.
|
||||
|
||||
SPANS
|
||||
`text` with spans lays out runs: each run normalised, then wrapped by dots (question 19), then printed with `changeStyle` (render.go:488-499) extended to size. The position in dots carries over to the next element as today.
|
||||
`text` with spans lays out runs: each run normalised, then wrapped by dots (decision 19), then printed with `changeStyle` (render.go:488-499) extended to size. The position in dots carries over to the next element as today.
|
||||
|
||||
GROUPS
|
||||
`printer.element` prints a group's heading as a rule, then each child through `printer.element` with the group's defaults filled in. `loadImages`, the preview's placeholders and labels, the unknown-character counts and `checkRaw` walk group children by path.
|
||||
|
||||
## Phases
|
||||
|
||||
Every commit below that changes behaviour carries its own tests, goldens, docs, regenerated docs/swagger.json where a type changes, and CHANGELOG entry, under Added unless its stage says otherwise. Each stage's paper receipt is pinned as question 2 says.
|
||||
Every commit below that changes behaviour carries its own tests, goldens, docs, regenerated docs/swagger.json where a type changes, and CHANGELOG entry, under Added unless its stage says otherwise. Each stage's paper receipt is pinned as decision 2 says.
|
||||
|
||||
### Stage 1: The rule character
|
||||
|
||||
**Goal.** `rule` takes `char`, one character repeated across the line, with its fold and then its `style` as the fallback. Questions 1-6.
|
||||
**Goal.** `rule` takes `char`, one character repeated across the line, with its fold and then its `style` as the fallback. Decisions 1-6.
|
||||
|
||||
**Work.**
|
||||
- block.go: `char` in the fields tables, on `rule` at the top level only; `ruleSpec` checks it (question 4).
|
||||
- glyphs.go: the pattern for a rule with `char` (question 5).
|
||||
- block.go: `char` in the fields tables, on `rule` at the top level only; `ruleSpec` checks it (decision 4).
|
||||
- glyphs.go: the pattern for a rule with `char` (decision 5).
|
||||
- blocklayout.go: `rule` uses it (blocklayout.go:362-366).
|
||||
- job.go: `Char` with `minLength=1,maxLength=1`.
|
||||
- examples/rule-char.json: `*`, `~`, `=`, `■`, `•` (folding to `·`), `♦` (falling back to the style), each with a label, and one at `size: 2`.
|
||||
@@ -335,23 +293,23 @@ Every commit below that changes behaviour carries its own tests, goldens, docs,
|
||||
|
||||
### Stage 2: The table
|
||||
|
||||
**Goal.** A `table` block with columns, rows, a header and foot rows, in every box style and `none`, sized by content to the paper, wrapping in cells and stacking when its columns do not fit. It may go inside a box. Questions 1-3 and 7-14.
|
||||
**Goal.** A `table` block with columns, rows, a header and foot rows, in every box style and `none`, sized by content to the paper, wrapping in cells and stacking when its columns do not fit. It may go inside a box. Decisions 1-3 and 7-14.
|
||||
|
||||
**Work.**
|
||||
- render.go: the `printer` knows `MaxLines` and the copies, and stops as soon as the lines so far, times the copies, pass the limit (question 12); `LineLimitError` says "at least" when it stopped early. docs/api.md's `too_many_lines` example (api.md:195-198); CHANGELOG under Changed.
|
||||
- render.go: the `printer` knows `MaxLines` and the copies, and stops as soon as the lines so far, times the copies, pass the limit (decision 12); `LineLimitError` says "at least" when it stopped early. docs/api.md's `too_many_lines` example (api.md:195-198); CHANGELOG under Changed.
|
||||
- job.go: `TypeTable`, `Column`, `Cols`, `Rows`, `Foot`; the `style` enum gains `none`.
|
||||
- block.go: `tableSpec`, with the checks of question 12, and the problems of each row by index.
|
||||
- glyphs.go: the table's border sets, junctions included, with the fallback of question 1; `none`.
|
||||
- block.go: `tableSpec`, with the checks of decision 12, and the problems of each row by index.
|
||||
- glyphs.go: the table's border sets, junctions included, with the fallback of decision 1; `none`.
|
||||
- blocklayout.go (or a new tablelayout.go): TABLE LAYOUT; the stacked form through `kvLines`; a table item in a box, with its natural width for `fit`.
|
||||
- render.go: `table` in `printer.element` and `printer.block`; the table's layout and its cells' wrap check the line limit at each row.
|
||||
- Two receipts: examples/table.json, question 7's table in `double-h`, `single` and `none`; examples/table-narrow.json, a narrow one by `columns` that wraps cells, one that stacks, and a `none` table in a box.
|
||||
- Two receipts: examples/table.json, decision 7's table in `double-h`, `single` and `none`; examples/table-narrow.json, a narrow one by `columns` that wraps cells, one that stacks, and a `none` table in a box.
|
||||
- docs/api.md: § `table` with examples and the field table, the Elements intro (api.md:307-308), the Blocks intro (api.md:409-419), § Glyphs and code pages, and § `box`'s children (api.md:463-475) for commit 4; README's list of blocks (README.md:11); design.md, the decisions.
|
||||
|
||||
**Tests.**
|
||||
- testdata/blocks/table-styles.json, table-widths.json (fixed, auto, `grow`, `fit`, all fixed), table-wrap.json, table-narrow.json (padding given up, words split, stacked) and table-box.json, goldens in the three code pages.
|
||||
- Width sums: every line of every golden table is exactly the table's width; a table test on the tm-t20 and generic-58mm profiles, so widths follow the profile.
|
||||
- Distribution: largest remainder and ties to the left, by table test.
|
||||
- Validation: each limit of question 12, a ragged row, `grow` with `width`, an unknown `align`, each refused with its path.
|
||||
- Validation: each limit of decision 12, a ragged row, `grow` with `width`, an unknown `align`, each refused with its path.
|
||||
- The early stop: 500 text elements of 10 lines each against a limit of 100 stop at the eleventh element, by a count of elements rendered; a table of 100 rows in a 1-character column stops at the row that passes the limit, by `testing.AllocsPerRun` against a table that fits. Under the limit, every compat fixture keeps its bytes.
|
||||
- cp858 equal to cp850; schema tag tests; FuzzBlocks with tables.
|
||||
- Golden PNGs of the two examples, if job-store phase 3a has shipped.
|
||||
@@ -362,7 +320,7 @@ Every commit below that changes behaviour carries its own tests, goldens, docs,
|
||||
3. Add foot rows to the table block
|
||||
4. Allow a table inside a box
|
||||
|
||||
Commit 2 includes the stacked form: without it, a framed table on a line narrower than `2n + 1` characters would print lines wider than the block. The examples and goldens grow with the commits, since TestExampleJobs checks every example at each one. Commit 2 has question 7's table without its foot, in `double-h`, `single` and `none`, the narrow one that wraps and the one that stacks. Commit 3 adds the foot, which the stacked form prints too. Commit 4 adds the `none` table in a box, with testdata/blocks/table-box.json. If commit 2 passes the 800-line split point, "Add a frameless style to the table block" comes out of it, after it.
|
||||
Commit 2 includes the stacked form: without it, a framed table on a line narrower than `2n + 1` characters would print lines wider than the block. The examples and goldens grow with the commits, since TestExampleJobs checks every example at each one. Commit 2 has decision 7's table without its foot, in `double-h`, `single` and `none`, the narrow one that wraps and the one that stacks. Commit 3 adds the foot, which the stacked form prints too. Commit 4 adds the `none` table in a box, with testdata/blocks/table-box.json. If commit 2 passes the 800-line split point, "Add a frameless style to the table block" comes out of it, after it.
|
||||
|
||||
**Done when.**
|
||||
- The full gate passes.
|
||||
@@ -370,13 +328,13 @@ Commit 2 includes the stacked form: without it, a framed table on a line narrowe
|
||||
|
||||
### Stage 3: The banner
|
||||
|
||||
**Goal.** A `banner` block of large text across the line in `band`, `plain` or `ruled`, sized automatically from the paper. Questions 1-3 and 15-17.
|
||||
**Goal.** A `banner` block of large text across the line in `band`, `plain` or `ruled`, sized automatically from the paper. Decisions 1-3 and 15-17.
|
||||
|
||||
**Work.**
|
||||
- Before the code: read `ESC a` and `GS B` in Epson's command reference, in a browser. If a finding under ESC/POS does not hold, stop and ask the owner.
|
||||
- job.go: `TypeBanner`; the `style` enum gains `band`, `plain` and `ruled`.
|
||||
- block.go: `bannerSpec`: `text` required, `size` 0-8, `style`, `align`, `bold`, `font`.
|
||||
- render.go and blocklayout.go: the automatic size (question 16), the lines, BANNER PRINTING.
|
||||
- render.go and blocklayout.go: the automatic size (decision 16), the lines, BANNER PRINTING.
|
||||
- Two receipts: examples/banner.json, `ORDER 42` in each style at the automatic size and in Font B; examples/banner-large.json, a two-line band and size 8.
|
||||
- docs/api.md: § `banner`, the Elements intro, the Blocks intro (a banner takes `size` 0-8 and no `columns`), § Glyphs and code pages (`▄ ▀` as `=` on cp1252); README's list of blocks; design.md, the decisions.
|
||||
|
||||
@@ -396,16 +354,16 @@ Commit 2 includes the stacked form: without it, a framed table on a line narrowe
|
||||
|
||||
### Stage 4: Inline spans
|
||||
|
||||
**Goal.** `text` takes `spans`: styled runs within one line or wrapped paragraph, at the top level and in a box. Questions 2, 3 and 18-21.
|
||||
**Goal.** `text` takes `spans`: styled runs within one line or wrapped paragraph, at the top level and in a box. Decisions 2, 3 and 18-21.
|
||||
|
||||
**Work.**
|
||||
- Before the code: read `ESC a` and `GS !` in Epson's command reference, in a browser. If a finding under ESC/POS does not hold, stop and ask the owner.
|
||||
- layout.go: wrap measures each character's width (question 19), with today's `wrap` its case of equal widths. This commit changes no byte.
|
||||
- layout.go: wrap measures each character's width (decision 19), with today's `wrap` its case of equal widths. This commit changes no byte.
|
||||
- job.go: `Span` and `Spans`.
|
||||
- block.go and job.go: the checks of question 18, and question 21's inside a box; `ownFields` gains `spans`.
|
||||
- block.go and job.go: the checks of decision 18, and decision 21's inside a box; `ownFields` gains `spans`.
|
||||
- render.go: `text` with spans: normalise each run, wrap by dots, print runs with style and size changes, reset the style after.
|
||||
- blocklayout.go: a text child with spans lays out as styled runs in cells.
|
||||
- examples/spans.json: question 18's line; a paragraph that wraps across bold, underlined, inverted and size-2 runs; a word that changes style part-way; and, from commit 3, spans in a box.
|
||||
- examples/spans.json: decision 18's line; a paragraph that wraps across bold, underlined, inverted and size-2 runs; a word that changes style part-way; and, from commit 3, spans in a box.
|
||||
- docs/api.md § `text` and § `box`; design.md, the decisions.
|
||||
|
||||
**Tests.**
|
||||
@@ -413,7 +371,7 @@ Commit 2 includes the stacked form: without it, a framed table on a line narrowe
|
||||
- Mixed sizes break where the dots run out, not the characters; a word across runs stays whole; a character wider than the line takes its own line.
|
||||
- testdata/blocks/spans.json, goldens in the three code pages; the preview's runs carry each span's style and size.
|
||||
- Validation: `text` with `spans`, an element style with spans, `"wrap": false` with spans, an empty span, a span `size` inside a box, 101 spans, each refused; `spans` on a `qr` refused.
|
||||
- Tabs in runs of different widths stop where question 19 says.
|
||||
- Tabs in runs of different widths stop where decision 19 says.
|
||||
- Schema tag tests; FuzzBlocks with spans.
|
||||
- A golden PNG of examples/spans.json, if job-store phase 3a has shipped.
|
||||
|
||||
@@ -430,7 +388,7 @@ Commit 1 changes no behaviour, so it has no docs or CHANGELOG entry. Commit 2's
|
||||
|
||||
### Stage 5: The group
|
||||
|
||||
**Goal.** A `group` holds elements under an optional heading, with a shared font and size. Questions 2, 3 and 22-26.
|
||||
**Goal.** A `group` holds elements under an optional heading, with a shared font and size. Decisions 2, 3 and 22-26.
|
||||
|
||||
**Work.**
|
||||
- job.go and block.go: validation by where an element stands (Architecture, FIELDS AND TYPES), with no change to what a box accepts or to any message. This commit changes no behaviour.
|
||||
|
||||
Reference in new issue
Block a user