Commit Graph
209 Commits
Author SHA1 Message Date
saqib mir b3d3ac4469 Image XObject handler (Do operator) 2026-06-18 16:14:29 +05:30
furqan 661600075a Merge pull request 'furqan' (#61) from furqan into dev
Reviewed-on: https://gitea.maskantech.in/gitea_admin/pdf/pulls/61
2026-06-18 04:34:08 +00:00
Furqan-14 ff0962b111 Merge branch 'dev' of https://gitea.maskantech.in/gitea_admin/pdf into furqan 2026-06-18 10:03:25 +05:30
Furqan-14 bd6ba9205f fix: updated text reflow bugs 2026-06-18 10:03:10 +05:30
Furqan-14andClaude Opus 4.8 63369d4259 fix(reflow): wrapped bullet continuation got bullet-gap spacing instead of wrap spacing
buildBulletItem computed `leading` as the median over ALL paragraph line gaps. In a bullet list
the bullet-to-bullet gap (~14.2pt) is larger than the within-bullet wrap gap (~12.2pt) and dominates
the median, so a newly-wrapped continuation line was placed ~2pt too low (visible extra spacing
between e.g. the Architecture line and its "Design Patterns…" continuation).

Use the WRAP spacing instead: prefer the edited item's own internal line gap (if it already wraps),
then any hanging-continuation gap in the block, then the all-lines median, then font*1.2. Only
affects multi-line (wrapped) bullet items; single-line edits emit no continuation so are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 21:40:59 +05:30
Furqan-14andClaude Opus 4.8 6edec0cf22 fix(reflow): inserted bullet text picked up the bold label font
Typing at a run boundary (e.g. near "Async" in a bullet) often lands the new text in a
browser-created wrapper element whose only child is that text. resolveStyleEl's sibling-only
search then found no data-fid run and fell back to dominantFid — which for a bullet is the bold
LABEL run (its first run) — so the inserted text rendered bold.

Make resolveStyleEl CLIMB toward the editor root and scan siblings at each level (nearest
preceding run first, then following), so it reaches the real run spans alongside the wrapper and
the inserted text continues the adjacent run's font. data-advances is still read only from the
exact wrapping span, so inherited fonts correctly re-measure. Text typed inside an existing run
is unaffected (step 1 returns its span immediately).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 20:49:30 +05:30
Furqan-14andClaude Opus 4.8 839add269a fix(reflow): center/right edits 422'd and silently reverted
Two bugs made centered/right-aligned heading edits vanish on commit:

1. Gateway: ReflowParagraphData.align was Literal["left","justify"], so a center/right reflow
   commit failed Pydantic validation -> 422 Unprocessable Entity. Widened to include
   "center","right" (matches the frontend + engine, which already handle them).

2. Frontend: gatewayService.applyEdits caught ALL errors (incl. HTTP 422/403/500) and returned
   fake success with a phantom `${documentId}_edited` id. The app then adopted that id and 404'd
   on every fetch, so the edit silently reverted instead of showing an error. Now only genuine
   network failures use the offline fallback; real HTTP errors throw the gateway's detail so the
   caller toasts a clear message and stays on the current document.

Gateway runs with --reload (auto-picks up the model change); frontend needs a refresh.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 20:37:18 +05:30
Furqan-14andClaude Opus 4.8 ddbafbcd43 fix(build): build_wasm.ps1 builds the real wasm-pdfium engine + deploys pdfium-engine.{mjs,wasm}
build_wasm.ps1 built the `wasm` STUB preset (PDFENGINE_WITH_PDFIUM=OFF, reflow #ifdef'd out)
and deployed it to the UNUSED pdfengine.{mjs,wasm}. The frontend actually loads
pdfium-engine.{mjs,wasm} (the `wasm-pdfium` preset). So "rebuild the WASM" silently shipped a
reflow-less stub to the wrong file — engine changes never reached the browser.

- Build the `wasm-pdfium` preset (PDFium ON) into pdfeng-build/wasm-pdfium (outside OneDrive).
- Deploy bin/pdfengine.{mjs,wasm} -> public/pdfium-engine.{mjs,wasm} (the rename the frontend expects).
- Set EMSDK_QUIET before sourcing emsdk_env.ps1 (its stderr tripped $ErrorActionPreference='Stop').
- Run a new pdfium-engine.smoke.mjs (buildInfo + live-preview exports) instead of pdfengine.test.mjs,
  which targets the stub facade (mock render / engineHasSkia / getDocumentFonts) and can't pass here.
- Relax EAP around the smoke node call so a real failure reports cleanly, not as NativeCommandError.
- pdfengine.test.mjs: de-brittle the buildInfo assertion (was pinned to a stale exact phrase).

Verified: scripts/build_wasm.ps1 runs green end-to-end and deploys pdfium-engine.wasm (md5 53d1ec9f).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 19:24:45 +05:30
Furqan-14andClaude Opus 4.8 aff19ac027 build(wasm): deploy the REAL pdfium-engine.wasm with reflow fixes (caret x0, center/right)
The live-preview engine the frontend loads is pdfium-engine.wasm, built by the
`wasm-pdfium` CMake preset (PDFENGINE_WITH_PDFIUM=ON). The reflow code is inside
`#ifdef PDFENGINE_WITH_PDFIUM`, so the `wasm` stub preset (PDFium OFF) — which
scripts/build_wasm.ps1 builds and copies to the UNUSED pdfengine.wasm — never
contained reflow at all. Result: every prior "WASM rebuilt" step updated the wrong,
reflow-less artifact, so the caret x0 fix (and center/right) never reached the browser.

Rebuilt the wasm-pdfium preset and deployed bin/pdfengine.{mjs,wasm} ->
public/pdfium-engine.{mjs,wasm} (md5 now 53d1ec9f, reflow object 631KB vs the 18KB
stub). Bumped the cache-buster so browsers fetch the new engine.

Engine .pyd + overlay-diff gate unchanged (1.70%/1.69%, render identical); the x0
change is caret-only metadata.

Follow-up: build_wasm.ps1 builds the wrong (stub) preset and deploys the wrong file.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 19:12:44 +05:30
Furqan-14andClaude Opus 4.8 62c4aed48c fix(reflow): caret lands on wrong char in centered/right headings
The reflow caret layout hardcoded x0 = columnLeft. That matched only left-aligned
lines; for the new center/right headings the line renders at a shifted x (e.g. a
centered title starts ~215pt while columnLeft is the page margin ~54pt), so the
frontend mapped clicks and drew the caret ~160pt off the actual glyphs.

Record the line's true starting x (after lineX/center/right) as x0 instead. x0 is
caret-only metadata read by the live editor — it does not affect glyph emission or
the rendered page, so output is unchanged (overlay-diff gate identical: 1.70%/1.69%,
STRESS PASS). Rebuilt .pyd + WASM; cache version bumped.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 18:10:19 +05:30
Furqan-14andClaude Opus 4.8 660649a562 fix(reflow): kill bulge/merge + font-change on edit; add center/right, IME; harden Raw Text
Reflow (primary editor):
- Geometric backstop in reflow_paragraph: adopt any text object fully inside the paragraph
  bbox that the model's objectIndices omitted (PDFium glyph->object map can return -1), so it's
  deleted + its original font is resolved. Fixes both the leftover-glyph "bulge/merge" and the
  font-substitution-on-edit (same root cause). No-op on correctly-indexed paragraphs (gate-proven
  byte-identical: overlay diff unchanged at 1.69%/1.70%).
- Preserve data-fid on edited contentEditable nodes (extractFlatRuns climbs to nearest styled
  ancestor / inherits from adjacent run) so edits keep their real font instead of the dominant.
- Converge preview & commit through one buildReflowData (no preview-OK/commit-wrong drift).
- Center/right alignment: additive emission branch (greedy path only) + heading-align inference.
- IME composition handling (suppress render mid-composition; don't commit on composing Enter).
- Fix WASM document-handle leak (free superseded versions on documentId change/unmount).
- Quiet the backstop instrumentation (warn -> debug) now the root cause is confirmed.

Raw Text / StreamEditor (beta companion):
- Permission-gate both text_objects endpoints behind canModify; label tool "(beta)".
- P1a: preserve TJ kerning numbers for same-length edits (redistribute into original slots),
  fall back to single-string collapse otherwise (never worse than before).
- P1b: reject edits with characters unencodable in the run's font (clear 400 instead of corruption).
- P2a: commit Raw Text edits as a new document version (add_document) and adopt the id via
  pushHistory, so they join undo/redo instead of mutating in place.
- P2b: exact hit-boxes from real font metrics (re-measured once @font-face loads).

WASM preview rebuilt with the reflow changes; cache version bumped.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:12:53 +05:30
furqan 20177b5287 Merge pull request 'furqan' (#60) from furqan into dev
Reviewed-on: https://gitea.maskantech.in/gitea_admin/pdf/pulls/60
2026-06-17 06:35:59 +00:00
Furqan-14 21f0bfab9a Merge branch 'dev' of https://gitea.maskantech.in/gitea_admin/pdf into furqan 2026-06-17 11:39:58 +05:30
furqan 4b0ea5b963 Merge pull request 'saqib' (#59) from saqib into dev
Reviewed-on: https://gitea.maskantech.in/gitea_admin/pdf/pulls/59
2026-06-17 06:09:44 +00:00
Furqan-14 8f881dfbd5 feat: implemented reflow for bullets and single lines along with the fix for save on delay 2026-06-17 11:39:01 +05:30
saqib mir 69d7346803 Merge branch 'dev' of https://gitea.maskantech.in/gitea_admin/pdf into saqib 2026-06-17 11:26:18 +05:30
saqib mir a39c15d0be content completed 2026-06-17 11:03:47 +05:30
saqib mir 20ee7fbe20 content ad the frontend 2026-06-16 19:27:32 +05:30
saqib mir 7cd400e62a content stream 2026-06-16 19:06:48 +05:30
Furqan-14 c449cf01b9 feat: updated the text reflow engine 2026-06-16 16:45:04 +05:30
furqan f6f4149159 Merge pull request 'fix: reflow for bullets' (#58) from furqan into dev
Reviewed-on: https://gitea.maskantech.in/gitea_admin/pdf/pulls/58
2026-06-16 08:43:51 +00:00
Furqan-14 d53f059952 fix: reflow for bullets 2026-06-16 14:13:14 +05:30
saqib mir 32d6f1379b Merge branch 'dev' of https://gitea.maskantech.in/gitea_admin/pdf into saqib 2026-06-16 10:58:17 +05:30
furqan a84ff13170 Merge pull request 'azeem' (#57) from azeem into dev
Reviewed-on: https://gitea.maskantech.in/gitea_admin/pdf/pulls/57
2026-06-16 05:27:46 +00:00
azeeee05 0d095cf14b Merge branch 'dev' of https://gitea.maskantech.in/gitea_admin/pdf into azeem 2026-06-16 10:57:01 +05:30
furqan 7db06c59e7 Merge pull request 'furqan' (#56) from furqan into dev
Reviewed-on: https://gitea.maskantech.in/gitea_admin/pdf/pulls/56
2026-06-16 05:26:56 +00:00
Furqan-14 852177db18 Merge branch 'dev' of https://gitea.maskantech.in/gitea_admin/pdf into furqan 2026-06-16 10:56:20 +05:30
Furqan-14 ec509400e7 feat: implemented real flow text editor for paragraphs 2026-06-16 10:56:08 +05:30
azeeee05 42b4224bb3 Merge branch 'dev' of https://gitea.maskantech.in/gitea_admin/pdf into azeem 2026-06-16 10:54:14 +05:30
azeeee05 f8fb4feaff done undo functions 2026-06-16 10:53:37 +05:30
saqib mir 3ad646fe6a Merge branch 'dev' of https://gitea.maskantech.in/gitea_admin/pdf into saqib 2026-06-12 19:17:21 +05:30
furqan 2d5bf3f464 Merge pull request 'furqan' (#55) from furqan into dev
Reviewed-on: https://gitea.maskantech.in/gitea_admin/pdf/pulls/55
2026-06-12 13:44:12 +00:00
Furqan-14 6b78a72f68 Merge branch 'dev' of https://gitea.maskantech.in/gitea_admin/pdf into furqan 2026-06-12 19:13:42 +05:30
Furqan-14 44f64a0d99 feat: implemented caret based selection at any click position 2026-06-12 19:13:29 +05:30
saqib mir 23ceda6848 Merge branch 'dev' of https://gitea.maskantech.in/gitea_admin/pdf into saqib 2026-06-12 15:39:27 +05:30
saqib mir 1ff5bcfd25 fix 2026-06-12 15:39:14 +05:30
furqan be45b2211b Merge pull request 'feat: implemented base editing, underline and striking' (#54) from furqan into dev
Reviewed-on: https://gitea.maskantech.in/gitea_admin/pdf/pulls/54
2026-06-12 09:34:50 +00:00
Furqan-14 d47895c990 feat: implemented base editing, underline and striking 2026-06-12 15:04:09 +05:30
furqan 6678f55e46 Merge pull request 'furqan' (#53) from furqan into dev
Reviewed-on: https://gitea.maskantech.in/gitea_admin/pdf/pulls/53
2026-06-12 06:25:14 +00:00
Furqan-14 f11bac7419 Merge branch 'dev' of https://gitea.maskantech.in/gitea_admin/pdf into furqan 2026-06-12 11:31:40 +05:30
Furqan-14 03cabc05a3 feat: implemented unicode and update base fonts, and sub fonts 2026-06-12 11:31:10 +05:30
furqan da2cc61496 Merge pull request 'saqib' (#52) from saqib into dev
Reviewed-on: https://gitea.maskantech.in/gitea_admin/pdf/pulls/52
2026-06-12 06:00:17 +00:00
saqib mir 74a2ba7b8d merge conflict solve 2026-06-11 19:36:38 +05:30
saqib mir 4d900c3d0c Underline + decoration renderer (DecorationBuilder) 2026-06-11 19:30:27 +05:30
furqan fa5a14273b Merge pull request 'azeem' (#51) from azeem into dev
Reviewed-on: https://gitea.maskantech.in/gitea_admin/pdf/pulls/51
2026-06-11 13:58:58 +00:00
azeeee05 18d7cd98d1 Merge branch 'dev' of https://gitea.maskantech.in/gitea_admin/pdf into azeem 2026-06-11 19:23:45 +05:30
azeeee05 948461da65 fixed issues on edit 2026-06-11 19:23:34 +05:30
furqan 6a17280972 Merge pull request 'furqan' (#50) from furqan into dev
Reviewed-on: https://gitea.maskantech.in/gitea_admin/pdf/pulls/50
2026-06-11 13:52:49 +00:00
Furqan-14 98c63f91fc Merge branch 'dev' of https://gitea.maskantech.in/gitea_admin/pdf into furqan 2026-06-11 19:22:07 +05:30
furqan 996c2510fe Merge pull request 'saqib' (#49) from saqib into dev
Reviewed-on: https://gitea.maskantech.in/gitea_admin/pdf/pulls/49
2026-06-11 13:49:38 +00:00