Port behavior and regression coverage into current modules; preserve current upstream behavior.
Use shared zoom-corrected brush resize and HUD while preserving immediate press ownership and anchored outline when hover is absent. Keep original resize regressions. Fix duplicate identical Dissolve test registration and missing test-only UnicodeString import reported by 94-head check.
Port behavior and regression coverage into current modules; preserve current upstream behavior.
Apply stricter finite 1e9 geometry bound to current parse/import safety paths; prevent corrected legacy origin bypass and retain current full PSD unsafe-import warning/raster fallback regression. Keep split import/build modules and port new overflow tests into import module.
Port behavior and regression coverage into current modules; preserve current upstream behavior.
Extended current crop menu with Reset and shield toggles, preserving newer preset management, overlays, ownership checks and no-menu-during-gesture logic. Ported reset-frame no-op/undo semantics into current CropState/release and crop commit; retained original regression cases in split modules.
Port behavior and regression coverage into current modules; preserve current upstream behavior.
Ported hanging punctuation into current line placement and kerning modules, preserving forced breaks, bounded edge-tip row merging, justified-last-line behavior, area exclusions and independent Roman orientation shaping; kept PSD/engine/UI regression coverage.
Port behavior and regression coverage into current modules; preserve current upstream behavior.
Ported upright Roman classification, independent unkerned/unligated em advances and tab reflow into current Para/VerticalPiece shaping modules; preserved area and paragraph flow; retained vertical geometry and PSD BaselineDirection regressions.
Served script fallbacks were appended to every UI font family in the
order they arrived. A Japanese and a Simplified Chinese face both cover
Han, and egui draws a character with the first face in the stack that has
it, so a Chinese interface drew Han with the Japanese face when that one
had arrived first (fetched for a Japanese text layer, say). ui_faces now
puts the interface language's own served face first, so the stack a
language change rebuilds follows the language; and when that face arrives
after another served face, add_ui_face rebuilds the stack the same way
instead of appending. served::fallback_for_language gives the face.
This orders the served faces only; with an interface language that has
no served face (English), they stay in arrival order.
Review finding on #10006.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Character section: a style picked under a family's ">" with type layers
selected set the layers but not the style for new type (the options bar
did both). Pick "Inter > Thin" in Properties > Character: new type stayed
Regular.
- Faux bold: a pointed tip moved r/sin(half its angle) along its bisector,
uncapped (3.9 r at 30 degrees, an A apex grew a spike), and tips sharper
than about 20 degrees did not move at all. Every tip now moves at most
2r, continuously; inner corners (the crotch of a V) keep their exact
miter.
- Faux bold: each point searched past runs of coincident points for its
neighbours, O(n^2); a contour of 50 000 copies of one point took ~8 s per
glyph. Neighbours now come from one O(n) pass over the runs.
- prefs.reset {"path":"type"} and Preferences > Type > Reset Section wiped
the favourite fonts; they are kept now (type.favoriteFonts by name, or
Reset All, still clear them).
- An expanded family whose own row scrolled out of view lost its style
rows, so the list below jumped up.
- Show Similar Fonts re-sorted around each font an arrow step applied, so
Down went back and forth between two fonts; the list now compares with
the font current when the filter was turned on (or the menu opened).
- Docs: an uninstalled favourite is kept but not listed; FAUX_BOLD_RADIUS
and the raster budget describe the thickened outline; the unused
"Recent font list" rows are gone; docs/scorecard.md regenerated (the
favourite fonts are one more setting).
Co-authored-by: D-monized <341904702+D-monized@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FredApps' re-review: hanging_marks_of_a_split_run_keep_their_breaks was
pinned by the chain guard, not by the at-most-two-cluster cap — reverting
the cap alone surprised every hanging test. a_full_mark_row_does_not_
step_back_onto_a_short_line pins the cap: 'word ' followed by thirty
hyphens in a 200 px box keeps three rows and the same geometry as
hanging off; with the cap reverted the full mark row steps back and the
line overflows the box by a row's worth of marks (test fails). The
split-run test's comment now matches its 34 dots.
CodeRabbit on #9478 (outside-diff comment, layout.rs 763-782): standard,
contextual and discretionary ligatures stayed on in upright roman runs,
so a font's "fi" became one glyph and broke one letter per em. They are
off there now, as kerning already was.
Test: upright_roman_letters_stay_apart_without_ligatures (uses an installed
font with an fi ligature; skips where none is found)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CodeRabbit on #9478: the upright default for roman text also caught
half-width katakana and Hangul, which vertical_class rotates like other
half-width text; this PR leaves CJK as it was. Only roman characters now
stand upright and take one em. tab_widths gets its doc comment back.
Test: half_width_cjk_stays_rotated_beside_upright_roman
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
davidmann4's round-3 review of #8347: a marks row the box had to split
out of a run folded row after row into one line running past the edge by
almost the whole run, and a row merged into a justified paragraph's last
line kept the row above's spread instead of the last-line align.
- A marks-only row steps back only while it is at most two clusters (the
tip that hangs at the edge); a row above that already ends in a
hangable mark takes no more.
- A justified paragraph's last row keeps its own align (centered, right
or left): the placed clusters already carry the spread, and the merge
only moves x1/range.end.
- hanging_marks_of_a_split_run_keep_their_breaks pins that a run keeps
its rows and no line outgrows the box by more than two marks;
hanging_marks_stay_off_a_justified_paragraphs_last_line pins the
JustifyCenter/Right/All last lines. The old merged-row test now pins
the tip (a_stepped_mark_row_keeps_its_clusters_and_glyphs_in_step).
Vertical type laid Latin letters and digits on their side (the word
turned 90°), and called that Photoshop's default. Photoshop's Vertical
Type tool stacks them upright, one character per em down the column:
the run's BaselineDirection is 1 (withStream); 2 (rotated) turns them.
- doc: CharStyle::rotate_roman (false = upright, the default).
- text/psd: BaselineDirection is read (a run without one takes the
style sheet's, which Photoshop writes as 2) and written back.
- text/layout: in vertical type, roman characters take the upright
path unless their run rotates them. Each is given one em down the
column (a second shaping pass sets its letter spacing from the shaped
advance), with pair kerning off between the stacked letters.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two layers could update the same Txt2 frame, the last one winning. An
edited layer whose object can't be refitted (a run array whose length
is no count) was rebuilt from a template naming frame <slot number>,
which can be the frame another object draws in; and a new layer whose
slot number is a path layer's frame number named that frame too. A
point layer then turned the path layer's frame into a point frame, and
the path text reopened as plain text.
A rebuilt object now keeps the frame its old object was drawn in (when
the frame list has it), and a new or rebuilt object whose slot number
is another object's frame gets a free frame past the list (padded like
the others). A frame the file already had two objects drawn in is left
as the file has it. Tests (each fails without its part):
an_object_rebuilt_from_a_template_keeps_its_own_frame,
a_new_object_gets_a_frame_no_other_object_is_drawn_in,
a_rebuilt_object_never_names_a_missing_frame,
a_frame_two_objects_name_is_kept,
a_kept_object_naming_a_far_frame_adds_no_frames (the list only grows
for frames handed out here); an_area_layer_gets_a_box_frame
covers the merge with main's area type.
Answers CodeRabbit's review thread at crates/text/src/psd.rs:1242.
Co-authored-by: Michael Higgins <55243596+Higgs32584@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
- The hung center/right arms add kern_align back: their slack already
deducts the line's kerning (each mark's trim carries the kern that
moved it), so base's shift applied the kerning twice and parked hung
lines left of centre on lines with manual/tab/optical kerning
(hanging_centers_a_kerned_line_exactly).
- The justify-all slack is the drawn width once: extra already carries
the horizontal-scale growth, so scaling adv counted it twice and left
a 150% last line short of the box edge
(justify_all_spreads_to_the_edge_exactly).
- Photoshop's documented hang list carries weights: period, comma, quote,
apostrophe and hyphen hang 100%, colon, semicolon, ellipsis and dash hang
50%; ! and ? are not in the list (davidmann4). The drawn positions never
change: the weights only come out of the composed width.
- A marks-only row after a forced break keeps its row: the merge-back must
not cross the author's break (CodeRabbit).
- The merge-back reads its pair style from the mapped byte; the box slack
and the justify-all path take the shaped advance scaled once and the
(already scaled) trim on top, so horizontal scale no longer scales the
trim twice; area type keeps its planned rows (hanging applies to point
and box lines only).
- The Styles editor row label goes through tl!, the dock comment loses its
(#...), space-before keeps upstream's arrow order, tests get abs() and
exact centering assertions; hi.tsv carries the label.
* fix(text): lay out a variable font's named instance from its PostScript name
A PSD type style set in a named instance of a variable font, such as
Bahnschrift Light Condensed, keeps the instance only as its PostScript
name ("Bahnschrift-LightCondensed"); its variations are empty. When
PhotoCraft re-laid the layer out, FontDb::select_named_face looked for a
face with that PostScript name, or one whose style and weight matched. A
variable family is a single face, so neither matched, and the text was
laid out at the font's default instance: about 35% wider than the
instance Photoshop drew with Bahnschrift.
select_named_face now falls back to the family's variable faces when the
PostScript name matches no face. It reads each face's fvar named
instances and compares the name with the instance's own PostScript name,
or, when the instance has none, with the name Adobe Technical Note #5902
derives (variations prefix or family name, a hyphen, then the subfamily
without spaces). Names compare without punctuation or case. On a match,
that face is selected and the instance's axis values are added to the
style's variations, keeping any axis the style already sets. Static
faces still match exactly as before, and PSD import is unchanged.
Tests:
- font_names_tests::postscript_name_of_a_named_instance_selects_its_axis_values
rebuilds the bundled Inter at test time as a variable font (fvar with
wght/wdth axes and two named instances, one with its own PostScript
name and one derived) and checks the axis values each name selects, an
unknown name, and a style's own axis value. It needs no installed font
and no font file in the repository.
- font_names_tests::exact_static_face_gets_no_instance_axes checks that
an exact static match gets no axis values.
- tests::postscript_name_of_a_variable_instance_lays_out_at_that_instance
lays out "Hamburgefonstiv 0123" with Bahnschrift (Windows) or Ubuntu
Sans (Ubuntu) when installed and checks that the instance's PostScript
name gives the same width as its axis values. With Ubuntu Sans before
the fix: UbuntuSans-CondensedLight 980.3 px (= the default instance),
its axes 766.4 px; after the fix both are 766.4 px.
A style with only a weight (no PostScript name) is still not turned into
a wght axis value on a variable font; the issue reports that too, but its
fix and test are about the PostScript name, so that is left for a
separate change.
Fixes#8797
* fix(text): try a variable font's named instance before the style fallback
Review pointed out that select_named_face ran the style-and-weight
fallback before the named-instance lookup. A style that carries a named
instance's PostScript name and also a populated font_style matching the
variable face itself ("Regular", 400) selected that face at its default
instance, and the instance's axis values were never added.
Faces are now tried in order: exact PostScript name, named instance,
then style, weight and italic.
Review also noted that the layout-width test only runs when Bahnschrift
or Ubuntu Sans is installed. The synthesized variable font in
font_names_tests now carries an HVAR table that narrows every advance on
wdth, so layout width shows which instance was used. Two tests run
everywhere:
- named_instance_wins_over_a_matching_font_style
- postscript_name_of_a_named_instance_lays_out_at_that_instance
Both fail before this change. The installed-font test is kept as a check
against a real font.
---------
Co-authored-by: John Turnbach <jturnbach@users.noreply.github.com>
The rasteriser made one coverage pass per distinct colour over the whole
text's ink rect (nine with faux bold), so text with many coloured runs
cost colours x area: 400 colours of faux-bold 48 pt text took 13.0 s.
Each colour's pass now covers only that colour's glyph bounds (all bold
offsets and decorations included) and composites into that part of the
accumulator: 163 ms for the same text. A test compares the visible
(premultiplied) pixels with full-size passes for plain, faux bold,
underlined, rotated and warped text in RGB and CMYK.
Part of #8602
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(text): bound font paths and imported text processing
Reject encoded path tricks and cap resource-heavy font and PSD text processing to keep untrusted inputs bounded.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
* fix(text): reject percent-encoded DEL in served paths; satisfy clippy chunks_exact lint
---------
Co-authored-by: Codebuff <noreply@codebuff.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>
refine_legacy_point_origin moved the layout's logical box (line x0,
baseline - ascent) onto the TySh boundingBox, but Photoshop writes
boundingBox as the tight ink box (Arial 120 pt "..." has bounds top
-102.98, boundingBox top -11). Legacy point text whose ink starts below
the ascent line ("...", "_", lowercase) opened up to ~116 pt too low.
Match like with like: use the layout's unrounded text-space ink bounds
(new render::ink_bounds). The PR's tests built boundingBox from the
logical box, so they now write bounds = layout box and boundingBox =
ink box and pin the exact anchor; legacy_origin_lines_up_ink_with_the_
ink_bounding_box covers "Name", "..." and "_" and fails without this.
Co-authored-by: bogusyogi <102761952+bogusyogi@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <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>
update_frame leaves a path frame the import couldn't read unchanged
when the layer is box or point text (the CodeRabbit finding fixed in
6d92b1269), but no test covered it: reverting the guard to
`_ if kind != PATH_FRAME => {}` kept every test green while a save
replaced such a frame with a box or point frame.
Co-authored-by: Michael Higgins <55243596+Higgs32584@users.noreply.github.com>
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>
Conflicts, both sides kept: main's .act swatches next to the batch's .asl
styles (Open filters, preset extensions), main's Render smart filters next
to the batch's Distort ones (53 mapped), parity doc status lines.
docs/scorecard.md regenerated.
Follow-ups the merge needed: the Distort smart filter readers pass their
enum type to main's stricter enum_name (the type their writers use), and
the CMYK effect tests set main's new StrokeFx overprint and Bevel
gloss_anti_alias.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>