mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-23 02:44:24 +01:00
Retype: a glyph in an even-odd compound matches with only some of its contours reversed
An even-odd compound paints the same whichever way each contour runs, so an o's counter may run the same way as its outer contour. Such a part matched neither as it is nor with all its contours reversed, and stayed an outline at tolerance 0. A part of a split compound is now also read with each contour turned the way its depth gives (outer contours one way, their counters the other), both ways round. In a nonzero compound those contours paint the counter, and the painted-area check still keeps the part an outline. The containment test that splits a compound into glyphs moves into its own function, `containers`, which the new reading also calls. Docs: docs/mcp.md, docs/type-parity.md.
This commit is contained in:
1 parent
9fff48d88f
commit
c8d02b0dbd
5 files changed
+207
-39
No files matched your search
@@ -48,7 +48,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Retype",
|
||||
["Type"],
|
||||
None,
|
||||
"{fonts?: [family…], tolerance?: 0..0.05 (default 0: exact matches only)} turn the selected outlined text (glyph paths and compound paths, inside groups too) back into live type: each shape is matched against the glyphs of the fonts the app has loaded, the document's fonts and the families in fonts, the same up to uniform scale, rotation and translation; with a tolerance above 0, a shape that is no glyph exactly may nearly be one (an outline simplified, a curve split in two, contours in another order, start or direction) when its leftover distance from the glyph, relative to the shape's outline spread (the root mean square distance of its sampled outline points from their center), is at most the tolerance (VectorCraft's own measure; shapes of at most 8 contours); a compound path holding several glyphs (a word outlined as one path, at most 256 contour groups, 512 contours and 65,536 path elements, and 16,384 contours per command) is split into them, and becomes type only when every one of them matches; matched glyphs become point text in that font and size at the same baseline, one object per line unless lines stack into one (below), with the first glyph's fill, stroke, opacity and blend mode, in one undo step; a line of three or more exactly matched glyphs takes the spacing most of its gaps share as its tracking (pair kerning left out) when tracked type draws all of it in place, or more of it than untracked type (when untracked type also draws it, untracked type is kept if the tracking is under one unit or the tracked type would drop a gap one space wide (a b c keeps its spaces), and the tracked type otherwise), and negative tracking only when the line is opaque, Normal, with a solid fill or none and no stroke (its glyphs may overlap); lines that follow each other in paint order with the same group, paint, font, size, turn and tracking (an untracked line of one or two glyphs takes the others' tracking), each one the same leading (0.25 to 3 times the size) below the one before, and lined up at their starts, ends or centers become one area type object with that leading (Auto when Auto gives it) and left, right or center alignment, or one multi-line point type object when area type (after Text Wrap) would not draw the outlines' glyphs in their places or when checking the Text Wrap objects on the changed layers would copy more than 2,000,000 anchors, subpaths and shapes; where even that type would move a glyph, the lines before that glyph's line stay one object and the rest are joined again from that line; lines with an opacity below 100%, a blend mode other than Normal, a gradient or pattern fill or a stroke stay one object each; a line splits where its type would not draw the outlines' glyphs in their places (uneven spacing, manual kerning, font substitutions; with a tolerance, within it), and before a near-matched glyph the line's size and turn would draw further from its shape than the tolerance; a glyph must also paint the area the shape paints under its fill rule (a nonzero compound whose inner contour runs the same way as its outer one paints its center, so a ring glyph does not replace it; a counter narrower than three times the outline tolerance across in some direction, an outline too large to check, or parts of a split compound that overlap where its fill rule leaves the overlap unpainted, or that overlap at all when the compound has an opacity below 100%, a blend mode other than Normal, a gradient or pattern fill or a stroke, also keep the shape an outline); shapes that match no font, glyphs type cannot draw as they are, and shapes with their own opacity mask stay as they are → {ids (the new type), texts (lines joined by \\n), fonts: [{family, style, size, tracking (1/1000 em), leading (pt, null for Auto or one line), area (bool), score (how closely the line's least close glyph fits, 1 for exact, 0 at a leftover distance of 0.05)}], unmatched: [id…] (shapes that stayed as they are when another shape became type), truncated (shapes past the limits of 2048 shapes or 16 nested groups were left out)}; an error, with no unmatched list, when no shape becomes type, or when tolerance is not a number from 0 to 0.05",
|
||||
"{fonts?: [family…], tolerance?: 0..0.05 (default 0: exact matches only)} turn the selected outlined text (glyph paths and compound paths, inside groups too) back into live type: each shape is matched against the glyphs of the fonts the app has loaded, the document's fonts and the families in fonts, the same up to uniform scale, rotation and translation; with a tolerance above 0, a shape that is no glyph exactly may nearly be one (an outline simplified, a curve split in two, contours in another order, start or direction) when its leftover distance from the glyph, relative to the shape's outline spread (the root mean square distance of its sampled outline points from their center), is at most the tolerance (VectorCraft's own measure; shapes of at most 8 contours); a compound path holding several glyphs (a word outlined as one path, at most 256 contour groups, 512 contours and 65,536 path elements, and 16,384 contours per command) is split into them (a part matching exactly also with its contours the other way round, or with only some of them so, as an o's counter alone in an even-odd compound), and becomes type only when every one of them matches; matched glyphs become point text in that font and size at the same baseline, one object per line unless lines stack into one (below), with the first glyph's fill, stroke, opacity and blend mode, in one undo step; a line of three or more exactly matched glyphs takes the spacing most of its gaps share as its tracking (pair kerning left out) when tracked type draws all of it in place, or more of it than untracked type (when untracked type also draws it, untracked type is kept if the tracking is under one unit or the tracked type would drop a gap one space wide (a b c keeps its spaces), and the tracked type otherwise), and negative tracking only when the line is opaque, Normal, with a solid fill or none and no stroke (its glyphs may overlap); lines that follow each other in paint order with the same group, paint, font, size, turn and tracking (an untracked line of one or two glyphs takes the others' tracking), each one the same leading (0.25 to 3 times the size) below the one before, and lined up at their starts, ends or centers become one area type object with that leading (Auto when Auto gives it) and left, right or center alignment, or one multi-line point type object when area type (after Text Wrap) would not draw the outlines' glyphs in their places or when checking the Text Wrap objects on the changed layers would copy more than 2,000,000 anchors, subpaths and shapes; where even that type would move a glyph, the lines before that glyph's line stay one object and the rest are joined again from that line; lines with an opacity below 100%, a blend mode other than Normal, a gradient or pattern fill or a stroke stay one object each; a line splits where its type would not draw the outlines' glyphs in their places (uneven spacing, manual kerning, font substitutions; with a tolerance, within it), and before a near-matched glyph the line's size and turn would draw further from its shape than the tolerance; a glyph must also paint the area the shape paints under its fill rule (a nonzero compound whose inner contour runs the same way as its outer one paints its center, so a ring glyph does not replace it; a counter narrower than three times the outline tolerance across in some direction, an outline too large to check, or parts of a split compound that overlap where its fill rule leaves the overlap unpainted, or that overlap at all when the compound has an opacity below 100%, a blend mode other than Normal, a gradient or pattern fill or a stroke, also keep the shape an outline); shapes that match no font, glyphs type cannot draw as they are, and shapes with their own opacity mask stay as they are → {ids (the new type), texts (lines joined by \\n), fonts: [{family, style, size, tracking (1/1000 em), leading (pt, null for Auto or one line), area (bool), score (how closely the line's least close glyph fits, 1 for exact, 0 at a leftover distance of 0.05)}], unmatched: [id…] (shapes that stayed as they are when another shape became type), truncated (shapes past the limits of 2048 shapes or 16 nested groups were left out)}; an error, with no unmatched list, when no shape becomes type, or when tolerance is not a number from 0 to 0.05",
|
||||
has_selected_path,
|
||||
retype
|
||||
)]
|
||||
|
||||
@@ -1385,6 +1385,34 @@ fn glyphs_side_by_side_in_an_even_odd_compound_still_become_type() {
|
||||
assert_eq!(r["texts"], json!(["oo"]), "{r}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_glyph_with_only_some_contours_turned_in_an_even_odd_compound_still_becomes_type() {
|
||||
// An even-odd compound paints the same whichever way its contours run, so an o's counter may
|
||||
// run the same way as its outer contour: neither the part as it is nor all its contours turned
|
||||
// is the glyph. Filled by the nonzero rule, the same contours paint the o's counter, and the
|
||||
// compound stays an outline.
|
||||
for turned in [1usize, 2] {
|
||||
let mut s = session();
|
||||
let c = one_compound(&mut s, "do");
|
||||
// One path per contour: the d's two, then the o's two.
|
||||
let paths = children_of(&s, c);
|
||||
assert_eq!(paths.len(), 4, "a d and an o are two contours each");
|
||||
let p = paths[paths.len() - turned];
|
||||
s.edit("test", |d, _| {
|
||||
let data = d.node_mut(NodeId(p)).unwrap().path_data_mut().unwrap();
|
||||
*data = vectorcraft_geom::PathData::from_bezpath(&data.to_bezpath().reverse_subpaths());
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
s.execute("select.set", &json!({"ids": [c]})).unwrap();
|
||||
assert!(s.execute("type.retype", &json!({})).is_err(), "nonzero, contour {turned} turned paints the counter");
|
||||
s.execute("path.setFillRule", &json!({"rule": "evenOdd", "ids": [c]})).unwrap();
|
||||
let r = s.execute("type.retype", &json!({})).unwrap();
|
||||
assert_eq!(r["texts"], json!(["do"]), "contour {turned} turned: {r}");
|
||||
assert_eq!(r["unmatched"], json!([]), "{r}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_compound_whose_glyph_stays_an_outline_keeps_its_other_glyphs_too() {
|
||||
let mut s = session();
|
||||
|
||||
+174
-35
@@ -360,13 +360,25 @@ impl RetypeIndex {
|
||||
|
||||
/// [`Self::all_matches`], and when the shape fits no glyph as it is, its contours read the
|
||||
/// other way round: for a part of a compound path, which Make Compound Path may have turned so
|
||||
/// it cuts a hole in the paths behind it.
|
||||
/// it cuts a hole in the paths behind it. When neither reading fits, the contours are read the
|
||||
/// way their depth gives, outer contours one way and their counters the other, both ways round:
|
||||
/// an even-odd compound paints the same whichever way each contour runs, so an o's counter may
|
||||
/// run the same way as its outer contour.
|
||||
pub fn matches_either_way(&self, shape: &BezPath) -> Vec<GlyphMatch> {
|
||||
let found = self.matches_read(shape, shape);
|
||||
if !found.is_empty() {
|
||||
return found;
|
||||
}
|
||||
self.matches_read(shape, &shape.reverse_subpaths())
|
||||
let found = self.matches_read(shape, &shape.reverse_subpaths());
|
||||
if !found.is_empty() {
|
||||
return found;
|
||||
}
|
||||
let Some(nested) = nested_reading(shape) else { return vec![] };
|
||||
let found = self.matches_read(shape, &nested);
|
||||
if !found.is_empty() {
|
||||
return found;
|
||||
}
|
||||
self.matches_read(shape, &nested.reverse_subpaths())
|
||||
}
|
||||
|
||||
/// [`Self::all_matches`] of `shape`, its contours read as in `reading` (the same outline).
|
||||
@@ -880,39 +892,7 @@ pub fn clusters(path: &BezPath) -> Vec<BezPath> {
|
||||
},
|
||||
}
|
||||
}
|
||||
let boxes: Vec<kurbo::Rect> = subs.iter().map(Shape::bounding_box).collect();
|
||||
// Up to MAX_CONTAINMENT_PROBES of each contour's anchor points, evenly spread: a contour lies in
|
||||
// another only when every one of them does.
|
||||
let probes: Vec<Vec<Point>> = subs
|
||||
.iter()
|
||||
.map(|s| {
|
||||
let anchors: Vec<Point> = s.elements().iter().filter_map(|e| e.end_point()).collect();
|
||||
let step = anchors.len().div_ceil(MAX_CONTAINMENT_PROBES).max(1);
|
||||
anchors.into_iter().step_by(step).collect()
|
||||
})
|
||||
.collect();
|
||||
// Each contour's container: the smallest contour around it.
|
||||
let parent: Vec<Option<usize>> = (0..subs.len())
|
||||
.map(|i| {
|
||||
let (Some(bi), Some(pi)) = (boxes.get(i), probes.get(i)) else { return None };
|
||||
if pi.is_empty() {
|
||||
return None;
|
||||
}
|
||||
(0..subs.len())
|
||||
.filter(|&j| j != i)
|
||||
.filter_map(|j| Some((j, boxes.get(j)?, subs.get(j)?)))
|
||||
.filter(|(_, bj, sj)| {
|
||||
bj.area() > bi.area()
|
||||
&& bj.x0 <= bi.x0
|
||||
&& bj.y0 <= bi.y0
|
||||
&& bj.x1 >= bi.x1
|
||||
&& bj.y1 >= bi.y1
|
||||
&& pi.iter().all(|p| sj.winding(*p) != 0)
|
||||
})
|
||||
.min_by(|a, b| a.1.area().total_cmp(&b.1.area()))
|
||||
.map(|(j, _, _)| j)
|
||||
})
|
||||
.collect();
|
||||
let parent = containers(&subs);
|
||||
let root = |mut i: usize| {
|
||||
// Containers are strictly larger, so the chain ends; the bound keeps it so.
|
||||
for _ in 0..subs.len() {
|
||||
@@ -935,6 +915,90 @@ pub fn clusters(path: &BezPath) -> Vec<BezPath> {
|
||||
groups.into_iter().map(|(_, p)| p).collect()
|
||||
}
|
||||
|
||||
/// Each contour's container among `subs` (one contour each): the smallest other contour that holds
|
||||
/// it, `None` for an outer contour.
|
||||
fn containers(subs: &[BezPath]) -> Vec<Option<usize>> {
|
||||
let boxes: Vec<kurbo::Rect> = subs.iter().map(Shape::bounding_box).collect();
|
||||
// Up to MAX_CONTAINMENT_PROBES of each contour's anchor points, evenly spread: a contour lies in
|
||||
// another only when every one of them does.
|
||||
let probes: Vec<Vec<Point>> = subs
|
||||
.iter()
|
||||
.map(|s| {
|
||||
let anchors: Vec<Point> = s.elements().iter().filter_map(|e| e.end_point()).collect();
|
||||
let step = anchors.len().div_ceil(MAX_CONTAINMENT_PROBES).max(1);
|
||||
anchors.into_iter().step_by(step).collect()
|
||||
})
|
||||
.collect();
|
||||
// Each contour's container: the smallest contour around it.
|
||||
(0..subs.len())
|
||||
.map(|i| {
|
||||
let (Some(bi), Some(pi)) = (boxes.get(i), probes.get(i)) else { return None };
|
||||
if pi.is_empty() {
|
||||
return None;
|
||||
}
|
||||
(0..subs.len())
|
||||
.filter(|&j| j != i)
|
||||
.filter_map(|j| Some((j, boxes.get(j)?, subs.get(j)?)))
|
||||
.filter(|(_, bj, sj)| {
|
||||
bj.area() > bi.area()
|
||||
&& bj.x0 <= bi.x0
|
||||
&& bj.y0 <= bi.y0
|
||||
&& bj.x1 >= bi.x1
|
||||
&& bj.y1 >= bi.y1
|
||||
&& pi.iter().all(|p| sj.winding(*p) != 0)
|
||||
})
|
||||
.min_by(|a, b| a.1.area().total_cmp(&b.1.area()))
|
||||
.map(|(j, _, _)| j)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// `path` with each contour turned to run the way its depth gives (an outer contour one way, its
|
||||
/// counters the other, what lies in those the first way again), the outer contours keeping the way
|
||||
/// the first of them runs. `None` when that turns no contour (the path read as it is), for a
|
||||
/// contour that encloses no area, and for more than [`MAX_CONTOURS`] contours.
|
||||
fn nested_reading(path: &BezPath) -> Option<BezPath> {
|
||||
let mut subs: Vec<BezPath> = vec![];
|
||||
for el in path.elements() {
|
||||
if matches!(el, PathEl::MoveTo(_)) {
|
||||
if subs.len() >= MAX_CONTOURS {
|
||||
return None;
|
||||
}
|
||||
subs.push(BezPath::new());
|
||||
}
|
||||
subs.last_mut()?.push(*el);
|
||||
}
|
||||
let parent = containers(&subs);
|
||||
let depth = |mut i: usize| {
|
||||
let mut d = 0usize;
|
||||
// Containers are strictly larger, so the chain ends; the bound keeps it so.
|
||||
for _ in 0..subs.len() {
|
||||
match parent.get(i).copied().flatten() {
|
||||
Some(p) => {
|
||||
i = p;
|
||||
d += 1;
|
||||
}
|
||||
None => break,
|
||||
}
|
||||
}
|
||||
d
|
||||
};
|
||||
let areas: Vec<f64> = subs.iter().map(Shape::area).collect();
|
||||
if areas.iter().any(|a| !a.is_normal()) {
|
||||
return None;
|
||||
}
|
||||
let outer = (0..subs.len()).find(|&i| depth(i) == 0).and_then(|i| areas.get(i)).map(|a| a.signum())?;
|
||||
let turned: Vec<bool> = areas.iter().enumerate().map(|(i, a)| a.signum() != if depth(i) % 2 == 0 { outer } else { -outer }).collect();
|
||||
if turned.iter().all(|t| !*t) {
|
||||
return None;
|
||||
}
|
||||
let mut out = BezPath::new();
|
||||
for (s, t) in subs.iter().zip(&turned) {
|
||||
out.extend(if *t { s.reverse_subpaths() } else { s.clone() }.iter());
|
||||
}
|
||||
Some(out)
|
||||
}
|
||||
|
||||
/// `a` wrapped into −π..π.
|
||||
fn wrapped(a: f64) -> f64 {
|
||||
(a + std::f64::consts::PI).rem_euclid(std::f64::consts::TAU) - std::f64::consts::PI
|
||||
@@ -2271,6 +2335,81 @@ mod tests {
|
||||
assert!(clusters(&BezPath::new()).is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_nested_reading_turns_counters_against_their_outer_contour() {
|
||||
let split = |p: &BezPath| -> Vec<BezPath> {
|
||||
let mut out: Vec<BezPath> = vec![];
|
||||
for el in p.elements() {
|
||||
if matches!(el, PathEl::MoveTo(_)) {
|
||||
out.push(BezPath::new());
|
||||
}
|
||||
out.last_mut().unwrap().push(*el);
|
||||
}
|
||||
out
|
||||
};
|
||||
let join = |cs: &[BezPath]| {
|
||||
let mut p = BezPath::new();
|
||||
for c in cs {
|
||||
p.extend(c.iter());
|
||||
}
|
||||
p
|
||||
};
|
||||
let cs = split(&letter());
|
||||
let (outer, counter) = (cs[0].clone(), cs[1].clone());
|
||||
let (same, opposite) = if outer.area().signum() == counter.area().signum() {
|
||||
(counter.clone(), counter.reverse_subpaths())
|
||||
} else {
|
||||
(counter.reverse_subpaths(), counter.clone())
|
||||
};
|
||||
// A counter running the same way as its outer contour is turned; the outer one is kept.
|
||||
let read = nested_reading(&join(&[outer.clone(), same.clone()])).unwrap();
|
||||
let rs = split(&read);
|
||||
assert_eq!(rs[0], outer);
|
||||
assert_eq!(rs[1].area().signum(), opposite.area().signum());
|
||||
// So is the outer contour's way when it comes second.
|
||||
let read = nested_reading(&join(&[opposite.clone(), outer.reverse_subpaths()])).unwrap();
|
||||
let rs = split(&read);
|
||||
assert_eq!(rs[1], outer.reverse_subpaths());
|
||||
assert_eq!(rs[0].area().signum(), outer.area().signum());
|
||||
// Already nested so: nothing to turn.
|
||||
assert!(nested_reading(&join(&[outer.clone(), opposite])).is_none());
|
||||
// A contour enclosing no area gives none.
|
||||
let mut flat = BezPath::new();
|
||||
flat.move_to((0.0, 0.0));
|
||||
flat.line_to((10.0, 0.0));
|
||||
flat.close_path();
|
||||
assert!(nested_reading(&join(&[outer, flat])).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_part_with_some_contours_turned_still_matches_exactly() {
|
||||
let db = FontDb::with_font_dirs(vec![]);
|
||||
assert_eq!(db.add_font(crate::test_fonts::named_copy(false, ("Turntest", "Regular", "Version 1.000", "Turntest-Regular")).unwrap()), 1);
|
||||
let face = db.face("Turntest", "Regular").unwrap();
|
||||
let o = Affine::translate((40.0, 90.0)) * Affine::scale(0.03) * db.outline_uncached(&face, face.glyph_for('o'));
|
||||
let mut cs: Vec<BezPath> = vec![];
|
||||
for el in o.elements() {
|
||||
if matches!(el, PathEl::MoveTo(_)) {
|
||||
cs.push(BezPath::new());
|
||||
}
|
||||
cs.last_mut().unwrap().push(*el);
|
||||
}
|
||||
assert_eq!(cs.len(), 2, "an o is two contours");
|
||||
let keys = std::iter::once(shape_key(&o).unwrap()).collect();
|
||||
let index = RetypeIndex::build(&db, vec![face], &keys);
|
||||
assert!(!index.all_matches(&o).is_empty());
|
||||
for turned in 0..2 {
|
||||
let mut shape = BezPath::new();
|
||||
for (i, c) in cs.iter().enumerate() {
|
||||
shape.extend(if i == turned { c.reverse_subpaths() } else { c.clone() }.iter());
|
||||
}
|
||||
assert!(index.all_matches(&shape).is_empty(), "contour {turned} turned is no glyph as it is");
|
||||
assert!(index.all_matches(&shape.reverse_subpaths()).is_empty(), "nor read the other way round");
|
||||
let found = index.matches_either_way(&shape);
|
||||
assert!(found.iter().any(|m| m.ch == 'o'), "contour {turned} turned still matches the o");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_same_corners_joined_another_way_are_another_outline() {
|
||||
let poly = |pts: &[(f64, f64)]| {
|
||||
|
||||
+3
-2
@@ -11456,8 +11456,9 @@ at a leftover distance of 0.05. A compound path that holds several
|
||||
glyphs, such as a word made into one compound path, is split into groups of contours (a contour with the contours
|
||||
inside it) in path order, and runs of up to three groups are matched, the longest first among those after which the
|
||||
remaining groups can still all be matched, so an i's stem and dot become one i. A group whose contours run the other
|
||||
way round, as Make Compound Path leaves some of them, still matches exactly. Exact matches of the whole shape come
|
||||
first, then exact matches of its groups, then near matches of the whole shape, then near matches of its groups. The
|
||||
way round, as Make Compound Path leaves some of them, still matches exactly, and so does one where only some of its
|
||||
contours run the other way round (in an even-odd compound, an o's counter and not its outer contour). Exact matches
|
||||
of the whole shape come first, then exact matches of its groups, then near matches of the whole shape, then near matches of its groups. The
|
||||
compound becomes type only when every one of its glyphs does; otherwise it stays as it is and is reported once in
|
||||
`unmatched` when another shape of the selection becomes type, and the command returns an error when no shape does. A
|
||||
glyph also has to paint the area the shape paints under the shape's fill rule: a compound filled by the nonzero rule
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ against Illustrator's public documentation; **estimated** unless noted.
|
||||
| Alt + numeric-keypad codes while typing (Windows: `Alt+0176` → °) | partial | #5108: on Windows the character Windows posts when Alt comes up after keypad digits is typed at the caret like any other, in the typing's undo step, and the keypad digits typed with Alt run no shortcut. With NumLock off the keypad keys (Insert, End, arrows, Clear, Home, Page Up/Down without the extended-key flag) count as digits too and don't move the caret (`windows_alt_codes` unit tests; neither NumLock on nor off has been tried on a Windows machine yet). `type.insert {code}` (Windows Alt+0 code, Windows-1252 for 128–159) and `{unicode}` (hex code point) insert a character by its code (`menucmds::insert_a_character_by_its_code`). macOS and Linux have no such system convention and egui reports a keypad digit as the top-row digit, so there it does nothing; a floating panel window doesn't receive the character |
|
||||
| Caret: the arrows and Delete step over whole clusters (Thai consonant with its marks, combining accents, emoji); Backspace removes one character | done | in text with right-to-left characters the arrows move in visual order and stop on both sides of a character drawn with no width, such as a zero width non-joiner |
|
||||
| Touch Type tool | done | moves, scales and rotates one character through its kerning, baseline shift, scales and rotation (`text.touchType`); a character with a preceding logical character on the same line can move along the line in either reading direction; the first logical character moves only up and down. Positive `dx` follows reading order. These direction rules are VectorCraft's choices. |
|
||||
| Retype (identify fonts in outlines/images) | partial | Phase 1 (#4934): Type › Retype (`type.retype`) turns outlined glyphs back into type when each shape is exactly a glyph of a loaded font, a font the document uses or a family named in `fonts` (the same up to uniform scale, rotation and translation): one object per line unless lines stack into one object as described below, in that font and size, at the same baseline and turn, with the first glyph's fill and stroke, in one undo step; shapes that match no font stay as they are and are reported. Near matches: with `tolerance` (0 to 0.05), shapes of up to 8 contours whose leftover distance from a glyph, relative to the shape's outline spread (the root mean square distance of its sampled outline points from their center), is at most the tolerance (simplified outlines, curves split in two, contours in another order or direction) match too, and each line reports a `score`; a compound path holding several glyphs is split into them and becomes type only when all of them match. A line of three or more exactly matched glyphs keeps the spacing most of its gaps share as tracking (gaps one space wide stay word spaces when type draws them). A line of two glyphs that untracked type does not draw in place takes the tracking of the nearest tracked line in the same font, size and turn, and keeps it only when type at that tracking draws both glyphs in place; a line of one or two glyphs that joins tracked lines in one object takes their tracking. Other lines are set untracked, each glyph at its own position, and lines stacked at one leading and lined up at their starts, ends or centers become one area type object with that leading and alignment (VectorCraft's own rules, checked against the layout). Window › Retype shows the Retype panel, which lists the fonts whose glyphs exactly match at least one selected outlined shape, comparing up to 96 loaded fonts with those of the document's live type first, ranked by how many shapes each matches, with samples, and sets a listed font on selected live type (`retype.find`, `type.retypeFonts`). Missing (phase 2): glyphs fused into one contour, near matches and compound paths of several glyphs in the panel's list, opening the panel from the Type menu, the context menu and the Properties panel's Quick Actions, filtering the list by font source and favorites, installed fonts not yet loaded, text in images. Public behaviour: [identify fonts](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/identify-fonts-using-retype.html), [apply to live text](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/apply-retype-suggested-fonts-to-live-text.html) |
|
||||
| Retype (identify fonts in outlines/images) | partial | Phase 1 (#4934): Type › Retype (`type.retype`) turns outlined glyphs back into type when each shape is exactly a glyph of a loaded font, a font the document uses or a family named in `fonts` (the same up to uniform scale, rotation and translation): one object per line unless lines stack into one object as described below, in that font and size, at the same baseline and turn, with the first glyph's fill and stroke, in one undo step; shapes that match no font stay as they are and are reported. Near matches: with `tolerance` (0 to 0.05), shapes of up to 8 contours whose leftover distance from a glyph, relative to the shape's outline spread (the root mean square distance of its sampled outline points from their center), is at most the tolerance (simplified outlines, curves split in two, contours in another order or direction) match too, and each line reports a `score`; a compound path holding several glyphs is split into them and becomes type only when all of them match, a part still matching exactly when some of its contours run the other way round (an o's counter alone in an even-odd compound). A line of three or more exactly matched glyphs keeps the spacing most of its gaps share as tracking (gaps one space wide stay word spaces when type draws them). A line of two glyphs that untracked type does not draw in place takes the tracking of the nearest tracked line in the same font, size and turn, and keeps it only when type at that tracking draws both glyphs in place; a line of one or two glyphs that joins tracked lines in one object takes their tracking. Other lines are set untracked, each glyph at its own position, and lines stacked at one leading and lined up at their starts, ends or centers become one area type object with that leading and alignment (VectorCraft's own rules, checked against the layout). Window › Retype shows the Retype panel, which lists the fonts whose glyphs exactly match at least one selected outlined shape, comparing up to 96 loaded fonts with those of the document's live type first, ranked by how many shapes each matches, with samples, and sets a listed font on selected live type (`retype.find`, `type.retypeFonts`). Missing (phase 2): glyphs fused into one contour, near matches and compound paths of several glyphs in the panel's list, opening the panel from the Type menu, the context menu and the Properties panel's Quick Actions, filtering the list by font source and favorites, installed fonts not yet loaded, text in images. Public behaviour: [identify fonts](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/identify-fonts-using-retype.html), [apply to live text](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/apply-retype-suggested-fonts-to-live-text.html) |
|
||||
| Snap to Glyph | done | View › Snap to Glyph (`view.snapToGlyph`): with Smart Guides on, new point type and drawing tools snap to live-text baselines and glyph bounds, the corners of each glyph's box included, turning with rotated type (#5112; `guides::tests::a_drawn_point_lands_on_a_corner_of_a_glyphs_bounds`, `Targets::for_drawing`, `tools::text_tests::snap_to_glyph_lines_up_new_point_type_with_a_baseline`). With Alignment Guides on as well, and Snap to Grid and Snap to Pixel off, both ends of a Measure or Measure & Inspect drag snap to those guides and show them during the drag (`Targets::for_measure`, `xform::measure::tests::its_ends_land_on_glyph_guides_with_snap_to_glyph`). That the Measure tools take the guides is VectorCraft's choice; they leave out Anchor Point, which [the help page](https://helpx.adobe.com/illustrator/desktop/design-with-text/special-characters-glyphs/snap-to-glyph.html) limits to the Pen tool and objects moved with the Selection tool. Character panel menu › Show Snap to Glyph Options: Baseline, x-height, Glyph Bounds, Proximity Guides, Angular Guides and Anchor Point each turn their guides on or off (`view.snapToGlyph.options`, all on by default; #4232), after a Snap to Glyph checkbox for View › Snap to Glyph; showing them scrolls the panel to them (#5273) |
|
||||
| Thai, Lao, Khmer, Myanmar: shaping (marks, reordering), lines broken between words, word-by-word caret and double-click | done | words found by ICU4X's line segmenter: dictionaries on the desktop, LSTM models on the web |
|
||||
| Middle Eastern: bidirectional layout, Paragraph Direction | done | PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import still needs ActualText support (#6165); separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. |
|
||||
|
||||
Reference in new issue
Block a user