You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e0df93b
Browse filesBrowse the repository at this point in the historyBrowse files
Kevin Arthur
committed
fix(import): keep vertical PDF writing vertical
Identity-V (and any CMap whose /WMode is 1) advances glyphs down the page.
The importer advanced every run horizontally, so a Japanese or Chinese column
arrived as one long line: the characters all existed, which made it a wrong
document rather than a reported fidelity loss.
The font record now carries the writing mode (name suffix -V, or an embedded
CMap declaring /WMode 1), the interpreter advances down for those runs, and
the node is created with writingMode vertical-rl, which Varve already renders
and edits natively. The per-glyph advance is one em because /W2 is not read;
the Import Report states that rather than implying exact metrics.
Evidence: PDFCraft 3216 (vertical Identity-V measured as horizontal), 3711
(tate-chu-yoko digits), 3712 (upright glyphs read as horizontal rows).
Unit tests cover Identity-V, CMap /WMode 1 and an Identity-H control; the
browser test imports the fixture through File > Import and asserts the
rendered ink is a column (38x96 at 100%), not a line.
Also stops the import-integrity browser test writing evidence screenshots into
the checkout: that dirtied the source tree mid-run, and the CI lane runner
requires an unchanged clean source at the planned commit. Screenshots go to a
temp directory unless VARVE_SHOT_DIR says otherwise.
Copy file name to clipboardExpand all lines: docs/architecture/import-system.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -107,7 +107,7 @@ server (`tests/e2e/canvas/file-import.spec.ts`, snapshots inspected).
107
107
| AVIF | Full |`ispe` box probe now recurses through `iprp`/`ipco`|
108
108
| SVG / SVGZ | Editable vector | See fidelity matrix; `.svgz` is gunzipped by content sniff and retains the `svgz` source label in the Import Results report, including bounded malformed-input failures |
109
109
| PSD / PSB | Partial | Version 1/2 `8BPS` files import a bounded layer tree (groups, bounds, visibility, opacity, and representable masks), and the asynchronous service path materializes supported layer pixels as embedded PNG image fills; header, dimension, encoded-size, and pixel budgets are checked before parsing; invalid or sentinel mask rectangles are omitted with a warning; effects, adjustment layers, smart objects, and exact text editing are reported as unsupported, with detected smart-object layers counted explicitly (imported as rendered pixels only; embedded artwork, warps, and re-editability are not extracted) |
110
-
| PDF | Partial | Text and axis-aligned rectangle fills, per page. Content streams are decoded (zlib `FlateDecode`, ASCIIHex, ASCII85) and tokenized, so text positions come from the text matrix composed with the CTM and are mapped into page space (top-left origin, `/Rotate` applied, crop box used when it differs). Character codes resolve through the font's `/ToUnicode` CMap, otherwise the named base encoding plus `/Differences`. Page order follows the `/Kids` tree, with/inherited `/MediaBox`, `/Rotate` and `/Resources`. **Content the page does not show is not imported:** text in an invisible or clip-only render mode (`3 Tr`/`7 Tr`, the shape of a searchable OCR layer) and content inside an optional-content group the document's default configuration hides (a PDF "layer", as layered CAD exports ship) are counted and named in `unsupportedFeatures` instead of being painted as visible artwork. **An encrypted document is refused with an explanation**, never imported as ciphertext that looks like an empty page. Everything else — images, form XObjects, curves, strokes, gradients, CMYK and pattern paints, composite-font runs with no mapping — is counted and named in `unsupportedFeatures`, never approximated. Bounded: 32 MB file, 16 MB per decoded stream, 50 pages |
110
+
| PDF | Partial | Text and axis-aligned rectangle fills, per page. Content streams are decoded (zlib `FlateDecode`, ASCIIHex, ASCII85) and tokenized, so text positions come from the text matrix composed with the CTM and are mapped into page space (top-left origin, `/Rotate` applied, crop box used when it differs). Character codes resolve through the font's `/ToUnicode` CMap, otherwise the named base encoding plus `/Differences`. Page order follows the `/Kids` tree, with/inherited `/MediaBox`, `/Rotate` and `/Resources`. **Content the page does not show is not imported:** text in an invisible or clip-only render mode (`3 Tr`/`7 Tr`, the shape of a searchable OCR layer) and content inside an optional-content group the document's default configuration hides (a PDF "layer", as layered CAD exports ship) are counted and named in `unsupportedFeatures` instead of being painted as visible artwork. Vertical writing is preserved: a Type0 font whose CMap selects `/WMode 1` (`Identity-V`, or an embedded CMap that says so) is imported as a Varve vertical text node (`writingMode: vertical-rl`) instead of a single horizontal line. The per-glyph advance is one em because the font's `/W2` metrics are not read, and the capability note says so. **An encrypted document is refused with an explanation**, never imported as ciphertext that looks like an empty page. Everything else — images, form XObjects, curves, strokes, gradients, CMYK and pattern paints, composite-font runs with no mapping — is counted and named in `unsupportedFeatures`, never approximated. Bounded: 32 MB file, 16 MB per decoded stream, 50 pages |
111
111
| AI | Partial |`.ai` files with a PDF-compatible wrapper or legacy EPS header use the AI adapter; complex Illustrator effects, meshes, and native semantics are reported as losses; header-only or over-budget wrappers fail without fabricated nodes |
112
112
| EPS | Partial | Basic paths |
113
113
| Sketch | Partial | Symbols, shared styles and constraints not preserved |
Copy file name to clipboardExpand all lines: docs/audits/pdfcraft/README.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -125,6 +125,7 @@ signature and Office interchange, all of which remain outside Varve's scope.
125
125
| 6 | Page rotation, page count and output size surviving save/reopen/export |**verified for save/reopen** — Varve's page-rotation model is per-page width/height, and a mixed-orientation document round-trips with order and node positions intact (commit `340262b60`). Export page geometry is the native writer's contract and is covered by `tests/e2e/export/native-pdf-contract.spec.ts`, not by a browser unit test |
126
126
| 7 | Text edit identity (paragraph indices, property loss on re-edit) | already handled upstream: edits target authored node ids (ADR-0242), and the draft/target-switch paths are covered by `context/pendingEdits.ts` with `tests/e2e/save/text-draft-save.spec.ts` and `text-target-switch.spec.ts`|
127
127
| 8 | Autosave scheduling tied to repaint; failed-autosave retry suppression | deferred — `packages/editor/src/context/usePersistence.ts` belongs to another session; two writers on one file is worse than a delay |
128
+
| 10 | Vertical writing (`Identity-V`) imported as one horizontal line, so a CJK column became the wrong document |**implemented and validated** — `/WMode 1` (name or embedded CMap) is detected and the run becomes a `vertical-rl` text node; unit tests cover detection and the browser test asserts the rendered ink is a column. Per-glyph advance is one em (`/W2` unread) and disclosed in the Import Report. Commit `codex/pdfcraft-remainder-20261022`|
128
129
| 9 | PDF import invents content the page does not show: invisible/clip-only text, hidden optional-content layers, encrypted files imported as blank pages, and an inline image whose `EI` is followed by a delimiter |**implemented and validated** — `/OCProperties` visibility, `Tr` render modes, `/Encrypt` refusal with a failure status, and delimiter-terminated `EI`. Commits `3bdd3e336`, `bb2f53d24`; browser evidence in `tests/e2e/import/pdf-import-integrity.spec.ts` and `docs/screenshots/pdfcraft/`|
129
130
130
131
## Limitations (unresolved)
@@ -163,9 +164,9 @@ These are honest gaps, not completions:
163
164
Cutoff 2 is taken and reconciled; batches 1–6 and 9 are complete or recorded
164
165
with reasons. What remains, in priority order:
165
166
166
-
1.**Vertical-writing import** (rows 3216/3711/3712): map `Identity-V` runs and
167
-
`Tz`-upright placement into Varve's vertical text model, with a round-trip
168
-
test. This is the largest remaining fidelity gap found in the corpus.
167
+
1.~~Vertical-writing import (rows 3216/3711/3712)~~ — landed as batch 10. The
168
+
remaining refinement is `/W2` per-glyph vertical metrics (currently one em)
169
+
and `Tz`-upright placement inside a vertical run.
169
170
2.**Batch 8 (interaction)**: verify cursor ownership over chrome (rows 3001,
170
171
3383, 3871), overlay placement with two menus (3190), and small-window
171
172
clipping (3097, 3557, 3559). Each is a verification first; no UI change is
Copy file name to clipboardExpand all lines: docs/audits/pdfcraft/issue-ledger-cutoff2.tsv
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -140,7 +140,7 @@
140
140
3213 open high priority: high pdf-structure implemented-validated Flatten draws annotations on hidden layers: no annotation model; hidden OC content is not imported (batch 9). cutoff2
141
141
3214 open medium priority: medium pdf-structure implemented-validated Edit lists pictures on hidden layers: no PDF-object editing surface; hidden content is not imported. cutoff2
142
142
3215 open high priority: high,multiple issues pdf-structure implemented-validated Whole line redrawn in the first run's state: Varve imports positioned runs, not a re-writable line; text state is applied per run at import. cutoff2
143
-
3216 open critical priority: critical fonts-glyphs candidate Vertical (Identity-V) text measured as horizontal: Varve has vertical text authoring, but PDF import maps codes to horizontal runs. A vertical-writing import path is a real gap; queued, not implemented. cutoff2
143
+
3216 open critical priority: critical fonts-glyphs implemented-validated Vertical writing imported as a column: /Identity-V and /WMode 1 are detected and the run becomes a vertical-rl text node (packages/import/src/pdf/encoding.ts, contentInterpreter.ts, index.ts), with a unit test and a browser test asserting the ink box is a column. Per-glyph advance is one em because /W2 is not read; the capability note discloses it. cutoff2
144
144
3217 open high priority: high,multiple issues page-geometry cluster-assessed Page geometry and order round-trip is verified (batch 6); page editing of a PDF container is out of scope. cutoff2
145
145
3218 open high priority: high forms outside-varve-scope No Varve form model and none planned; the text-metric and glyph-coverage mechanisms inside form reports are routed to the fonts-glyphs rows. cutoff2
146
146
3219 open high priority: high pdf-structure cluster-assessed Varve imports PDF content into its own model and does not rewrite PDF structure; the transferable content-visibility classes are fixed in batch 9. cutoff2
@@ -399,8 +399,8 @@
399
399
3701 open low enhancement,priority: low interaction cluster-assessed Cursor/overlay ownership and small-window layout are queued candidates, not assumed defects. cutoff2
400
400
3707 open high priority: high fonts-glyphs implemented-validated Japanese kana rejected on macOS: coverage report (batch 2). cutoff2
401
401
3709 open low priority: low digital-signature outside-varve-scope No signature or certificate surface. cutoff2
402
-
3711 open medium priority: medium fonts-glyphs candidate tate-chu-yoko digits dropped on copy: same vertical-writing gap as 3216. cutoff2
403
-
3712 open high priority: high fonts-glyphs candidate Upright glyphs placed one by one read as horizontal rows: same vertical-writing gap. cutoff2
402
+
3711 open medium priority: medium fonts-glyphs implemented-validated Vertical writing imported as a column: /Identity-V and /WMode 1 are detected and the run becomes a vertical-rl text node (packages/import/src/pdf/encoding.ts, contentInterpreter.ts, index.ts), with a unit test and a browser test asserting the ink box is a column. Per-glyph advance is one em because /W2 is not read; the capability note discloses it. cutoff2
403
+
3712 open high priority: high fonts-glyphs implemented-validated Vertical writing imported as a column: /Identity-V and /WMode 1 are detected and the run becomes a vertical-rl text node (packages/import/src/pdf/encoding.ts, contentInterpreter.ts, index.ts), with a unit test and a browser test asserting the ink box is a column. Per-glyph advance is one em because /W2 is not read; the capability note discloses it. cutoff2
404
404
3713 open medium priority: medium fonts-glyphs candidate Character spacing splits copied Chinese: PDF import emits one run per Tj/TJ, so authored spacing is preserved in the node text; search/copy normalisation is queued. cutoff2
405
405
3715 open high priority: high digital-signature outside-varve-scope No signature or certificate surface. cutoff2
406
406
3724 open medium priority: medium,multiple issues interaction cluster-assessed Cursor/overlay ownership and small-window layout are queued candidates, not assumed defects. cutoff2
notes.push('The crop box was used as the page box where it differs from the media box');
457
461
}
462
+
if(diagnostics.verticalRuns>0){
463
+
notes.push(
464
+
`${diagnostics.verticalRuns} vertical text run(s) were imported as vertical text; their per-glyph advance is one em because the font's /W2 metrics are not read`,
465
+
);
466
+
}
458
467
if(report.unsupportedFilters.size>0)notes.push('Unsupported stream filters were reported');
0 commit comments