Resolves the conflicts with main's area type (TextShape::Area): EngineData keeps main's area arm beside the path comment, and a Txt2 frame of an area layer becomes a text box over the path's bounds, as its EngineData describes it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main now has its own Recent Fonts (#3559), so this branch drops its separate
recent list (prefs `recentFontList`, `type.font.noteRecent`, `type.font.clearRecent`,
the five-font cap) and its font menu uses main's: the list is
`PhotocraftApp::note_recent_font`'s, the rows and arrow keys main's `font_menu_rows`,
and every applied family is recorded, as main does. Favourites, the class and
similar/variable filters, the style expander, format badges and the live preview
stay. Faux Bold keeps the one-pass thickened outline on main's fallible coverage
buffers (#6001), budgeted as a plain pass. Both sides' strings and icon credits are kept;
the scorecard is regenerated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main merged #5940, #6472, #7838 and #7922 directly. Kept from the batch:
the snapshot/History-follow identity at the history limit (#5940,
c7ef3676a; main still had the 3-tuple HistorySpot) and the strokeless
shape at a 0 px width step (#6472, 962539607; main still added the
stroke). Main already carries the other two fix-ups (34c9d0ea4, dff8bfd0e).
Overlaps with main resolved:
- #5842 vs main's #5568: one path, apply_color, tool-gated as #5842
has it, with #5568's float fill, kept fill opacity and lock skip;
shape_fill_ui's duplicate foreground_changed/gesture dropped; #5568's
tests run with a shape tool.
- #6230 vs main's #5180: one Type tool path click (path_target), no
second type.attachToPath; vertical type does not start type on a path,
as main has it; main's path_at/path_cursor and canvas arm dropped.
- #5452 moved the shape swatch to shape_paint_ui.rs: main's hex field
(#6201) ported there.
- type_extra_cmds::with_text takes main's dpi form, pub(crate) for
type_area_cmds.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
psd_import.rs: main moved the TySh import behind a canonical byte-order
check (#4771); the Txt2 path read and its warning now sit in that block.
gaps.md, scorecard/type.toml: keep both the Type tool path click and
paragraph direction from main and the PSD path round trip from #7962;
docs/scorecard.md regenerated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Photoshop keeps a path-text layer's path only in its Txt2 frame (EngineData
calls it a text box the size of the path's bounds), so it opened as
paragraph text. The frame (kind /2 /0 = 2) holds the path as a flat list of
cubic segments at /1 /0, mapped to the TySh text space by /2 /2.
apply_txt2_path reads it into TextShape::Path (a closed path starting at its
last anchor, as Photoshop sets it); malformed or hostile frames keep the
box/point shape with an import warning.
build_txt2 writes a path layer's path into its object's frame (Photoshop's
own frame left byte for byte when the path is unchanged; flip and a moved
start written into the path), and a layer taken off its path loses its path
frame. A new document still saves path text as point text.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts: upstream's horizontal-scale line breaking (#5565) touched the
same break and alignment code as area type. Box text keeps breaking at
the scaled width; area rows break at their span widths as before, with
the scale fixed at 1, since area spans are already in layout space.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V5GRiHVR8XvTrbL1j8y9jW
build.rs embeds every font in craft-fonts' fonts/manifest.txt, but
FontDb::new registered only the entries whose scripts include Jpan.
craft-fonts 8dcdacd5 adds Noto Sans CJK SC and Noto Sans Arabic, and
3d9ab3a1 adds Noto Sans Thai. Built with either checkout, the binary
carried those fonts, but the font list did not show them, text layers
did not fall back to them, and works_without_craft_fonts failed with
"Noto Sans CJK SC registered under its manifest name". Chinese and
Arabic set in Inter in a TextEngine::new() engine drew .notdef glyphs.
FontDb::new now registers every CRAFT_FONTS entry. A single-face file
registers under its manifest family, whatever family its name table
gives; each face of a collection keeps the family its name table gives.
With Noto Sans CJK SC built in and no Simplified Chinese system font,
Japanese text set in Inter takes Noto Sans CJK SC when the UI locale is
not Japanese, following cjk::script_order.
craft_fonts_cover_japanese_without_system_fonts now expects the first
CJK craft family in that order.
New tests register in-memory craft entries made from Inter (Hans, Arab
and Jpan entries, two whose name tables give another family, and a
collection), and lay out Chinese, Arabic and Thai in Inter when the
build has a craft font for the script.
Faux bold drew each glyph at eight offsets (3.6% of the size) and merged them.
At large sizes the copies didn't join on corners and stroke ends: stair-step
notches (46 px offsets at 1278 pt). The glyph outline is now thickened before
drawing, each point moved outward along its corner's bisector and capped by its
shorter edge (as FreeType's FT_Outline_EmboldenXY), so curves stay curves and
corners stay square at any size, with the same weight. Faux italic and scaling
still apply after. Each bold glyph is drawn once instead of eight times.
New tests: a 600 pt bold "l" keeps square corners (the old stamping cut them
away), a bold "O" curves as smoothly as the regular one, and unit tests for the
thickening (windings, counters, curves, degenerate outlines, sharp corners).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The font menu gains Photoshop's local font library and filters (everything but
Adobe Fonts):
- Favourites: a star on every row (never picks the font) and a favourites-only
filter. Kept in the preferences (type.favoriteFonts).
- Recent fonts: up to five, most recent first, above a divider. Wires the dead
Preferences > Type > Recent Fonts (now 0..5, default 5; older saved values
are capped on load).
- Class list: All Classes, Serif, Slab Serif, Sans Serif, Script, Monospace,
Handwritten, Blackletter, Decorative, read from each font's OS/2
sFamilyClass, PANOSE and post tables (photocraft_text::font_class), else its
name. Fonts that state nothing stay unclassified.
- Show Variable Fonts, Show Similar Fonts (PANOSE/class/weight distance to the
current font) and Clear All; the class list collapses with «.
- Each row: style expander (">") that picks a family in a given style, and an
O / TT / VAR format badge.
- A preview at the top sets the type layer's own text (or the selection being
typed) in the font under the pointer.
- The search field and filters stay fixed while only the list scrolls, and the
search field lines up with the font list.
Commands: type.font.favorite, type.font.noteRecent, type.font.clearRecent,
type.font.library. Two original icons (font-similar, font-variable).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Session::apply_prefs set the shared text engine's missing-glyph
protection through photocraft_text::shared(), which blocks until the
system font scan that launch starts in the background is done. It runs
on the UI thread at launch and on every preferences change, so the first
frame waited for the rest of the scan: 248–257 ms on this machine
(release, launch order replayed), more with many fonts installed.
set_shared_missing_glyph_protection applies it at once when the engine
is built, and otherwise from one helper thread once the scan finishes.
Both read the newest setting under the engine's lock, so a late change
is never overwritten by an older one. Measured the same way: 0.1 ms.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
* Type: type on a path, glyphs follow the curve (#4365)
Add TextShape::Path (path, start offset, flip). The text is laid out as one
point-text line and each glyph is placed rigidly on the flattened path by arc
length, turned to the tangent at its centre; glyphs past the end are hidden and
a degenerate path falls back to straight text. New commands type.attachToPath
(work path or shape layer subpath) and type.detachFromPath. TextShape is no
longer Copy. .pcraft round-trips the new variant.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Automation policy: type.attachToPath/detachFromPath take document vector paths, not host files (#4365)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs: regenerate scorecard after merging main
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
The font menu's preview samples, family list and localized names were
cached on fonts::generation(), which any FontDb moves, and the previews
also on the served catalog's generation. Other engines registering fonts
(tests running in parallel) re-rendered every visible sample each pass,
and families covering Arabic asked for a repaint, so Harness::run never
settled: options_font_family_preserves_peer_faces_and_batches_layer_flags
and the font picker tests failed intermittently with "exceeded max_steps".
- photocraft-text: fonts::shared_generation(), moved only by the shared
engine's FontDb (FontDb::mark_shared from new_shared).
- ui-egui: families(), localized_families() and the preview cache key on
it; previews no longer key on the served catalog (a served family's
sample appears when its fonts register, which moves the generation).
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* Type: scan system fonts off the UI thread (#3021)
The first `photocraft_text::shared()` call scans every installed font, and
nothing made that call before the Type tool's options bar drew its font
menu, so the scan ran inside a UI frame (over 60 s on some Macs, #2518).
- photocraft-text: `warm_shared()` starts the scan on a background thread;
`try_shared()` returns the engine without blocking (None while the scan
runs, started there if nobody warmed it; built in place on the web, in
tests, if the thread can't start or the worker died). `shared()` keeps
its blocking behaviour for engine commands.
- The desktop app warms the fonts at start-up.
- Font menus that draw every frame (options bar, Character, Glyphs and the
Character/Paragraph Styles family menus) show a disabled "Loading fonts…"
box and repaint until the scan is done. "Loading fonts…" is in all 16
catalogs.
Complements #2644 (CoreText discovery on macOS): this changes where the
scan runs, not how fonts are discovered.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Type: axis sliders wait for the background font scan too
#2996 (landed on main) added axis_sliders, which called the blocking
photocraft_text::shared() every frame; use try_shared() so the Character
section doesn't stall while the scan runs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
Layer names (and any other UI text) in scripts the bundled Inter lacks
showed missing-glyph boxes even when the canvas found a fallback font.
The lazy UI loader only knew CJK plus a short hard-coded list of Thai
font paths, so any other script, or a Thai font at another path, never
got a fallback.
photocraft_text::scripts classifies 20 scripts and picks candidate files
by name (Noto, Windows, macOS and common Linux families) from a listing
of the platform font directories, made once per process on first need.
The UI loader tries a script once when one of its characters is missing,
reads at most a few candidates, and registers the first face whose cmap
really maps the character. Latin text loads nothing; the web build has
no candidates and does nothing.
Co-authored-by: Fabio Lussi <198260595+itrycodinganditsbad@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
A host lists fonts in fonts/manifest.txt beside index.html (craft-fonts' manifest format, paths
kept inside the site); the web shell lists those families in the font menus and fetches a family
when it is picked or a layout needs it, then re-renders the affected type layers without a history
step. No manifest changes nothing; package.sh copies one in with PHOTOCRAFT_WEB_FONTS_DIR. The
style menu also lists the weights of a variable font's wght axis.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Type: hitTest, caret and navigate commands so agents can edit text by position (part of #219)
Stateless queries in document pixels. The word, line and hit-test helpers move from type_tool.rs into photocraft-text, and the Type tool calls the same code.
* Regenerate docs/scorecard.md after rebase
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
- Real crash: build_engine_data took its template from the PSD's text
engine data and did expect("EngineDict"), so a text layer whose engine
data lacked EngineDict (or wasn't a dictionary) crashed PSD export.
The template is now repaired; regression test
engine_data_template_without_engine_dict.
- color: the built-in CMYK<->sRGB transforms fall back to the naive
formulas instead of expect if they ever fail to link.
- doc: insert_above falls back to the top of the root instead of
expect("valid path"); next_layer_name searches a bounded range.
- paint: Mips::new loops with while-let instead of last().expect.
- All eight crates deny unwrap/expect/panic/unimplemented/todo/unreachable.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
CI's `cargo fmt --all -- --check` has failed on every run because the
repo had no rustfmt config and was never formatted. Use the same settings
as EffectCraft/FilmCraft (max_width 160, use_small_heuristics Max), which
also keeps the churn small. Formatting only; no code changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>