From b18e211c10ec72357647fdd1201b77085b608808 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 02:39:57 -0800 Subject: [PATCH 1/3] Document Info: Fonts gives each font's type and number of uses The Fonts category now shows each font's type (TrueType or OpenType, by the outlines of the face the type is drawn in) and its number of uses beside its name, in the panel, the saved report and Package's report. document.info adds fontUses: [{font, type, uses}] in the order of fonts. A use is a text object set in the font, counted once however many of its runs use it; type in an opacity mask or in a symbol's or pattern's art counts once however many objects show it. A font that is not installed in the family and style it names has an unknown type. With Selection Only the counts cover the selected type alone. --- crates/engine/src/cmd/docinfo.rs | 130 +++++++++++++++++++++++--- crates/text/src/fontdb.rs | 2 +- crates/text/src/fontdb/face.rs | 50 ++++++++++ crates/text/src/lib.rs | 6 +- crates/ui-egui/src/i18n/bg.tsv | 3 + crates/ui-egui/src/i18n/bs.tsv | 3 + crates/ui-egui/src/i18n/ca.tsv | 3 + crates/ui-egui/src/i18n/cs.tsv | 3 + crates/ui-egui/src/i18n/da.tsv | 3 + crates/ui-egui/src/i18n/de.tsv | 3 + crates/ui-egui/src/i18n/el.tsv | 3 + crates/ui-egui/src/i18n/es.tsv | 3 + crates/ui-egui/src/i18n/fi.tsv | 3 + crates/ui-egui/src/i18n/fr.tsv | 3 + crates/ui-egui/src/i18n/gu.tsv | 3 + crates/ui-egui/src/i18n/hi.tsv | 3 + crates/ui-egui/src/i18n/hu.tsv | 3 + crates/ui-egui/src/i18n/id.tsv | 3 + crates/ui-egui/src/i18n/it.tsv | 3 + crates/ui-egui/src/i18n/ja.tsv | 3 + crates/ui-egui/src/i18n/ka.tsv | 3 + crates/ui-egui/src/i18n/ko.tsv | 3 + crates/ui-egui/src/i18n/nl.tsv | 3 + crates/ui-egui/src/i18n/pl.tsv | 3 + crates/ui-egui/src/i18n/pt-br.tsv | 3 + crates/ui-egui/src/i18n/ru.tsv | 3 + crates/ui-egui/src/i18n/sv.tsv | 3 + crates/ui-egui/src/i18n/tests.rs | 10 +- crates/ui-egui/src/i18n/tr.tsv | 3 + crates/ui-egui/src/i18n/uk.tsv | 3 + crates/ui-egui/src/i18n/vi.tsv | 3 + crates/ui-egui/src/i18n/zh-hans.tsv | 3 + crates/ui-egui/src/i18n/zh-hant.tsv | 3 + crates/ui-egui/src/panels/doc_info.rs | 61 +++++++++++- docs/mcp.md | 8 +- docs/target-app-parity.md | 1 + 36 files changed, 328 insertions(+), 24 deletions(-) diff --git a/crates/engine/src/cmd/docinfo.rs b/crates/engine/src/cmd/docinfo.rs index 4068c2506c..7119365255 100644 --- a/crates/engine/src/cmd/docinfo.rs +++ b/crates/engine/src/cmd/docinfo.rs @@ -18,7 +18,7 @@ pub fn specs() -> Vec { "Document Info", ["Window", "Document Info"], None, - "{selectionOnly?, category?: document|objects|graphicStyles|brushes|spotColors|patterns|gradients|symbols|fonts|fontDetails|linkedImages|embeddedImages|repeats (only that one in sections and the text), format?: \"text\" (→ {text}: the report Document Info › Save… and Package write)} → {document: {…, units (English), unitId: the units' Preferences › Units id (points, millimeters, feetInches, …), rasterEffectsPpi}, objects: {paths, compoundPaths, groups, …}, pathLength: pt (the paths' total length, compound paths' included, guides left out), fonts (the type in opacity masks and in the art of symbols and patterns included; with selectionOnly: the selected type's), fontDetails: [{font, match: exact|style|missingWithFallback|missing, family, style, file, embedding: allowed|editing|previewPrint|forbidden|null}] (each font of fonts, in order: how it was found, the face shown (null when none), that face's file name (null for a built-in face) and what its license allows), images, imageObjects: [{name, width, height, linked, file}] (the image objects in the order Linked Images and Embedded Images list them; file: what a linked image's row shows, null for an embedded one), swatches, graphicStyleNames (with selectionOnly: the styles the selected objects are linked to), brushNames (the brushes the art's drawn strokes use, each once; with selectionOnly: those the selected objects' strokes use), brushes: [{name, type: calligraphic|scatter|art|pattern|bristle|null}] (those brushes with their types; null: not in the Brushes panel), panelBrushNames (the Brushes panel's brushes), repeatObjects: [{id, name, type: radial|grid|mirror, instances, rows?, cols?}] (the Repeat objects, those in groups and other repeats included; with selectionOnly: those in the selection), spotObjects: [{id, name, spotColors}] (the objects filled or stroked with a spot color swatch, as a solid color or in the stops of a gradient that color a part of it above opacity 0 (a stop at opacity 0 counts only where it mixes with a stop above opacity 0 over a stretch of some width), at a tint above 0, and grayscale images colorized with one, each once, by the rules patternObjects follows, with the spot colors they use; Registration and process colors are not spot colors; objects.spots counts them), spotColorNames and spotColors (the spot colors those objects use), patternObjects: [{id, name, patterns}] (the objects filled or stroked with a pattern, each once, those in groups and type whose drawn characters use one included, hidden fills and strokes, fills and strokes at an opacity of 0, strokes with no width, guides, compound path members' own fills and strokes, images' fills and strokes without a shape and characters that draw nothing left out, with the patterns they use, which objects.patterns counts; with selectionOnly: those in the selection), patternNames (the patterns those objects use), gradientObjects: [{id, name, gradients, kinds}] (the objects filled or stroked with a gradient, by the same rules, with the gradients they use: a linked gradient swatch's name, else its kind's name, such as Linear gradient; kinds gives each one's kind, linear|radial|conic|diamond|freeform, when it is named by its kind, else null; objects.gradients counts them), gradientNames (the gradients those objects use), …, sections: [{id, title, rows: [[label, value]]}] (the panel's categories; fontDetails: each font's file and whether its license lets it be embedded)}. An image linked to a file outside the automation read roots has link null, and its Linked Images row names the file alone. brushNames, brushes, spotObjects, patternObjects and gradientObjects leave out hidden objects, objects at an opacity of 0 and the objects inside a hidden group or layer or one at an opacity of 0 (with selectionOnly too), their characters' paints and colorized images included; objects still counts them as paths, groups and the other kinds", + "{selectionOnly?, category?: document|objects|graphicStyles|brushes|spotColors|patterns|gradients|symbols|fonts|fontDetails|linkedImages|embeddedImages|repeats (only that one in sections and the text), format?: \"text\" (→ {text}: the report Document Info › Save… and Package write)} → {document: {…, units (English), unitId: the units' Preferences › Units id (points, millimeters, feetInches, …), rasterEffectsPpi}, objects: {paths, compoundPaths, groups, …}, pathLength: pt (the paths' total length, compound paths' included, guides left out), fonts (the type in opacity masks and in the art of symbols and patterns included; with selectionOnly: the selected type's), fontUses: [{font, type: truetype|opentype|unknown, uses}] (each font of fonts, in order: truetype or opentype by the outlines (glyf, or CFF or CFF2) of the face its type is drawn in, unknown for a font not installed in the family and style it names; uses: the text objects set in it, each once however many of its runs use the font, the type in a mask or in a symbol's or pattern's art once however many objects show it; the fonts category's rows give them as `TrueType; 2 uses`), fontDetails: [{font, match: exact|style|missingWithFallback|missing, family, style, file, embedding: allowed|editing|previewPrint|forbidden|null}] (each font of fonts, in order: how it was found, the face shown (null when none), that face's file name (null for a built-in face) and what its license allows), images, imageObjects: [{name, width, height, linked, file}] (the image objects in the order Linked Images and Embedded Images list them; file: what a linked image's row shows, null for an embedded one), swatches, graphicStyleNames (with selectionOnly: the styles the selected objects are linked to), brushNames (the brushes the art's drawn strokes use, each once; with selectionOnly: those the selected objects' strokes use), brushes: [{name, type: calligraphic|scatter|art|pattern|bristle|null}] (those brushes with their types; null: not in the Brushes panel), panelBrushNames (the Brushes panel's brushes), repeatObjects: [{id, name, type: radial|grid|mirror, instances, rows?, cols?}] (the Repeat objects, those in groups and other repeats included; with selectionOnly: those in the selection), spotObjects: [{id, name, spotColors}] (the objects filled or stroked with a spot color swatch, as a solid color or in the stops of a gradient that color a part of it above opacity 0 (a stop at opacity 0 counts only where it mixes with a stop above opacity 0 over a stretch of some width), at a tint above 0, and grayscale images colorized with one, each once, by the rules patternObjects follows, with the spot colors they use; Registration and process colors are not spot colors; objects.spots counts them), spotColorNames and spotColors (the spot colors those objects use), patternObjects: [{id, name, patterns}] (the objects filled or stroked with a pattern, each once, those in groups and type whose drawn characters use one included, hidden fills and strokes, fills and strokes at an opacity of 0, strokes with no width, guides, compound path members' own fills and strokes, images' fills and strokes without a shape and characters that draw nothing left out, with the patterns they use, which objects.patterns counts; with selectionOnly: those in the selection), patternNames (the patterns those objects use), gradientObjects: [{id, name, gradients, kinds}] (the objects filled or stroked with a gradient, by the same rules, with the gradients they use: a linked gradient swatch's name, else its kind's name, such as Linear gradient; kinds gives each one's kind, linear|radial|conic|diamond|freeform, when it is named by its kind, else null; objects.gradients counts them), gradientNames (the gradients those objects use), …, sections: [{id, title, rows: [[label, value]]}] (the panel's categories; fontDetails: each font's file and whether its license lets it be embedded)}. An image linked to a file outside the automation read roots has link null, and its Linked Images row names the file alone. brushNames, brushes, spotObjects, patternObjects and gradientObjects leave out hidden objects, objects at an opacity of 0 and the objects inside a hidden group or layer or one at an opacity of 0 (with selectionOnly too), their characters' paints and colorized images included; objects still counts them as paths, groups and the other kinds", has_doc, info ), @@ -144,6 +144,44 @@ fn font_detail(used: &super::fonts::UsedFont) -> (Value, (String, String)) { (entry, (label, detail)) } +/// The type of a font as Fonts lists it: `truetype` or `opentype` by the outlines of the face the +/// type is drawn in (in the version the type names), `unknown` for a font that is not installed in +/// the family and style it names, or whose face holds neither kind of outline. +fn font_type(used: &super::fonts::UsedFont) -> &'static str { + let db = vectorcraft_text::FontDb::global(); + let (family, style, version) = used; + match db.resolve(family, style) { + Some((f, vectorcraft_text::FontMatch::Exact)) => match db.face_version(family, style, version.as_deref()).unwrap_or(f).outline_format() { + Some(vectorcraft_text::OutlineFormat::TrueType) => "truetype", + Some(vectorcraft_text::OutlineFormat::Cff) => "opentype", + None => "unknown", + }, + _ => "unknown", + } +} + +/// A font as Fonts lists it: its `fontUses` entry and its row, which gives the font's type and its +/// number of uses (`uses`: the text objects set in it). +fn font_use(used: &super::fonts::UsedFont, uses: usize) -> (Value, (String, String)) { + let label = super::fonts::font_label(used); + let kind = font_type(used); + let name = match kind { + "truetype" => "TrueType", + "opentype" => "OpenType", + _ => "unknown type", + }; + let count = if uses == 1 { "1 use".to_string() } else { format!("{uses} uses") }; + (json!({ "font": label, "type": kind, "uses": uses }), (label, format!("{name}; {count}"))) +} + +/// Counts text object `t` once for each font its runs are set in. +fn count_fonts(fonts: &mut BTreeMap, t: &vectorcraft_doc::TextObject) { + let own: BTreeSet = t.runs.iter().map(|r| super::fonts::font_of(&r.style)).collect(); + for font in own { + *fonts.entry(font).or_default() += 1; + } +} + /// An image object as Document Info lists it: (name, width, height, linked file). type ImageRow = (String, u32, u32, Option); @@ -179,14 +217,14 @@ fn repeat_entry(d: &Document, n: &Node, spec: &RepeatSpec) -> (Value, (String, S } /// The Document Info categories of `d` (only `category` when given) from `info` (what -/// `document.info` reports), its fonts and their Font Details rows, its image objects, the rows of +/// `document.info` reports), the rows of its fonts and their Font Details rows, its image objects, the rows of /// the brushes its art uses, the rows of its Repeat objects and the rows of its objects filled or /// stroked with a spot color, with a pattern and with a gradient. #[allow(clippy::too_many_arguments)] fn sections( d: &Document, info: &Value, - fonts: &BTreeSet, + fonts: &[(String, String)], font_details: &[(String, String)], images: &[ImageRow], brushes: &[(String, String)], @@ -240,7 +278,7 @@ fn sections( "patterns" => pattern_objects.to_vec(), "gradients" => gradient_objects.to_vec(), "symbols" => names("symbols"), - "fonts" => fonts.iter().map(|f| (super::fonts::font_label(f), String::new())).collect(), + "fonts" => fonts.to_vec(), "fontDetails" => font_details.to_vec(), "linkedImages" => { images.iter().filter_map(|(name, w, h, link)| Some((name.clone(), format!("{w} × {h} px — {}", link.as_ref()?)))).collect() @@ -605,7 +643,8 @@ fn info(s: &mut Session, p: &Value) -> Result { // The paths' total length, as Document Info › Objects shows it (the length of a cut line, a // strip of LEDs along the letters, #1958). let mut path_length = 0.0; - let mut fonts = BTreeSet::new(); + // Each font with the number of text objects set in it. + let mut fonts: BTreeMap = BTreeMap::new(); let mut images: BTreeMap = BTreeMap::new(); let mut image_rows: Vec = vec![]; // Whether the request being served may read each linked file (a relative path read from the @@ -680,9 +719,7 @@ fn info(s: &mut Session, p: &Value) -> Result { } NodeKind::Compound { .. } => Some("compoundPaths"), NodeKind::Text(t) => { - for run in &t.runs { - fonts.insert((run.style.font_family.clone(), run.style.font_style.clone(), run.style.font_version.clone())); - } + count_fonts(&mut fonts, t); Some("textObjects") } NodeKind::Image(im) => { @@ -765,12 +802,16 @@ fn info(s: &mut Session, p: &Value) -> Result { } } // The document's fonts include those of the type in opacity masks and in the art of its - // symbols and patterns, as Find Font lists them. + // symbols and patterns, as Find Font lists them. Each of those text objects counts once, however + // many objects show it. if !selection_only { - fonts.extend(super::fonts::art_texts_of(d).into_iter().flat_map(|(_, t, _)| t.runs.iter().map(|r| super::fonts::font_of(&r.style)))); + for (_, t, _) in super::fonts::art_texts_of(d) { + count_fonts(&mut fonts, t); + } } - let font_names: Vec = fonts.iter().map(super::fonts::font_label).collect(); - let (font_entries, font_rows): (Vec, Vec<(String, String)>) = fonts.iter().map(font_detail).unzip(); + let font_names: Vec = fonts.keys().map(super::fonts::font_label).collect(); + let (font_uses, font_use_rows): (Vec, Vec<(String, String)>) = fonts.iter().map(|(f, n)| font_use(f, *n)).unzip(); + let (font_entries, font_rows): (Vec, Vec<(String, String)>) = fonts.keys().map(font_detail).unzip(); // The image objects in walk order, as Linked Images and Embedded Images list them: `file` is a // linked image's row value (its path, or its file name alone when the request may not read it), // and null for an embedded one. @@ -798,6 +839,7 @@ fn info(s: &mut Session, p: &Value) -> Result { "objects": counts, "pathLength": path_length, "fonts": font_names, + "fontUses": font_uses, "fontDetails": font_entries, "images": images, "imageObjects": image_objects, @@ -822,7 +864,8 @@ fn info(s: &mut Session, p: &Value) -> Result { }); // The document's name: its file's, else its title. out["document"]["name"] = json!(st.title()); - let sections = sections(d, &out, &fonts, &font_rows, &image_rows, &brush_rows, &repeat_rows, &spot_rows, &pattern_rows, &gradient_rows, category); + let sections = + sections(d, &out, &font_use_rows, &font_rows, &image_rows, &brush_rows, &repeat_rows, &spot_rows, &pattern_rows, &gradient_rows, category); if text { return Ok(json!({ "text": report_text(&st.title(), selection_only, §ions) })); } @@ -946,6 +989,67 @@ mod tests { assert_eq!(fonts(&mut s, json!({"selectionOnly": true})), json!(["Source Sans 3 Regular"])); } + /// Fonts gives each font's type and its number of uses: the text objects set in it, each once + /// however many of its runs use the font. The type in a symbol's art counts once however many + /// instances show it, and the type in an opacity mask once. With Selection Only it counts the + /// selected type alone. A font that is not installed has an unknown type. The rows, the report + /// and `fontUses` give the same facts, in the order of `fonts`. + #[test] + fn info_fonts_give_each_font_s_type_and_uses() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 200, "height": 200})).unwrap(); + let id = |v: Value| NodeId(v["id"].as_u64().unwrap()); + let text = + |s: &mut Session, font: &str, y: f64| id(s.execute("text.create", &json!({"x": 10, "y": y, "text": "Hello", "font": font})).unwrap()); + // Two runs in Source Sans 3 Regular in one text object, a second object in it, and one in Inter. + let twice = text(&mut s, "Source Sans 3", 20.0); + s.execute("text.setRangeStyle", &json!({"id": twice.0, "start": 0, "end": 2, "size": 30})).unwrap(); + assert!(matches!(&s.doc().unwrap().doc.node(twice).unwrap().kind, NodeKind::Text(t) if t.runs.len() == 2)); + let other = text(&mut s, "Source Sans 3", 50.0); + text(&mut s, "Inter", 80.0); + text(&mut s, "Qx Absent Family", 110.0); + // A symbol whose art holds type in Inter, shown by two instances, and a mask holding type in Inter. + let in_symbol = text(&mut s, "Inter", 140.0); + s.execute("symbol.new", &json!({"name": "Mark", "ids": [in_symbol.0]})).unwrap(); + s.execute("symbol.place", &json!({"name": "Mark", "x": 100, "y": 100})).unwrap(); + let masked = id(s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 10, "height": 10})).unwrap()); + let in_mask = text(&mut s, "Inter", 170.0); + s.edit("Mask", |d, _| { + let art = d.remove(in_mask)?; + d.node_mut(masked).unwrap().extras_mut().mask = Some(Box::new(vectorcraft_doc::OpacityMask::new((*art).clone(), true))); + Ok(()) + }) + .unwrap(); + let i = s.execute("document.info", &json!({"category": "fonts"})).unwrap(); + assert_eq!(i["fonts"], json!(["Inter Regular", "Qx Absent Family Regular", "Source Sans 3 Regular"])); + assert_eq!( + i["fontUses"], + json!([ + {"font": "Inter Regular", "type": "truetype", "uses": 3}, + {"font": "Qx Absent Family Regular", "type": "unknown", "uses": 1}, + {"font": "Source Sans 3 Regular", "type": "truetype", "uses": 2}, + ]) + ); + assert_eq!( + i["sections"][0]["rows"], + json!([ + ["Inter Regular", "TrueType; 3 uses"], + ["Qx Absent Family Regular", "unknown type; 1 use"], + ["Source Sans 3 Regular", "TrueType; 2 uses"], + ]) + ); + let report = s.execute("document.info", &json!({"category": "fonts", "format": "text"})).unwrap()["text"].as_str().unwrap().to_string(); + assert!(report.contains("\nFONTS\nInter Regular: TrueType; 3 uses\nQx Absent Family Regular: unknown type; 1 use\n"), "{report}"); + // Selection Only: the selected type's fonts and uses. + s.execute("select.set", &json!({"ids": [other.0]})).unwrap(); + let i = s.execute("document.info", &json!({"selectionOnly": true, "category": "fonts"})).unwrap(); + assert_eq!(i["fontUses"], json!([{"font": "Source Sans 3 Regular", "type": "truetype", "uses": 1}])); + assert_eq!(i["sections"][0]["rows"], json!([["Source Sans 3 Regular", "TrueType; 1 use"]])); + s.execute("select.none", &json!({})).unwrap(); + let i = s.execute("document.info", &json!({"selectionOnly": true, "category": "fonts"})).unwrap(); + assert_eq!((i["fontUses"].clone(), i["sections"][0]["rows"].clone()), (json!([]), json!([]))); + } + /// Document Info › Objects gives the paths' total length in the document's units (#1958): an /// open line, a closed rectangle's perimeter and a compound path's pieces count, a guide doesn't. #[test] diff --git a/crates/text/src/fontdb.rs b/crates/text/src/fontdb.rs index f315f2bb69..3654088be2 100644 --- a/crates/text/src/fontdb.rs +++ b/crates/text/src/fontdb.rs @@ -52,7 +52,7 @@ use face::Instances; #[cfg(test)] pub(crate) use face::MAX_LIVE_INSTANCES; pub(crate) use face::PathAlignHeights; -pub use face::{FALLBACK_FAMILY, FontFace, IcfMargins}; +pub use face::{FALLBACK_FAMILY, FontFace, IcfMargins, OutlineFormat}; pub(crate) use glyph_pen::FlipPen; pub use gsub::{GlyphOrigin, JoiningPosition, Substitution, SubstitutionKind}; #[cfg(not(target_arch = "wasm32"))] diff --git a/crates/text/src/fontdb/face.rs b/crates/text/src/fontdb/face.rs index ff9ad8d58f..ed26fbb861 100644 --- a/crates/text/src/fontdb/face.rs +++ b/crates/text/src/fontdb/face.rs @@ -715,4 +715,54 @@ impl FontFace { use skrifa::raw::TableProvider; self.skrifa().is_some_and(|f| f.glyf().is_ok()) } + /// The kind of outlines the face's glyphs are drawn from ([`outline_format_of`]). + pub fn outline_format(&self) -> Option { + self.skrifa().and_then(|f| outline_format_of(&f)) + } +} + +/// The kind of outlines a face's glyphs are drawn from. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum OutlineFormat { + /// Quadratic outlines in a `glyf` table. + TrueType, + /// PostScript outlines in a `CFF ` or `CFF2` table. + Cff, +} + +/// The kind of outlines `font`'s glyphs are drawn from: TrueType when it has a `glyf` table, else +/// CFF when it has a `CFF ` or `CFF2` table. None for a font with neither (outlines in `VARC` +/// alone, color bitmaps only). +pub(crate) fn outline_format_of(font: &skrifa::FontRef<'_>) -> Option { + let has = |tag: &[u8; 4]| font.table_data(skrifa::Tag::new(tag)).is_some(); + if has(b"glyf") { + Some(OutlineFormat::TrueType) + } else if has(b"CFF ") || has(b"CFF2") { + Some(OutlineFormat::Cff) + } else { + None + } +} + +#[cfg(test)] +mod tests { + use super::*; + + /// The outline format comes from the tables the font holds. + #[test] + fn outline_format_follows_the_outline_tables() { + let format = |tables: &[(&[u8; 4], &[u8])]| { + let font = crate::fontdb::sfnt_of(tables).unwrap_or_default(); + outline_format_of(&skrifa::FontRef::new(&font).unwrap()) + }; + let table = [0_u8; 4]; + assert_eq!(format(&[(b"glyf", &table), (b"loca", &table)]), Some(OutlineFormat::TrueType)); + assert_eq!(format(&[(b"CFF ", &table)]), Some(OutlineFormat::Cff)); + assert_eq!(format(&[(b"CFF2", &table)]), Some(OutlineFormat::Cff)); + assert_eq!(format(&[(b"VARC", &table)]), None); + assert_eq!(format(&[(b"sbix", &table)]), None); + // The built-in faces are TrueType. + let face = crate::FontDb::global().resolve("Source Sans 3", "Regular").map(|(f, _)| f).unwrap(); + assert_eq!(face.outline_format(), Some(OutlineFormat::TrueType)); + } } diff --git a/crates/text/src/lib.rs b/crates/text/src/lib.rs index 6ae85931ca..3c7bf09d72 100644 --- a/crates/text/src/lib.rs +++ b/crates/text/src/lib.rs @@ -42,9 +42,9 @@ pub use features::{ }; pub use fontdb::{ CompositeCoverage, FALLBACK_FAMILY, FontClass, FontDb, FontFace, FontMatch, FontTraits, GlyphAlternate, GlyphOrigin, IcfMargins, JoiningPosition, - LentCompositeFonts, PlatformFontFiles, StylisticSet, Substitution, SubstitutionKind, WantedFont, WantedFonts, app_font_dir, is_font_file, - is_suitcase, set_app_font_dir, set_platform_font_files, set_user_font_dirs, set_user_font_dirs_confined, style_weight, system_font_dirs, - user_font_dirs, + LentCompositeFonts, OutlineFormat, PlatformFontFiles, StylisticSet, Substitution, SubstitutionKind, WantedFont, WantedFonts, app_font_dir, + is_font_file, is_suitcase, set_app_font_dir, set_platform_font_files, set_user_font_dirs, set_user_font_dirs_confined, style_weight, + system_font_dirs, user_font_dirs, }; pub use hyphen::{hyphenation_exceptions, set_hyphenation_exceptions}; pub use layout::{envelope_ink, layout_inputs, register_envelope_ink}; diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 4b5982cecd..50ec98b51b 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -2126,6 +2126,9 @@ font-technology Variable Променливи embedding for preview and print вграждане за преглед и печат embedding allowed вграждането е разрешено {file}; {embedding} {file}; {embedding} + unknown type неизвестен тип + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} употреба|{n} употреби substituted: shown in {family} {style} ({detail}) заместен: показан с {family} {style} ({detail}) missing: shown in {family} {style} липсва: показан с {family} {style} missing липсва diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 1576b72373..bbef219a16 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -3363,6 +3363,9 @@ theme Appearance Izgled embedding for preview and print ugrađivanje za pregled i štampu embedding allowed ugrađivanje dozvoljeno {file}; {embedding} {file}; {embedding} + unknown type nepoznata vrsta + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} upotreba|{n} upotrebe|{n} upotreba substituted: shown in {family} {style} ({detail}) zamijenjen: prikazan fontom {family} {style} ({detail}) missing: shown in {family} {style} nedostaje: prikazan fontom {family} {style} missing nedostaje diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index c098a7cb4b..67dcb3a441 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -3121,6 +3121,9 @@ digits Malayalam Malaiàlam embedding for preview and print incrustació per a la visualització i la impressió embedding allowed incrustació permesa {file}; {embedding} {file}; {embedding} + unknown type tipus desconegut + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} ús|{n} usos substituted: shown in {family} {style} ({detail}) substituït: es mostra amb {family} {style} ({detail}) missing: shown in {family} {style} absent: es mostra amb {family} {style} missing absent diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index bfe8615b9c..982f804903 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -3413,6 +3413,9 @@ theme Appearance Motiv embedding for preview and print vkládání pro náhled a tisk embedding allowed vkládání povoleno {file}; {embedding} {file}; {embedding} + unknown type neznámý typ + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} použití|{n} použití|{n} použití substituted: shown in {family} {style} ({detail}) nahrazeno: zobrazeno písmem {family} {style} ({detail}) missing: shown in {family} {style} chybí: zobrazeno písmem {family} {style} missing chybí diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 5fad269299..9ff370dee3 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -3146,6 +3146,9 @@ theme Appearance Udseende embedding for preview and print indlejring til visning og udskrivning embedding allowed indlejring tilladt {file}; {embedding} {file}; {embedding} + unknown type ukendt type + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} anvendelse|{n} anvendelser substituted: shown in {family} {style} ({detail}) erstattet: vist med {family} {style} ({detail}) missing: shown in {family} {style} mangler: vist med {family} {style} missing mangler diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index e33ed2a7a9..2cc19d35d8 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -2160,6 +2160,9 @@ file-filter Templates Vorlagen embedding for preview and print Einbetten für Vorschau und Druck embedding allowed Einbetten erlaubt {file}; {embedding} {file}; {embedding} + unknown type unbekannter Typ + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} Verwendung|{n} Verwendungen substituted: shown in {family} {style} ({detail}) ersetzt: angezeigt in {family} {style} ({detail}) missing: shown in {family} {style} fehlt: angezeigt in {family} {style} missing fehlt diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 9ff2eae9a2..d308cc476a 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -1833,6 +1833,9 @@ font-technology Variable Μεταβλητές embedding for preview and print ενσωμάτωση για προεπισκόπηση και εκτύπωση embedding allowed η ενσωμάτωση επιτρέπεται {file}; {embedding} {file}· {embedding} + unknown type άγνωστος τύπος + {type}; {uses} {type}· {uses} +@plural {n} use|{n} uses {n} χρήση|{n} χρήσεις substituted: shown in {family} {style} ({detail}) αντικαταστάθηκε: εμφανίζεται με {family} {style} ({detail}) missing: shown in {family} {style} λείπει: εμφανίζεται με {family} {style} missing λείπει diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index e51ba240a8..12f1ba05fe 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -2198,6 +2198,9 @@ font-technology Variable Variables embedding for preview and print incrustación para vista previa e impresión embedding allowed incrustación permitida {file}; {embedding} {file}; {embedding} + unknown type tipo desconocido + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} uso|{n} usos substituted: shown in {family} {style} ({detail}) sustituida: se muestra con {family} {style} ({detail}) missing: shown in {family} {style} falta: se muestra con {family} {style} missing falta diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 36f4c9f5a9..eca90c5bae 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -3352,6 +3352,9 @@ theme Appearance Ulkoasu embedding for preview and print upottaminen esikatselua ja tulostusta varten embedding allowed upottaminen sallittu {file}; {embedding} {file}; {embedding} + unknown type tuntematon tyyppi + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} käyttö|{n} käyttöä substituted: shown in {family} {style} ({detail}) korvattu: näytetään fontilla {family} {style} ({detail}) missing: shown in {family} {style} puuttuu: näytetään fontilla {family} {style} missing puuttuu diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index a3d1c9b785..26949dca5b 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -2190,6 +2190,9 @@ font-technology Variable Variables embedding for preview and print incorporation pour l’aperçu et l’impression embedding allowed incorporation autorisée {file}; {embedding} {file}, {embedding} + unknown type type inconnu + {type}; {uses} {type}, {uses} +@plural {n} use|{n} uses {n} utilisation|{n} utilisations substituted: shown in {family} {style} ({detail}) remplacée, affichée en {family} {style} ({detail}) missing: shown in {family} {style} absente, affichée en {family} {style} missing absente diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index 716d851655..6e73d572e3 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -4551,6 +4551,9 @@ antiAlias Sharp શાર્પ embedding for preview and print પ્રીવ્યૂ અને પ્રિન્ટ માટે એમ્બેડ કરવાની મંજૂરી embedding allowed એમ્બેડ કરવાની મંજૂરી છે {file}; {embedding} {file}; {embedding} + unknown type અજ્ઞાત પ્રકાર + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} ઉપયોગ|{n} ઉપયોગ substituted: shown in {family} {style} ({detail}) બદલાયેલ: {family} {style}માં બતાવ્યું ({detail}) missing: shown in {family} {style} ગુમ: {family} {style}માં બતાવ્યું missing ગુમ diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index dff4c3503c..12821aecf4 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -3403,6 +3403,9 @@ antiAlias Sharp शार्प embedding for preview and print पूर्वावलोकन और प्रिंट के लिए एम्बेडिंग embedding allowed एम्बेडिंग की अनुमति है {file}; {embedding} {file}; {embedding} + unknown type अज्ञात प्रकार + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} उपयोग|{n} उपयोग substituted: shown in {family} {style} ({detail}) प्रतिस्थापित: {family} {style} में दिखाया गया ({detail}) missing: shown in {family} {style} अनुपलब्ध: {family} {style} में दिखाया गया missing अनुपलब्ध diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 8549bd5d63..e63c7549c5 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -3015,6 +3015,9 @@ file-filter Templates Sablonok embedding for preview and print beágyazás előnézethez és nyomtatáshoz embedding allowed beágyazás engedélyezett {file}; {embedding} {file}; {embedding} + unknown type ismeretlen típus + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} használat substituted: shown in {family} {style} ({detail}) helyettesítve: megjelenítés ezzel: {family} {style} ({detail}) missing: shown in {family} {style} hiányzik: megjelenítés ezzel: {family} {style} missing hiányzik diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index e27253376e..28c02e710a 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -3146,6 +3146,9 @@ theme Appearance Tampilan embedding for preview and print penyematan untuk pratinjau dan cetak embedding allowed penyematan diizinkan {file}; {embedding} {file}; {embedding} + unknown type jenis tidak dikenal + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} penggunaan substituted: shown in {family} {style} ({detail}) diganti: ditampilkan dengan {family} {style} ({detail}) missing: shown in {family} {style} tidak ada: ditampilkan dengan {family} {style} missing tidak ada diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 2381051c9b..d3ff698bc4 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -2236,6 +2236,9 @@ file-filter Templates Modelli embedding for preview and print incorporamento per anteprima e stampa embedding allowed incorporamento consentito {file}; {embedding} {file}; {embedding} + unknown type tipo sconosciuto + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} utilizzo|{n} utilizzi substituted: shown in {family} {style} ({detail}) sostituito: mostrato con {family} {style} ({detail}) missing: shown in {family} {style} mancante: mostrato con {family} {style} missing mancante diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 1458bf2aa1..1a79ee21c2 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -2445,6 +2445,9 @@ antiAlias Sharp シャープ embedding for preview and print プレビューと印刷用に埋め込み可 embedding allowed 埋め込み可 {file}; {embedding} {file}、{embedding} + unknown type 不明な種類 + {type}; {uses} {type}、{uses} +@plural {n} use|{n} uses 使用 {n} 回 substituted: shown in {family} {style} ({detail}) 代替: {family} {style} で表示 ({detail}) missing: shown in {family} {style} 見つかりません: {family} {style} で表示 missing 見つかりません diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 9105fe50e7..e3af2f8dce 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -2989,6 +2989,9 @@ theme Appearance იერსახე embedding for preview and print ჩაშენება გადახედვისა და ბეჭდვისთვის embedding allowed ჩაშენება დაშვებულია {file}; {embedding} {file}; {embedding} + unknown type უცნობი ტიპი + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} გამოყენება substituted: shown in {family} {style} ({detail}) ჩანაცვლებულია: ნაჩვენებია შრიფტით {family} {style} ({detail}) missing: shown in {family} {style} აკლია: ნაჩვენებია შრიფტით {family} {style} missing აკლია diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index fd75f983ce..331c17ef9c 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -2435,6 +2435,9 @@ antiAlias Sharp 날카롭게 embedding for preview and print 미리 보기 및 인쇄용 포함 embedding allowed 포함 허용 {file}; {embedding} {file}; {embedding} + unknown type 알 수 없는 유형 + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n}회 사용 substituted: shown in {family} {style} ({detail}) 대체됨: {family} {style}(으)로 표시({detail}) missing: shown in {family} {style} 없음: {family} {style}(으)로 표시 missing 없음 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index cd3aa43966..c95f7f4090 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -3663,6 +3663,9 @@ theme Appearance Vormgeving embedding for preview and print insluiten voor voorvertoning en afdrukken embedding allowed insluiten toegestaan {file}; {embedding} {file}; {embedding} + unknown type onbekend type + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} keer gebruikt|{n} keer gebruikt substituted: shown in {family} {style} ({detail}) vervangen: weergegeven in {family} {style} ({detail}) missing: shown in {family} {style} ontbreekt: weergegeven in {family} {style} missing ontbreekt diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 5f274cef09..5e02b82ff7 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -3292,6 +3292,9 @@ theme Appearance Wygląd embedding for preview and print osadzanie do podglądu i drukowania embedding allowed osadzanie dozwolone {file}; {embedding} {file}; {embedding} + unknown type nieznany typ + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} użycie|{n} użycia|{n} użyć substituted: shown in {family} {style} ({detail}) zastąpiony: wyświetlany krojem {family} {style} ({detail}) missing: shown in {family} {style} brak: wyświetlany krojem {family} {style} missing brak diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index a9e56041f4..392734e249 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -1807,6 +1807,9 @@ antiAlias Sharp Nítido embedding for preview and print incorporação para visualização e impressão embedding allowed incorporação permitida {file}; {embedding} {file}; {embedding} + unknown type tipo desconhecido + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} uso|{n} usos substituted: shown in {family} {style} ({detail}) substituída: exibida em {family} {style} ({detail}) missing: shown in {family} {style} ausente: exibida em {family} {style} missing ausente diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 4ea3511c36..888e7d653e 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -2223,6 +2223,9 @@ file-filter Templates Шаблоны embedding for preview and print внедрение для просмотра и печати embedding allowed внедрение разрешено {file}; {embedding} {file}; {embedding} + unknown type неизвестный тип + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} использование|{n} использования|{n} использований substituted: shown in {family} {style} ({detail}) заменен: показан шрифтом {family} {style} ({detail}) missing: shown in {family} {style} отсутствует: показан шрифтом {family} {style} missing отсутствует diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 9a0de40468..ad3a7e5ef8 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -2137,6 +2137,9 @@ font-technology Variable Variabla embedding for preview and print inbäddning för förhandsvisning och utskrift embedding allowed inbäddning tillåten {file}; {embedding} {file}; {embedding} + unknown type okänd typ + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} användning|{n} användningar substituted: shown in {family} {style} ({detail}) ersatt: visas med {family} {style} ({detail}) missing: shown in {family} {style} saknas: visas med {family} {style} missing saknas diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 4f9f03e5f6..9b245e2975 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -490,10 +490,13 @@ fn document_info_labels_are_in_complete_catalogs() { /// The values Document Info makes and shows in the interface language: the font states and /// embedding permissions, the templates of the font, image, raster effects and Repeat object -/// values, the names of gradients named by their kind, and the counted instances, rows and columns. +/// values, the names of gradients named by their kind, and the counted uses, instances, rows and +/// columns. #[test] fn document_info_values_are_in_complete_catalogs() { - const VALUES: [&str; 20] = [ + const VALUES: [&str; 22] = [ + "unknown type", + "{type}; {uses}", "built in", "embedding not allowed", "embedding for editing", @@ -515,7 +518,8 @@ fn document_info_values_are_in_complete_catalogs() { "Diamond gradient", "Freeform gradient", ]; - const COUNTED: [(&str, &str); 3] = [("{n} instance", "{n} instances"), ("{n} row", "{n} rows"), ("{n} column", "{n} columns")]; + const COUNTED: [(&str, &str); 4] = + [("{n} use", "{n} uses"), ("{n} instance", "{n} instances"), ("{n} row", "{n} rows"), ("{n} column", "{n} columns")]; let gradient_kinds: Vec = vectorcraft_color::GradientKind::ALL.iter().map(|k| format!("{} gradient", k.label())).collect(); assert!(gradient_kinds.iter().all(|k| VALUES.contains(&k.as_str())), "{gradient_kinds:?}"); for lang in LANGUAGES.iter().filter(|lang| lang.complete_menus) { diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index a457467ef6..2a5ef0eb25 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -6148,6 +6148,9 @@ theme Appearance Görünüm embedding for preview and print önizleme ve yazdırma için gömme embedding allowed gömmeye izin veriliyor {file}; {embedding} {file}; {embedding} + unknown type bilinmeyen tür + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} kullanım substituted: shown in {family} {style} ({detail}) yerine konan: {family} {style} ile gösteriliyor ({detail}) missing: shown in {family} {style} eksik: {family} {style} ile gösteriliyor missing eksik diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 18a118822f..bdec0ad59f 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -2228,6 +2228,9 @@ file-filter Templates Шаблони embedding for preview and print вбудовування для перегляду й друку embedding allowed вбудовування дозволено {file}; {embedding} {file}; {embedding} + unknown type невідомий тип + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} використання|{n} використання|{n} використань substituted: shown in {family} {style} ({detail}) замінено: показано шрифтом {family} {style} ({detail}) missing: shown in {family} {style} відсутній: показано шрифтом {family} {style} missing відсутній diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index db36624af7..8d0d6086e6 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -2832,6 +2832,9 @@ digits Hindi Hindi embedding for preview and print nhúng để xem trước và in embedding allowed cho phép nhúng {file}; {embedding} {file}; {embedding} + unknown type loại không xác định + {type}; {uses} {type}; {uses} +@plural {n} use|{n} uses {n} lần dùng substituted: shown in {family} {style} ({detail}) đã thay thế: hiển thị bằng {family} {style} ({detail}) missing: shown in {family} {style} thiếu: hiển thị bằng {family} {style} missing thiếu diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 70d971c848..2fe5e9233a 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -2093,6 +2093,9 @@ file-filter Templates 模板 embedding for preview and print 允许嵌入以供预览和打印 embedding allowed 允许嵌入 {file}; {embedding} {file};{embedding} + unknown type 未知类型 + {type}; {uses} {type};{uses} +@plural {n} use|{n} uses 使用 {n} 次 substituted: shown in {family} {style} ({detail}) 已替换:以 {family} {style} 显示 ({detail}) missing: shown in {family} {style} 缺失:以 {family} {style} 显示 missing 缺失 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index e72c0d1a0d..46db91d962 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -3302,6 +3302,9 @@ file-filter Templates 範本 embedding for preview and print 允許內嵌以供預覽和列印 embedding allowed 允許內嵌 {file}; {embedding} {file};{embedding} + unknown type 未知類型 + {type}; {uses} {type};{uses} +@plural {n} use|{n} uses 使用 {n} 次 substituted: shown in {family} {style} ({detail}) 已替代:以 {family} {style} 顯示 ({detail}) missing: shown in {family} {style} 遺失:以 {family} {style} 顯示 missing 遺失 diff --git a/crates/ui-egui/src/panels/doc_info.rs b/crates/ui-egui/src/panels/doc_info.rs index 64144a2150..13ca4800cd 100644 --- a/crates/ui-egui/src/panels/doc_info.rs +++ b/crates/ui-egui/src/panels/doc_info.rs @@ -104,7 +104,7 @@ fn brush_value(value: &str) -> &str { /// Row `k` of Document Info section `id` (`label` and `value` as `document.info` gives them, the /// label a name when `named`) with its value in the interface language, built from what /// `document.info` (`info`) gives as values: the -/// units, the raster effects resolution, each brush's type, each font's file, match and +/// units, the raster effects resolution, each brush's type, each font's type and uses, each font's file, match and /// embedding permission, each image's size and file, each Repeat object's kind and counts, and the /// kinds of the gradients no swatch names. Names (fonts, files, faces, swatches) stay as they are. /// None when the row's value is shown as `document.info` gives it, or the values do not match the @@ -124,6 +124,7 @@ fn shown_value(info: &Value, id: &str, k: usize, (label, value): (&str, &str), n _ => None, }, "brushes" => Some(brush_value(value).to_string()), + "fonts" => font_use_value(entry("fontUses")?), "fontDetails" => font_detail_value(entry("fontDetails")?), "linkedImages" | "embeddedImages" => { let linked = id == "linkedImages"; @@ -141,6 +142,19 @@ fn fill(template: &str, args: &[(&str, &str)]) -> String { crate::i18n::fill_once(template, args) } +/// A `fontUses` entry as Fonts shows it: the font's type (the format names TrueType and OpenType +/// stay as they are) and its number of uses in the language's plural forms. +fn font_use_value(e: &Value) -> Option { + let kind = match e["type"].as_str()? { + "truetype" => "TrueType", + "opentype" => "OpenType", + "unknown" => tl!("unknown type"), + _ => return None, + }; + let uses = crate::i18n::tn(e["uses"].as_u64()?, "{n} use", "{n} uses"); + Some(fill(tl!("{type}; {uses}"), &[("type", kind), ("uses", &uses)])) +} + /// A `fontDetails` entry as Font Details shows it: the font's file (or that it is built in) and /// what its license allows, the face shown in place of a style the family lacks, the face shown in /// place of a font that is not installed, or that it is missing. @@ -416,7 +430,7 @@ mod tests { assert!(objects.contains("\nOBJECTS\n") && objects.contains("Paths: 1") && objects.contains("Text Objects: 1"), "{objects}"); assert!(!objects.contains("\nDOCUMENT\n") && !objects.contains("\nFONTS\n"), "only Objects: {objects}"); let fonts = saved_from_menu(&mut app, "fonts", false); - assert!(fonts.contains("\nFONTS\n") && fonts.contains("Source Sans 3"), "{fonts}"); + assert!(fonts.contains("\nFONTS\nSource Sans 3 Regular: TrueType; 1 use\n"), "{fonts}"); assert!(!fonts.contains("\nOBJECTS\n") && !fonts.contains("\nFONT DETAILS\n"), "only Fonts: {fonts}"); let all = saved_from_menu(&mut app, "", false); assert!( @@ -553,6 +567,49 @@ mod tests { assert!(report.contains("Units: Millimeters\n") && report.contains("Radial Repeat, 6 instances"), "{report}"); } + /// Fonts shows each font's type and number of uses in the interface language, in the + /// language's plural forms; the format names TrueType and OpenType and the font names stay as + /// they are, and `document.info` and the saved report keep the English values. + #[test] + fn font_types_and_uses_show_in_the_interface_language() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 100, "height": 100})).unwrap(); + app.session.execute("text.create", &json!({"x": 10, "y": 20, "text": "Hi"})).unwrap(); + app.session.execute("text.create", &json!({"x": 10, "y": 50, "text": "Hi"})).unwrap(); + app.session.execute("text.create", &json!({"x": 10, "y": 80, "text": "Gone", "font": "Qx Absent Family"})).unwrap(); + let info = app.session.execute("document.info", &json!({})).unwrap(); + let rows = |info: &Value| shown_rows(info, "fonts"); + let english = vec![ + ("Qx Absent Family Regular".to_string(), "unknown type; 1 use".to_string()), + ("Source Sans 3 Regular".into(), "TrueType; 2 uses".into()), + ]; + assert_eq!(rows(&info), english); + let fonts = |app: &mut VectorcraftApp| { + crate::tests_labels::painted_text(app, |app, ui| { + set_pstate(ui.ctx(), "docinfo-category", "fonts".to_string()); + show(app, ui); + }) + }; + let Some(de) = crate::i18n::Lang::from_code("de") else { panic!("no German catalog") }; + crate::i18n::set_current(de); + let (german, painted) = (rows(&info), fonts(&mut app)); + let one_opentype = font_use_value(&json!({"type": "opentype", "uses": 1})); + let Some(ru) = crate::i18n::Lang::from_code("ru") else { panic!("no Russian catalog") }; + crate::i18n::set_current(ru); + let russian = [1, 3, 5].map(|n| font_use_value(&json!({"type": "truetype", "uses": n}))); + crate::i18n::set_current(crate::i18n::Lang::EN); + assert_eq!(german[0], ("Qx Absent Family Regular".to_string(), "unbekannter Typ; 1 Verwendung".to_string())); + assert_eq!(german[1], ("Source Sans 3 Regular".to_string(), "TrueType; 2 Verwendungen".to_string())); + assert!(painted.contains("Source Sans 3 Regular") && painted.contains("TrueType; 2 Verwendungen"), "{painted}"); + assert_eq!(one_opentype.as_deref(), Some("OpenType; 1 Verwendung")); + assert_eq!(russian.map(Option::unwrap_or_default), ["TrueType; 1 использование", "TrueType; 3 использования", "TrueType; 5 использований"]); + // An unknown type id is shown as `document.info` gives the row. + assert_eq!(font_use_value(&json!({"type": "bitmap", "uses": 1})), None); + let report = + app.session.execute("document.info", &json!({"category": "fonts", "format": "text"})).unwrap()["text"].as_str().unwrap().to_string(); + assert!(report.contains("Source Sans 3 Regular: TrueType; 2 uses\n"), "{report}"); + } + /// A Repeat object's counts take each language's plural forms, and a grid that draws fewer /// instances than its rows and columns give is followed by the number it draws. #[test] diff --git a/docs/mcp.md b/docs/mcp.md index 1ad05ba3df..502751fb27 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -7341,8 +7341,12 @@ result carries the same files as a zip (`{name: ".zip", dataBase64}`, entr document, objects, graphicStyles, brushes, spotColors, patterns, gradients, symbols, fonts, fontDetails, linkedImages, embeddedImages, repeats), `fonts` (the fonts the document's type uses, the type in opacity masks and in the art of its symbols and pattern swatches included, which the fonts and fontDetails categories list; with `selectionOnly`, the -fonts of the selected type), `fontDetails` (`[{font, match, family, style, file, embedding}]`: each font of `fonts`, -in order, as the fontDetails category's rows give it: `match` is `exact`, `style` (a style the family lacks, shown in +fonts of the selected type), `fontUses` (`[{font, type, uses}]`: each font of `fonts`, in order, as the fonts +category's rows give it, such as `TrueType; 2 uses`: `type` is `truetype` or `opentype` by the outlines of the face +the type is drawn in (`glyf`, or `CFF` or `CFF2`), `unknown` for a font not installed in the family and style it +names; `uses` is the number of text objects set in the font, each counted once however many of its runs use it, the +type in a mask or in a symbol's or pattern's art once however many objects show it), `fontDetails` +(`[{font, match, family, style, file, embedding}]`: each font of `fonts`, in order, as the fontDetails category's rows give it: `match` is `exact`, `style` (a style the family lacks, shown in `family` `style`), `missingWithFallback` (not installed, shown in `family` `style`) or `missing`; `file` is the face's file name, null for a built-in face; `embedding` is `allowed`, `editing`, `previewPrint` or `forbidden`, null when no face is found), `imageObjects` (`[{name, width, height, linked, file}]`: the image objects in the order the diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index b53dab0d21..cd5510a97e 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1546,6 +1546,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur In the Brushes panel, Shift-click selects a range of brushes and Ctrl/Cmd-click adds or removes one. Delete Brush and Duplicate Brush then act on all of them (`brush.delete {names}`, `brush.duplicate {names}`). The Brushes panel's Delete Brush button and panel menu item ask "Delete the selected brushes?" with Yes and No when none of the brushes is in use. Alt-click (Option-click on macOS) on the button deletes them without asking, as the [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists for panel deletion outside the Layers panel (archived copy). When a stroke uses one of the brushes, the button, Alt-click and the menu item all ask with Remove Strokes and Cancel; Remove Strokes deletes the brushes and the strokes that used them become plain strokes. Tests: `panels::brushes::tests`, `dialogs::brush_delete::tests`. Document Info has a Brushes category after Graphic Styles. It lists the names and types of the brushes applied to the artwork, as the [Document Info panel](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/document-info-panel.html) page describes, or with Selection Only the brushes that the selected objects' strokes use. The Document Info report and Package's report list them too (`document.info {category: "brushes"}`, `brushNames`, `brushes`). Listing each brush once, leaving out the Brushes panel's brushes no art uses (`panelBrushNames` lists the panel's brushes), hidden strokes, strokes at an opacity of 0, strokes with no paint or width, guides, paths with no segment, type that draws no characters, a group's or layer's own strokes, a compound path member's own strokes and an image's strokes without a shape, and listing a brush the panel does not hold as missing, are VectorCraft's own rules. Tests: `cmd::docinfo::tests::info_lists_the_brushes` and `info_brushes_skip_undrawn_strokes_and_name_missing_brushes` (vectorcraft-engine). + Document Info's Fonts category gives each font's type and number of uses beside its name, as the [help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/document-info-panel.html) describes, for the whole document or with Selection Only for the selected type. The Document Info report and Package's report give them too (`document.info {category: "fonts"}`, `fontUses`), and the panel shows the type and count in the interface language. Counting a use as a text object set in the font (once however many of its runs use it, and the type in a mask or in a symbol's or pattern's art once however many objects show it), naming the type by the face's outlines (TrueType for `glyf`, OpenType for `CFF` or `CFF2`) and showing an unknown type for a font that is not installed in the family and style the type names are VectorCraft's own rules. Tests: `cmd::docinfo::tests::info_fonts_give_each_font_s_type_and_uses` (vectorcraft-engine), `panels::doc_info::tests::font_types_and_uses_show_in_the_interface_language` (vectorcraft-ui-egui), `fontdb::face::tests::outline_format_follows_the_outline_tables` (vectorcraft-text). Document Info has a Repeat Objects category after Embedded Images. It lists each radial, grid and mirror Repeat object by name with its kind and the number of instances it makes. For a grid it gives the rows and columns instead, followed by the number of instances it draws when that is fewer. With Selection Only it lists the Repeat objects in the selection. The Document Info report and Package's report list them too (`document.info {category: "repeats"}`, `repeatObjects`). Document Info's Pattern Objects category lists the objects whose fill or stroke is a pattern, the category the [Document Info panel](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/document-info-panel.html) page describes, each by name with the patterns it uses. With Selection Only it lists those in the selection, and the Document Info report and Package's report list them too (`document.info {category: "patterns"}`, `patternObjects`). Listing an object with a pattern fill and a pattern stroke once, listing objects inside groups and type objects whose characters use a pattern, and leaving out hidden fills and strokes, fills and strokes at an opacity of 0, strokes with no width, guides, a compound path member's own fills and strokes, an image's fills and strokes without a shape, characters the type does not draw and patterns no art uses, and counting the listed objects in Objects, are VectorCraft's own rules. Test: `cmd::docinfo::tests::info_lists_the_pattern_objects` (vectorcraft-engine). Document Info's Gradient Objects category lists the objects whose fill or stroke is a gradient, the category the [Document Info panel](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/document-info-panel.html) page describes as the count of objects with gradient fills or strokes. Each object is listed by name with the gradients it uses. With Selection Only it lists those in the selection, and the Document Info report and Package's report list them too (`document.info {category: "gradients"}`, `gradientObjects`). Naming a linked gradient by its swatch and any other gradient by its kind, and leaving out paint that draws nothing by the rules Pattern Objects follows, gradient swatches no art uses, gradient meshes and gradients drawn by effects, are VectorCraft's own rules. Objects counts the listed objects as Gradient Objects. Test: `cmd::docinfo::tests::info_lists_the_gradient_objects` (vectorcraft-engine). From 6c352a3ba20784318c36fbded4a1ff6486dec237 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 07:49:22 -0800 Subject: [PATCH 2/3] Tests: the package report check reads the Font Details row a_font_named_by_another_of_its_names_is_copied looked up the first line that starts with the font's label, which is now its Fonts row. It now reads the row under FONT DETAILS. --- crates/engine/src/tests/package.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/tests/package.rs b/crates/engine/src/tests/package.rs index 952693d7c1..f81cee0c42 100644 --- a/crates/engine/src/tests/package.rs +++ b/crates/engine/src/tests/package.rs @@ -517,7 +517,9 @@ fn a_font_named_by_another_of_its_names_is_copied() { let zip = unzip(&vectorcraft_format::base64_decode(r["dataBase64"].as_str().unwrap()).unwrap()); let report = String::from_utf8(zip["poster Folder/poster Report.txt"].clone()).unwrap(); assert!(report.contains("SourceSans3-Semibold Regular → Fonts/"), "{report}"); - let details = report.lines().find(|l| l.starts_with("SourceSans3-Semibold Regular: ")).unwrap_or_default(); + // The Font Details row: the Fonts rows above it start with the same label. + let font_details = report.split("\nFONT DETAILS\n").nth(1).unwrap_or_default(); + let details = font_details.lines().find(|l| l.starts_with("SourceSans3-Semibold Regular: ")).unwrap_or_default(); assert!(details.contains("embedding allowed") && !details.contains("missing"), "{report}"); } From 42e967a4dd89b57d7571c1de774a67d08fcfabfc Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 08:28:53 -0800 Subject: [PATCH 3/3] Document Info: Fonts counts the parts of a composite font Type set in a composite font counted as one use of the composite font's name, with the type of that name's face. Each text object now counts once for each font its runs are drawn in: the fonts of the composite font's parts its characters fall in, as `fonts` and Find Font already list them. Docs: docs/mcp.md. --- crates/engine/src/cmd/docinfo.rs | 30 ++++++++++++++++++++++++++++-- docs/mcp.md | 5 +++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/cmd/docinfo.rs b/crates/engine/src/cmd/docinfo.rs index d261582f3c..f33e65c099 100644 --- a/crates/engine/src/cmd/docinfo.rs +++ b/crates/engine/src/cmd/docinfo.rs @@ -174,9 +174,10 @@ fn font_use(used: &super::fonts::UsedFont, uses: usize) -> (Value, (String, Stri (json!({ "font": label, "type": kind, "uses": uses }), (label, format!("{name}; {count}"))) } -/// Counts text object `t` once for each font its runs are set in. +/// Counts text object `t` once for each font its runs are drawn in, a composite font's parts in +/// place of its name ([`super::fonts::run_fonts`]). fn count_fonts(fonts: &mut BTreeMap, t: &vectorcraft_doc::TextObject) { - let own: BTreeSet = t.runs.iter().map(|r| super::fonts::font_of(&r.style)).collect(); + let own: BTreeSet = t.runs.iter().flat_map(super::fonts::run_fonts).collect(); for font in own { *fonts.entry(font).or_default() += 1; } @@ -1015,6 +1016,31 @@ mod tests { assert_eq!((i["fontUses"].clone(), i["sections"][0]["rows"].clone()), (json!([]), json!([]))); } + /// Type set in a composite font counts as a use of the fonts of the parts its characters fall + /// in, as Find Font lists them, not of the composite font's name. + #[test] + fn info_fonts_count_the_parts_of_a_composite_font() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 200, "height": 200})).unwrap(); + let font = json!({"name": "DI Uses Composite", "parts": { + "kanji": {"font": "Source Sans 3"}, + "roman": {"font": "JetBrains Mono"}, + "numerals": {"font": "Inter"}, + }}); + s.execute("type.compositeFonts.set", &json!({"fonts": [font]})).unwrap(); + s.execute("text.create", &json!({"x": 10, "y": 20, "text": "Ab1", "font": "DI Uses Composite"})).unwrap(); + s.execute("text.create", &json!({"x": 10, "y": 50, "text": "12", "font": "DI Uses Composite"})).unwrap(); + let i = s.execute("document.info", &json!({"category": "fonts"})).unwrap(); + assert_eq!(i["fonts"], json!(["Inter Regular", "JetBrains Mono Regular"])); + assert_eq!( + i["fontUses"], + json!([ + {"font": "Inter Regular", "type": "truetype", "uses": 2}, + {"font": "JetBrains Mono Regular", "type": "truetype", "uses": 1}, + ]) + ); + } + /// Document Info › Objects gives the paths' total length in the document's units (#1958): an /// open line, a closed rectangle's perimeter and a compound path's pieces count, a guide doesn't. #[test] diff --git a/docs/mcp.md b/docs/mcp.md index fba3b3cac1..d84b54865b 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -7472,8 +7472,9 @@ result carries the same files as a zip (`{name: ".zip", dataBase64}`, entr `document.info {selectionOnly?, category?, format?: "text"}` adds `sections` (`[{id, title, rows: [[label, value]]}]`: document, objects, graphicStyles, brushes, spotColors, patterns, gradients, symbols, fonts, fontDetails, linkedImages, embeddedImages, repeats), `fonts` (the fonts the document's type uses, the type in opacity masks and in the art of -its symbols and pattern swatches included, which the fonts and fontDetails categories list; with `selectionOnly`, the -fonts of the selected type), `fontUses` (`[{font, type, uses}]`: each font of `fonts`, in order, as the fonts +its symbols and pattern swatches included, type in a composite font giving the fonts of the parts its characters fall +in, which the fonts and fontDetails categories list; with `selectionOnly`, the fonts of the selected type), +`fontUses` (`[{font, type, uses}]`: each font of `fonts`, in order, as the fonts category's rows give it, such as `TrueType; 2 uses`: `type` is `truetype` or `opentype` by the outlines of the face the type is drawn in (`glyf`, or `CFF` or `CFF2`), `unknown` for a font not installed in the family and style it names; `uses` is the number of text objects set in the font, each counted once however many of its runs use it, the