mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-28 18:22:06 +01:00
* PSD type layers without pixels are rendered on import; PostScript font names resolve to the installed family (#1405) ag-psd, GIMP and other writers leave a PSD type layer without image data and let Photoshop re-render it on open. The importer made those empty pixels the layer's cache, so the canvas showed nothing until the layer was edited, and the family guessed from the PostScript name ("CC Wild Words" for CCWildWords-Regular) never got corrected to the installed family ("CCWildWords"), so Missing Fonts replaced an installed font. - crates/io/src/psd_import.rs: a type layer's record pixels are the cache only when there are some. - crates/io/src/text_import.rs (new, run by import): resolves each run's PostScript name with FontDb::resolve_postscript, as the layout does, and writes the installed family, weight and italic back into the run; renders every type layer that has no cache from its model. - crates/io/tests/psd_type_bounds.rs: a type layer exported without pixels imports rendered, on the engine's own pixels; "JetBrainsMono-Regular" (guess "Jet Brains Mono") imports as the family "JetBrains Mono". Fixes #1405 * PSD import: cap the automatic type render for untrusted sizes text_import::prepare now renders a type layer without pixels only when its ink fits MAX_RENDER_PIXELS (64 Mpx); the renderer's own guard is 256 Mpx, which for an absurd type size or scale in a hostile PSD meant several GB of f32 accumulation buffers on open. Over the cap the layer keeps empty pixels until edited, as before. Test: hostile_type_sizes_without_pixels_import_without_a_huge_render (an ink between the two caps, plus 1e30 pt, a 1e12 scale and f64::MAX). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * rustfmt (module order, the hostile-size test) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * PSD import: keep empty type pixels when the engine text is blank cargo xtask test-corpus: rendering every pixel-less type layer regressed the Photoshop oracle text/path-wave-open.psd (133 -> 132, below the floor). Photoshop wrote that layer with no pixels because its EngineData text is blank (the characters sit only in the descriptor's Txt ): it draws nothing, and the import must not draw it either. New photocraft_text::psd:: engine_text_is_blank; the oracle passes again (133). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Brandon Thomas <echelon@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>