Files
pdfcraft/crates/edit
86db88e630 Fix #9016: draw added Greek and Cyrillic text with the bundled Inter face (#9078)
* Fix #9016: draw added Greek and Cyrillic text with the bundled Inter face

The Add-text path only accepted WinAnsi-encodable text (plus Arabic/Hebrew/
Thai via their shaped faces), so Greek and Cyrillic were refused even though
the bundled Inter face draws them. first_undrawable now uses undrawable_char
(a char is undrawable only if WinAnsi lacks it AND the Inter face can't
draw it), and draw now sets the embedded Inter face for such text, mirroring
doc_create and text_edit.

Co-authored-by: Copilot <[email protected]>

* Fix mixed-script added text and the Greek drawing test

Address the CodeRabbit review findings on the #9016 fix:

- draw_laid_shaped: a run the shaped layout leaves as a Piece::Latin
  but that WinAnsi cannot encode (Greek or Cyrillic) is now drawn with
  the bundled Inter face, embedded, instead of being silently lost to
  WinAnsi '?'. The face is added only when a run needs it, so pure
  Hebrew (or Arabic/Thai) text is unchanged.
- tests: the Greek drawing test now selects the added item's content
  stream by its /PCMark /Added tag (the page's own "Hi" stream also has
  a Tj, so the first Tj stream was the wrong one) and verifies the
  embedded face (Type0, FontFile, ToUnicode to Greek). A new test covers
  mixed Hebrew + Greek text, asserting the Greek run uses the embedded
  face and the Hebrew run the shaped face.

Co-authored-by: Copilot <[email protected]>

* fix(edit): a second Greek item no longer takes the first item's font name (#9016)

draw_inter_face and the mixed-script path embedded the bundled face into a
dict that held none of the page's fonts, so the resource was always PCFull0
and `write` set it over any other PCFull0 the page already had. Seed the dict
with the page's PCFull* entries first, so embedding picks a free name or reuses
an identical face. The mixed-script Latin branch now draws a soft hyphen as a
hyphen, as draw_inter_face does.

Review: https://github.com/storytold/pdfcraft/pull/9078#pullrequestreview-6187655188

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* test(ui): Greek added text is drawable with the default font (#9016)

Two UI tests still asserted that a standard font refuses Greek phi, which this
change makes drawable through the bundled Inter face. Assert the new behaviour;
an explicit document font keeps working and keeps its resource. Matches the
updates the 0.23.2 release branch made to the same tests.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: FredApps <[email protected]>
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
2026-12-04 16:12:30 +01:00
..