mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-21 09:26:43 +00:00
#9594 fixed type copied between documents of different resolutions re-laying out at the wrong size on its next edit by running the Image Size resolution step on the copies: the type kept its point size (24 pt) and got a compensating transform of src/dst ppi, with box and path text scaled up to match. The reference application, measured by script, keeps the pixels and rewrites the point size instead: 24 pt copied from a 72 ppi document into a 300 ppi one becomes 5.76 pt (24 x 72/300), and 24 pt from 300 ppi into 72 ppi becomes 100 pt. There is no transform, the Character panel shows the rewritten size, and later edits keep it. adapt_copies, which both Copy Layers to Document (Duplicate Layer to another document, dragging layers between documents) and Paste of a copied layer go through, now calls canvas_geom::retarget_type_resolution: every size in points is multiplied by src/dst ppi (font size, leading, baseline shift, first-line/start/end indents, space before/after) and the PSD TySh is rebuilt. Box, path and transform are in pixels and stay as they were; tracking, kerning and auto leading are relative to the size and stay too. A resolution that isn't a positive number counts as 72 ppi (what the text engine lays it out at), and the scaled sizes stay finite and above zero. Image Size keeps its own behaviour. Tests: copy and Paste in Place, 72->300 (5.76 pt) and 300->72 (100 pt): leading, baseline shift and indent scale, tracking stays, no transform, the same ink bounds as the source, and after an edit the size is kept and bounds and coverage match the source's render. Paragraph text keeps its box and wrapping. Bad and absurd resolutions don't panic or produce non-finite sizes. The #9594 test is replaced by these. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>