diff --git a/crates/doc/src/text.rs b/crates/doc/src/text.rs index e24f267d6d..41bb2096c5 100644 --- a/crates/doc/src/text.rs +++ b/crates/doc/src/text.rs @@ -24,6 +24,29 @@ pub enum Kerning { Off, } +/// Which digits the text's 0–9 are drawn with. The stored text keeps the digits as typed, so a +/// search, a copy and a PSD keep them; only the drawn glyphs change. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize, craft_ui_macros::PlainData)] +pub enum Digits { + /// As typed. + #[default] + AsTyped, + /// Western digits (0–9), also for digits typed in an Indic script. + Western, + /// The digits of the Indic script of the last letter before them in the paragraph; Western + /// after a letter of any other script, or with none before. + Contextual, + Devanagari, + Bengali, + Gurmukhi, + Gujarati, + Odia, + Tamil, + Telugu, + Kannada, + Malayalam, +} + #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize, craft_ui_macros::PlainData)] pub enum Caps { #[default] @@ -101,6 +124,8 @@ pub struct CharStyle { pub variations: Vec, /// BCP-47 language tag (affects shaping and line breaking). pub language: Option, + /// Digit style: which script's digits 0–9 are drawn with. + pub digits: Digits, /// Vertical type: roman text (Latin, digits) runs rotated 90° clockwise along the column /// (PSD `BaselineDirection` 2) instead of standing upright one character per em /// (`BaselineDirection` 1, what Photoshop's Vertical Type tool sets, #9470). CJK text stands @@ -140,6 +165,7 @@ impl Default for CharStyle { features: Vec::new(), variations: Vec::new(), language: None, + digits: Digits::AsTyped, rotate_roman: false, style_sheet: None, } diff --git a/crates/engine-core/src/cmd/type_cmds.rs b/crates/engine-core/src/cmd/type_cmds.rs index b5bf1f9345..03f4fbdbb3 100644 --- a/crates/engine-core/src/cmd/type_cmds.rs +++ b/crates/engine-core/src/cmd/type_cmds.rs @@ -10,7 +10,7 @@ use std::sync::Arc; use photocraft_color::{Color, ColorMode, PixelFormat}; use photocraft_doc::text::{ - AntiAlias, Caps, CharStyle, FontBaseline, FontFeature, FontVariation, Kerning, Orientation, ParagraphRun, ParagraphStyle, TextAlign, TextDirection, + AntiAlias, Caps, CharStyle, Digits, FontBaseline, FontFeature, FontVariation, Kerning, Orientation, ParagraphRun, ParagraphStyle, TextAlign, TextDirection, TextRun, TextShape, }; use photocraft_doc::{Affine, Document, Layer, LayerContent, LayerId, TextLayer}; @@ -141,6 +141,11 @@ pub fn check_size_tracking(p: &Value) -> std::result::Result<(), String> { { return Err("baseline must be \"normal\", \"superscript\" or \"subscript\"".into()); } + if let Some(v) = p.get("digits").filter(|v| !v.is_null()) + && v.as_str().and_then(digits_of).is_none() + { + return Err(format!("digits must be one of {DIGIT_NAMES}")); + } for key in ["horizontalScale", "verticalScale"] { if let Some(v) = p.get(key) { match v.as_f64() { @@ -433,9 +438,35 @@ fn apply_char_features(s: &mut CharStyle, p: &Value) -> bool { s.language = v.as_str().map(str::to_string); hit(true); } + // An unknown value keeps the style (the commands reject it in `check_size_tracking`). + if let Some(d) = p.get("digits").and_then(Value::as_str).and_then(digits_of) { + s.digits = d; + hit(true); + } any } +const DIGIT_NAMES: &str = "asTyped, western, contextual, devanagari, bengali, gurmukhi, gujarati, odia, tamil, telugu, kannada, malayalam"; + +/// The digit style named `v` (the `digits` key of the type commands). +fn digits_of(v: &str) -> Option { + Some(match v { + "asTyped" => Digits::AsTyped, + "western" => Digits::Western, + "contextual" => Digits::Contextual, + "devanagari" => Digits::Devanagari, + "bengali" => Digits::Bengali, + "gurmukhi" => Digits::Gurmukhi, + "gujarati" => Digits::Gujarati, + "odia" => Digits::Odia, + "tamil" => Digits::Tamil, + "telugu" => Digits::Telugu, + "kannada" => Digits::Kannada, + "malayalam" => Digits::Malayalam, + _ => return None, + }) +} + /// Applies paragraph-style keys from JSON. Returns true if any key was present. pub fn apply_para_props(s: &mut ParagraphStyle, p: &Value) -> bool { let mut any = false; @@ -1004,7 +1035,7 @@ pub fn name_selection_commit(s: &mut Session) { } } -const CHAR_PARAMS: &str = r##""font":str,"fontStyle":str,"weight":100..900,"italic":bool,"size":0.1..=1296 pt,"color":"#rrggbb"|[r,g,b,a],"tracking":-1000..=10000 (1/1000 em),"leading":pt|"auto","baselineShift":pt,"horizontalScale":%,"verticalScale":%,"underline":bool,"strikethrough":bool,"fauxBold":bool,"fauxItalic":bool,"kerning":1/1000em (manual, after each character)|"metrics"|"optical"|"off","caps":"normal|small|all","baseline":"normal|superscript|subscript","ligatures":bool,"discretionaryLigatures":bool,"features":{"ss01":1},"variations":{"wght":650},"language":str"##; +const CHAR_PARAMS: &str = r##""font":str,"fontStyle":str,"weight":100..900,"italic":bool,"size":0.1..=1296 pt,"color":"#rrggbb"|[r,g,b,a],"tracking":-1000..=10000 (1/1000 em),"leading":pt|"auto","baselineShift":pt,"horizontalScale":%,"verticalScale":%,"underline":bool,"strikethrough":bool,"fauxBold":bool,"fauxItalic":bool,"kerning":1/1000em (manual, after each character)|"metrics"|"optical"|"off","caps":"normal|small|all","baseline":"normal|superscript|subscript","ligatures":bool,"discretionaryLigatures":bool,"features":{"ss01":1},"variations":{"wght":650},"language":str,"digits":"asTyped|western|contextual|devanagari|bengali|gurmukhi|gujarati|odia|tamil|telugu|kannada|malayalam""##; /// The Type commands: create and edit type layers, set styles, fill paths, and the queries about them. pub fn specs() -> Vec { diff --git a/crates/engine-vector/src/cmd/type_styles_cmds.rs b/crates/engine-vector/src/cmd/type_styles_cmds.rs index 98088d9478..0b588be77f 100644 --- a/crates/engine-vector/src/cmd/type_styles_cmds.rs +++ b/crates/engine-vector/src/cmd/type_styles_cmds.rs @@ -84,7 +84,7 @@ fn id_param(cmd: &str, p: &Value) -> Result> { /// A character style with every field changed from the default, to see which fields a set of /// Character-panel keys touches. fn perturbed_char() -> CharStyle { - use photocraft_doc::text::{Caps, FontBaseline, FontFeature, FontVariation, Kerning}; + use photocraft_doc::text::{Caps, Digits, FontBaseline, FontFeature, FontVariation, Kerning}; CharStyle { font_family: "\u{1}".into(), font_style: "\u{1}".into(), @@ -111,6 +111,7 @@ fn perturbed_char() -> CharStyle { features: vec![FontFeature { tag: "\u{1}".into(), value: 9 }], variations: vec![FontVariation { axis: "\u{1}".into(), value: -1.0 }], language: Some("\u{1}".into()), + digits: Digits::Malayalam, rotate_roman: true, style_sheet: None, } diff --git a/crates/text/src/digits.rs b/crates/text/src/digits.rs new file mode 100644 index 0000000000..8a4b8b9f8f --- /dev/null +++ b/crates/text/src/digits.rs @@ -0,0 +1,97 @@ +//! Digit style: the digits a style's 0–9 are drawn with (Western, or an Indic script's). The +//! layer's text keeps the digits as typed; only the shaped paragraph text changes. + +use photocraft_doc::text::Digits; + +/// The Indic blocks U+0900–U+0D7F are 128 code points each, with their digits at +0x66. +const INDIC_FIRST: u32 = 0x0900; +const INDIC_END: u32 = 0x0D80; +const DIGITS_AT: u32 = 0x66; + +/// The block start of an Indic script's digits, for a style naming one. +fn block_of(d: Digits) -> Option { + Some(match d { + Digits::Devanagari => 0x0900, + Digits::Bengali => 0x0980, + Digits::Gurmukhi => 0x0A00, + Digits::Gujarati => 0x0A80, + Digits::Odia => 0x0B00, + Digits::Tamil => 0x0B80, + Digits::Telugu => 0x0C00, + Digits::Kannada => 0x0C80, + Digits::Malayalam => 0x0D00, + Digits::AsTyped | Digits::Western | Digits::Contextual => return None, + }) +} + +/// The value 0–9 of a Western or Indic digit. +fn digit_value(ch: char) -> Option { + let c = ch as u32; + if ch.is_ascii_digit() { + return Some(c - '0' as u32); + } + let off = c.checked_sub(INDIC_FIRST)? % 0x80; + ((INDIC_FIRST..INDIC_END).contains(&c) && (DIGITS_AT..DIGITS_AT + 10).contains(&off)).then(|| off - DIGITS_AT) +} + +/// For a letter, `Some` of its Indic block (`None` inside for any other script's letter); `None` +/// for a non-letter (digit, punctuation, space), which leaves the context as it is. +fn letter_block(ch: char) -> Option> { + if !ch.is_alphabetic() { + return None; + } + let c = ch as u32; + if (0xA8E0..0xA900).contains(&c) { + // Devanagari Extended. + return Some(Some(0x0900)); + } + Some((INDIC_FIRST..INDIC_END).contains(&c).then_some(c & !0x7F)) +} + +/// Whether the first letter of `text` is of a right-to-left script (Hebrew, Arabic and their +/// neighbours), as the bidi algorithm would find it in the typed text. Digits drawn in an Indic +/// script are left-to-right letters to it, so a paragraph that opens with them takes its +/// direction from the typed text instead. +pub(crate) fn starts_rtl(text: &str) -> bool { + text.chars().find(|c| c.is_alphabetic()).is_some_and(|c| { + let c = c as u32; + (0x0590..0x0900).contains(&c) + || (0xFB1D..0xFE00).contains(&c) + || (0xFE70..0xFF00).contains(&c) + || (0x10800..0x11000).contains(&c) + || (0x1E800..0x1F000).contains(&c) + }) +} + +/// The last letter's script, followed through a paragraph for [`Digits::Contextual`]. +#[derive(Clone, Copy, Default)] +pub(crate) struct Context(Option); + +impl Context { + /// Notes `ch` (as typed), which may be a letter that sets the context. + pub(crate) fn see(&mut self, ch: char) { + if let Some(block) = letter_block(ch) { + self.0 = block; + } + } +} + +/// `ch` as style `d` draws it after the letters `ctx` has seen. +pub(crate) fn styled(ch: char, d: Digits, ctx: Context) -> char { + if d == Digits::AsTyped { + return ch; + } + let Some(v) = digit_value(ch) else { + return ch; + }; + let block = match d { + Digits::Western => None, + Digits::Contextual => ctx.0, + _ => block_of(d), + }; + let c = match block { + Some(b) => b + DIGITS_AT + v, + None => '0' as u32 + v, + }; + char::from_u32(c).unwrap_or(ch) +} diff --git a/crates/text/src/digits_tests.rs b/crates/text/src/digits_tests.rs new file mode 100644 index 0000000000..f87f61afc3 --- /dev/null +++ b/crates/text/src/digits_tests.rs @@ -0,0 +1,68 @@ +use photocraft_doc::TextLayer; +use photocraft_doc::text::{CharStyle, Digits, TextRun}; + +use crate::TextEngine; +use crate::digits::{Context, styled}; + +fn drawn(text: &str, d: Digits) -> String { + let mut ctx = Context::default(); + text.chars() + .map(|ch| { + let out = styled(ch, d, ctx); + ctx.see(ch); + out + }) + .collect() +} + +#[test] +fn contextual_digits_follow_the_last_letter() { + // After Gujarati letters, Gujarati digits; after a Latin letter, Western again; punctuation + // and spaces between don't reset the context. + assert_eq!(drawn("ક 12, A 3", Digits::Contextual), "ક ૧૨, A 3"); + // Digits typed in one Indic script follow the context too. + assert_eq!(drawn("क ૩", Digits::Contextual), "क ३"); + assert_eq!(drawn("३ and ૪", Digits::Western), "3 and 4"); + assert_eq!(drawn("क 12", Digits::AsTyped), "क 12"); +} + +fn layer(text: &str, digits: Digits) -> TextLayer { + let style = CharStyle { font_family: "Inter".into(), size_pt: 24.0, digits, ..Default::default() }; + TextLayer { text: text.into(), runs: vec![TextRun { len: text.len(), style }], ..Default::default() } +} + +/// A digit drawn in an Indic script is three UTF-8 bytes for the one typed: glyphs, clusters and +/// carets must still point into the layer's own text. +#[test] +fn indic_digits_keep_text_offsets() { + let mut e = TextEngine::new(); + let src = "No 12 x\n34 y"; + let typed = e.layout(&layer(src, Digits::AsTyped), 72.0); + let deva = e.layout(&layer(src, Digits::Devanagari), 72.0); + let ids = |l: &crate::TextLayout| l.glyphs.iter().map(|g| g.id).collect::>(); + assert_ne!(ids(&typed), ids(&deva), "the digits are drawn differently"); + for r in deva.glyph_ranges.iter().chain(deva.clusters.iter().map(|c| &c.range)) { + assert!(src.get(r.clone()).is_some(), "{r:?} is not a range of the layer text"); + } + let x_after = |l: &crate::TextLayout| l.clusters.iter().find(|c| c.range.start == 5).map(|c| c.x); + assert!(x_after(&deva).is_some(), "the space after the digits keeps its offset"); + assert!(deva.caret(5).0 > deva.caret(3).0, "the caret moves across the digits"); +} + +#[test] +fn devanagari_extended_letters_set_the_context() { + assert_eq!(drawn("\u{A8FE}12", Digits::Contextual), "\u{A8FE}१२"); +} + +/// Drawn Indic digits are left-to-right letters to the bidi algorithm; a paragraph of automatic +/// direction that opens with them still takes its direction from the typed text. +#[test] +fn indic_digits_keep_an_rtl_paragraph_rtl() { + let mut e = TextEngine::new(); + let src = "12 אב"; + let x = |l: &crate::TextLayout, at: usize| l.clusters.iter().find(|c| c.range.start == at).map(|c| c.x).unwrap(); + let typed = e.layout(&layer(src, Digits::AsTyped), 72.0); + let deva = e.layout(&layer(src, Digits::Devanagari), 72.0); + let hebrew = src.find('א').unwrap(); + assert_eq!(x(&typed, 0) > x(&typed, hebrew), x(&deva, 0) > x(&deva, hebrew), "the digits stay on the same side of the word"); +} diff --git a/crates/text/src/layout/shaping.rs b/crates/text/src/layout/shaping.rs index c7d701c5d7..399b39843c 100644 --- a/crates/text/src/layout/shaping.rs +++ b/crates/text/src/layout/shaping.rs @@ -85,6 +85,32 @@ struct ParaText { synthetic_small_caps: Vec<(Range, f32)>, /// Offsets in `ptext` of the spaces standing in for tabs. tabs: Vec, + /// Where a digit style drew a digit with another UTF-8 length. + remap: Remap, +} + +/// Where `ptext` and the paragraph content stop lining up byte for byte: after each digit drawn in +/// a script whose digits have another UTF-8 length, the pair (content offset, `ptext` offset) +/// just past it, both ascending. +#[derive(Default)] +struct Remap(Vec<(usize, usize)>); + +impl Remap { + /// The `ptext` offset of content offset `c`. + fn to_ptext(&self, c: usize, prefix: usize) -> usize { + match self.0.partition_point(|&(sc, _)| sc <= c).checked_sub(1) { + Some(i) => self.0[i].1 + (c - self.0[i].0), + None => prefix + c, + } + } + + /// The content offset of `ptext` offset `o`, a character boundary. + fn to_content(&self, o: usize, prefix: usize) -> usize { + match self.0.partition_point(|&(_, po)| po <= o).checked_sub(1) { + Some(i) => self.0[i].0 + (o - self.0[i].1), + None => o.saturating_sub(prefix), + } + } } /// The shaped text of the paragraph at `range` (`content_end` excludes its break), led by `prefix`. @@ -94,6 +120,8 @@ fn paragraph_text(env: &Env<'_>, prefix: &str, range: &Range, content_end ptext.push_str(prefix); let mut synthetic_small_caps = Vec::new(); let mut tabs = Vec::new(); + let mut remap = Remap::default(); + let mut ctx = crate::digits::Context::default(); for (i, ch) in content.char_indices() { // A forced line break ends the line but not the paragraph. The line breaker knows // it as a newline, which has the same length, so text offsets don't move. @@ -111,10 +139,25 @@ fn paragraph_text(env: &Env<'_>, prefix: &str, range: &Range, content_end continue; } let si = env.style_at(range.start + i); + let drawn = crate::digits::styled(ch, env.styles[si].digits, ctx); + ctx.see(ch); + if drawn != ch { + ptext.push(drawn); + if drawn.len_utf8() != ch.len_utf8() { + remap.0.push((i + ch.len_utf8(), ptext.len())); + } + continue; + } let synthetic = env.small_caps[si] == SmallCapsMode::Synthetic; push_cased(&mut ptext, &mut synthetic_small_caps, ch, &env.styles[si], synthetic, env.k); } - ParaText { ptext, synthetic_small_caps, tabs } + ParaText { ptext, synthetic_small_caps, tabs, remap } +} + +/// Whether a style in text `range` draws digits other than as typed. +fn restyles_digits(env: &Env<'_>, range: &Range) -> bool { + let (si0, si_end) = (env.style_at(range.start), env.run_starts.partition_point(|&rs| rs < range.end).max(env.style_at(range.start) + 1)); + env.styles.get(si0..si_end.min(env.styles.len())).is_some_and(|s| s.iter().any(|st| st.digits != photocraft_doc::text::Digits::AsTyped)) } /// Appends `ch` as its style sets it: uppercased for all caps and synthetic small caps (when the @@ -193,6 +236,7 @@ pub(super) struct Para<'a> { synthetic_small_caps: Vec<(Range, f32)>, /// Offsets in the paragraph text of the spaces standing in for tabs. pub(super) tabs: Vec, + remap: Remap, /// Runs intersecting the paragraph: `si0..si_end`. si0: usize, si_end: usize, @@ -216,11 +260,14 @@ impl<'a> Para<'a> { let k = env.k; let content_end = strip_break(env.text, &range); let prefix = match ps.direction { + // Drawn Indic digits would count as the first left-to-right letter: keep the typed + // text's direction. + TextDirection::Auto if restyles_digits(env, &range) && crate::digits::starts_rtl(&env.text[range.start..content_end]) => RLM, TextDirection::Auto => "", TextDirection::Ltr => LRM, TextDirection::Rtl => RLM, }; - let ParaText { ptext, synthetic_small_caps, tabs } = paragraph_text(env, prefix, &range, content_end); + let ParaText { ptext, synthetic_small_caps, tabs, remap } = paragraph_text(env, prefix, &range, content_end); // Scripts the loaded fonts may lack (Arabic, Japanese, …): a host serving a font for them // fetches it (`served`); it joins the fallback stack once it arrives. crate::served::request_for_text(&ptext); @@ -244,6 +291,7 @@ impl<'a> Para<'a> { ptext, synthetic_small_caps, tabs, + remap, si0, si_end, roman: Vec::new(), @@ -272,8 +320,8 @@ impl<'a> Para<'a> { if a >= z || st.rotate_roman { continue; } - let base = a - self.start + self.prefix.len(); - let piece = self.ptext.get(base..base + (z - a)).unwrap_or(""); + let base = self.to_ptext(a); + let piece = self.ptext.get(base..self.to_ptext(z)).unwrap_or(""); let px = st.size_pt * env.k; for (i, ch) in piece.char_indices() { if upright_roman(ch) && !ch.is_whitespace() { @@ -291,7 +339,12 @@ impl<'a> Para<'a> { /// Text offset of the paragraph text's byte `o`, as the layer's text offset. pub(super) fn map_offset(&self, o: usize) -> usize { - (self.start + o.saturating_sub(self.prefix.len())).min(self.content_end) + (self.start + self.remap.to_content(o, self.prefix.len())).min(self.content_end) + } + + /// The paragraph text offset of the layer text offset `t` (inside this paragraph). + fn to_ptext(&self, t: usize) -> usize { + self.remap.to_ptext(t - self.start, self.prefix.len()) } /// The paragraph text up to the end of the run piece at text range `range`. @@ -364,7 +417,7 @@ impl<'a> Para<'a> { if a >= z { return; } - let range = (a - self.start + self.prefix.len())..(z - self.start + self.prefix.len()); + let range = self.to_ptext(a)..self.to_ptext(z); for p in style_props(&env.styles[ri], env.k, &self.fallback, ri as u32, env.small_caps[ri]) { b.push(p, range.clone()); } diff --git a/crates/text/src/lib.rs b/crates/text/src/lib.rs index 8755434a2a..fb394898cd 100644 --- a/crates/text/src/lib.rs +++ b/crates/text/src/lib.rs @@ -21,6 +21,9 @@ pub mod area; pub mod cjk; mod color_glyphs; pub mod craft_fonts; +mod digits; +#[cfg(test)] +mod digits_tests; mod embolden; // The EngineData syntax of type layers is PSD format code: it lives in craft-psd. pub use craft_psd::engine_data; diff --git a/docs/scorecard.md b/docs/scorecard.md index 98360898f2..8f257f698b 100644 --- a/docs/scorecard.md +++ b/docs/scorecard.md @@ -10,7 +10,7 @@ Generated by `cargo xtask scorecard` from `perf/budgets.toml`, `perf/baseline.js | [File compatibility](#file-compatibility) | 11 | 14 | 2 | io corpus: oracle ≥ 148/170, round trip ≥ 169/170; psd-tools corpus: oracle ≥ 249/309, round trip ≥ 308/309; photoshop oracles: oracle ≥ 190/258, round trip ≥ 258/258 | | [Tools](#tools) | 36 | 9 | 0 | | | [Workspace and UI](#workspace-and-ui) | 15 | 6 | 2 | settings that do nothing: 9 of 204 (target 0) | -| [Type](#type) | 5 | 5 | 0 | | +| [Type](#type) | 5 | 6 | 0 | | | [Automation](#automation) | 6 | 4 | 2 | 664 of 664 menu items live (100.0%) | | [Reliability](#reliability) | 5 | 2 | 0 | never-crash lints on 28 of 28 crates; panic_hunt present | | [Distribution](#distribution) | 5 | 5 | 1 | | @@ -261,6 +261,7 @@ Unread: `general.color_picker`, `workspace.auto_show_hidden_panels`, `workspace. | TYPE-218-8 | Text editing: select all, double/triple/quadruple-click selection, paste, with tests | done | [#218](https://github.com/storytold/photocraft/issues/218) | Like Photoshop, 2 clicks select the word, 3 the laid-out line (a column in vertical type), 4 the paragraph up to the hard return, 5 all text, and the next quick click starts over (#3493; type_tool.rs next_click_count, click_selection, multi_click). Tested through real canvas clicks in point, paragraph and vertical type, with paste replacing the selection and Cmd+A selecting all (type_tool_tests.rs multi_click_selects_word_line_paragraph_and_all_in_point_text, multi_click_separates_wrapped_lines_from_paragraphs, click_counts_cycle_and_restart, click_selection_without_layout_and_on_hostile_input, multi_click_without_a_session_does_nothing) | | TYPE-218-9 | Distort/Perspective/Warp on live type as in Photoshop (was: offer 'Rasterize and continue?'; Photoshop doesn't prompt) | done | [#218](https://github.com/storytold/photocraft/issues/218) | Photoshop 2026 prompts for none of these: Edit › Transform › Warp on live type stays enabled with no rasterize prompt and offers only the warp styles (the mesh can't be dragged), so the type stays editable; Distort, Perspective and the split warps are greyed. PhotoCraft does the same: Warp on type commits the layer's Warp Text in one step (transform_tool.rs enter_type_warp, warp_cmds.rs warp_type_layer, #3004; warp_on_type_takes_a_style_and_keeps_the_type_editable), Distort/Perspective greyed (enable_rules.rs, #2701) | | TYPE-218-10 | Area type: Type tool click inside a closed path or shape wraps text inside it, holes and dents included, PSD round trip | partial | [#218](https://github.com/storytold/photocraft/issues/218) | TextShape::Area (doc text.rs) laid out line by line into the spans the path leaves (text area.rs, layout.rs break_area), type.fillPath (engine type_area_cmds.rs), released to box text by type.detachFromPath, area/path cursors and click-to-place (ui-egui type_tool.rs path_target), .pcraft round trip. Missing: PSD area type (saves as paragraph text over the path's bounds, with an export warning); mixed type sizes in one area paragraph space at its largest line; area type takes paths of at most 4096 anchors: beyond that a Type tool click makes point text (the pointer shows the plain I-beam), and type.fillPath refuses the path with "the path has too many anchor points" (type.attachToPath still takes a subpath of up to 100,000 anchors); a word too wide for every span in the shape overflows its span (box text breaks it at the edge, #6694); the first line starts about 0.24 em lower than in a text box of the same size; Photoshop area type in a PSD opens as box text; the area path has no handles to edit it after the type is placed | +| TYPE-10996-1 | Digit style: digits drawn as typed, Western, by the script of the letters before them, or in an Indic script (Devanagari, Bengali, Gurmukhi, Gujarati, Odia, Tamil, Telugu, Kannada, Malayalam) | partial | [#10996](https://github.com/storytold/photocraft/issues/10996) | CharStyle `digits` (doc text.rs), drawn in shaping (text digits.rs) while the layer text keeps the typed digits; set through the type commands' `digits` key. No Character panel control yet (needs the shared panel in craft-libs); Arabic and Persian digits are #6685; not saved in PSD | ## Automation diff --git a/scorecard/type.toml b/scorecard/type.toml index 9bba03a056..579e92e571 100644 --- a/scorecard/type.toml +++ b/scorecard/type.toml @@ -73,3 +73,10 @@ target = "Area type: Type tool click inside a closed path or shape wraps text in status = "partial" issue = 218 note = "TextShape::Area (doc text.rs) laid out line by line into the spans the path leaves (text area.rs, layout.rs break_area), type.fillPath (engine type_area_cmds.rs), released to box text by type.detachFromPath, area/path cursors and click-to-place (ui-egui type_tool.rs path_target), .pcraft round trip. Missing: PSD area type (saves as paragraph text over the path's bounds, with an export warning); mixed type sizes in one area paragraph space at its largest line; area type takes paths of at most 4096 anchors: beyond that a Type tool click makes point text (the pointer shows the plain I-beam), and type.fillPath refuses the path with \"the path has too many anchor points\" (type.attachToPath still takes a subpath of up to 100,000 anchors); a word too wide for every span in the shape overflows its span (box text breaks it at the edge, #6694); the first line starts about 0.24 em lower than in a text box of the same size; Photoshop area type in a PSD opens as box text; the area path has no handles to edit it after the type is placed" + +[[item]] +id = "TYPE-10996-1" +target = "Digit style: digits drawn as typed, Western, by the script of the letters before them, or in an Indic script (Devanagari, Bengali, Gurmukhi, Gujarati, Odia, Tamil, Telugu, Kannada, Malayalam)" +status = "partial" +issue = 10996 +note = "CharStyle `digits` (doc text.rs), drawn in shaping (text digits.rs) while the layer text keeps the typed digits; set through the type commands' `digits` key. No Character panel control yet (needs the shared panel in craft-libs); Arabic and Persian digits are #6685; not saved in PSD"