PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Type: Create warped text button in the options bar, as in Photoshop (#5911)
Fazmina4b1e2a60700
diff --git a/ATTRIBUTION.md b/ATTRIBUTION.mdindex 26eca6246..ffb53b550 100644--- a/ATTRIBUTION.md+++ b/ATTRIBUTION.md@@ -27,7 +27,7 @@ next to them.| `crates/ui-egui/src/i18n/sr.tsv` | Serbian (Latin, Ekavian) UI translations | PhotoCraft contributors | Original translations of PhotoCraft's English labels | MIT OR Apache-2.0, [`LICENSE-translations.txt`](crates/ui-egui/src/i18n/LICENSE-translations.txt) || `assets/fonts/Inter-Regular.ttf`, `Inter-Medium.ttf`, `Inter-SemiBold.ttf` | Inter 4.001 (UI font) | The Inter Project Authors (Rasmus Andersson) | <https://github.com/rsms/inter> | SIL OFL 1.1, [`assets/fonts/OFL-Inter.txt`](assets/fonts/OFL-Inter.txt) || `assets/fonts/JetBrainsMono-Regular.ttf` | JetBrains Mono 2.305 (numeric font) | The JetBrains Mono Project Authors | <https://github.com/JetBrains/JetBrainsMono> | SIL OFL 1.1, [`assets/fonts/OFL-JetBrainsMono.txt`](assets/fonts/OFL-JetBrainsMono.txt) |-| `assets/icons/*.svg` except `slice-knife.svg`, `sampler.svg`, `artboard.svg`, `perspective-crop.svg`, `frame-placeholder.svg`, `gradient.svg`, `type-mask.svg`, `type-mask-vertical.svg`, `clip-below.svg`, `clip-release.svg`, `layer-mask.svg`, `adjustment-layer.svg`, `brush-replace.svg`, `quick-selection.svg`, `eraser-background.svg`, `eraser-magic.svg`, `lasso-magnetic.svg`, `direct-select.svg`, `convert-point.svg`, `pen-add-anchor.svg`, `pen-delete-anchor.svg`, `pen-freeform.svg`, `pen-curvature.svg`, `bandage-sparkle.svg`, `painting-symmetry.svg`, `symmetry-*.svg` and `marquee-{row,column}.svg` (113 files; `star-filled.svg` is `star.svg` with a solid fill) | Lucide icons | Lucide Icons and Contributors | <https://github.com/lucide-icons/lucide> (`icons/<name>.svg`; `align-*` are now named `text-align-*` upstream) | ISC, [`assets/icons/LICENSE-lucide.txt`](assets/icons/LICENSE-lucide.txt) |+| `assets/icons/*.svg` except `slice-knife.svg`, `sampler.svg`, `artboard.svg`, `perspective-crop.svg`, `frame-placeholder.svg`, `gradient.svg`, `type-mask.svg`, `type-mask-vertical.svg`, `text-warp.svg`, `clip-below.svg`, `clip-release.svg`, `layer-mask.svg`, `adjustment-layer.svg`, `brush-replace.svg`, `quick-selection.svg`, `eraser-background.svg`, `eraser-magic.svg`, `lasso-magnetic.svg`, `direct-select.svg`, `convert-point.svg`, `pen-add-anchor.svg`, `pen-delete-anchor.svg`, `pen-freeform.svg`, `pen-curvature.svg`, `bandage-sparkle.svg`, `painting-symmetry.svg`, `symmetry-*.svg` and `marquee-{row,column}.svg` (113 files; `star-filled.svg` is `star.svg` with a solid fill) | Lucide icons | Lucide Icons and Contributors | <https://github.com/lucide-icons/lucide> (`icons/<name>.svg`; `align-*` are now named `text-align-*` upstream) | ISC, [`assets/icons/LICENSE-lucide.txt`](assets/icons/LICENSE-lucide.txt) || `assets/icons/{check,chevron-down,chevron-left,chevron-right,chevron-up,chevrons-left,chevrons-right,circle,clock,compass,info,link,link-2,lock,minus,monitor,moon,move,navigation,plus,search,square,trash,triangle,type,x,zoom-in}.svg` | Lucide icons derived from Feather (subset of the row above) | Cole Bemis (Feather), Lucide Contributors | <https://github.com/feathericons/feather> via Lucide | MIT (Feather) and ISC (Lucide), [`assets/icons/LICENSE-lucide.txt`](assets/icons/LICENSE-lucide.txt) || `assets/icons/slice-knife.svg` | Slice tool glyph | PhotoCraft contributors | Original work | MIT OR Apache-2.0 || `assets/icons/sampler.svg` | Color Sampler tool glyph: a target reticle marking a sampled pixel | PhotoCraft contributors | Original work | MIT OR Apache-2.0 |@@ -35,6 +35,7 @@ next to them.| `assets/icons/artboard.svg` | Artboard tool glyph: a board with a tick at each end of its edges | PhotoCraft contributors | Original work | MIT OR Apache-2.0 || `assets/icons/perspective-crop.svg` | Perspective Crop tool glyph: a crop frame in perspective with its grid and crop-mark ticks | PhotoCraft contributors | Original work | MIT OR Apache-2.0 || `assets/icons/type-mask.svg`, `assets/icons/type-mask-vertical.svg` | Horizontal and Vertical Type Mask tool glyphs: a T drawn as marching ants (the vertical one beside a downward arrow), on Lucide's 24 px grid and stroke | PhotoCraft contributors | Original work | MIT OR Apache-2.0 |+| `assets/icons/text-warp.svg` | Create Warped Text glyph (Type tool options bar): a T above a bowed arc, drawn on Lucide's 24 px grid and stroke | PhotoCraft contributors | Original work | MIT OR Apache-2.0 || `assets/icons/marquee-row.svg`, `assets/icons/marquee-column.svg` | Single Row and Single Column Marquee tool glyphs: a dashed row (column) between two edge bars, drawn on Lucide's 24 px grid and stroke | PhotoCraft contributors | Original work | MIT OR Apache-2.0 || `assets/icons/clip-below.svg`, `assets/icons/clip-release.svg` | Clipping-mask cursors (⌥ over the line between two layers): a hooked arrow onto the layer below; the same with a small "no" badge to release | PhotoCraft contributors | Original work | MIT OR Apache-2.0 || `assets/icons/layer-mask.svg`, `assets/icons/adjustment-layer.svg` | Layers panel footer glyphs: Add a mask (a frame around a solid disc) and New Fill or Adjustment Layer (a circle, one half solid), drawn on Lucide's 24 px grid and stroke | PhotoCraft contributors | Original work | MIT OR Apache-2.0 |diff --git a/assets/icons/text-warp.svg b/assets/icons/text-warp.svgnew file mode 100644index 000000000..03f30ed87--- /dev/null+++ b/assets/icons/text-warp.svg@@ -0,0 +1,17 @@+<svg+ xmlns="http://www.w3.org/2000/svg"+ width="24"+ height="24"+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ stroke-width="2"+ stroke-linecap="round"+ stroke-linejoin="round"+>+ <!-- PhotoCraft's own Create Warped Text glyph (not from an icon set): a T above a bowed arc. -->+ <path d="M6 5V3h12v2" />+ <path d="M12 3v11" />+ <path d="M9.5 14h5" />+ <path d="M3 17c5 5 13 5 18 0" />+</svg>diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsvindex 5cfc0f8ff..0edf24fa9 100644--- a/crates/ui-egui/src/i18n/cs.tsv+++ b/crates/ui-egui/src/i18n/cs.tsv@@ -1498,6 +1498,7 @@Set shape fill type Nastavit typ výplně tvaruSet shape stroke type Nastavit typ tahu tvaruSet the text color Nastavit barvu textu+ Create warped text Vytvořit deformovaný textShadows StínyShape: Tvar:Sharpening Doostřenídiff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsvindex 05ac77803..d64f465be 100644--- a/crates/ui-egui/src/i18n/de.tsv+++ b/crates/ui-egui/src/i18n/de.tsv@@ -1481,6 +1481,7 @@Set shape fill type Fülltyp der Form festlegenSet shape stroke type Konturtyp der Form festlegenSet the text color Textfarbe festlegen+ Create warped text Verkrümmten Text erstellenShadows TiefenShape: Form:Sharpening Scharfzeichnungdiff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsvindex c6c5ff8f6..2025aeff7 100644--- a/crates/ui-egui/src/i18n/el.tsv+++ b/crates/ui-egui/src/i18n/el.tsv@@ -3033,6 +3033,7 @@Set shape fill type Ορισμός τύπου γεμίσματος σχήματοςSet shape stroke type Ορισμός τύπου περιγράμματος σχήματοςSet the text color Ορισμός χρώματος κειμένου+ Create warped text Δημιουργία παραμορφωμένου κειμένουShadows/Highlights Σκιές/φωτεινές περιοχέςShape ΣχήμαShape Blur Θόλωση σχήματοςdiff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsvindex e24171195..753da30ad 100644--- a/crates/ui-egui/src/i18n/es.tsv+++ b/crates/ui-egui/src/i18n/es.tsv@@ -1488,6 +1488,7 @@Set shape fill type Establecer el tipo de relleno de la formaSet shape stroke type Establecer el tipo de trazo de la formaSet the text color Establecer el color del texto+ Create warped text Crear texto deformadoShadows SombrasShape: Forma:Sharpening Enfoquediff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsvindex db40d97ab..ee45d66e3 100644--- a/crates/ui-egui/src/i18n/fr.tsv+++ b/crates/ui-egui/src/i18n/fr.tsv@@ -1468,6 +1468,7 @@Set shape fill type Définir le type de remplissage de la formeSet shape stroke type Définir le type de contour de la formeSet the text color Définir la couleur du texte+ Create warped text Créer un texte déforméShadows OmbresShape: Forme :Sharpening Nettetédiff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsvindex 54bde5d0c..4175879d4 100644--- a/crates/ui-egui/src/i18n/hu.tsv+++ b/crates/ui-egui/src/i18n/hu.tsv@@ -1304,6 +1304,7 @@Set painting symmetry options Festési szimmetria beállításaiSet the overlay options for the Crop tool A Körbevágás eszköz fedvénybeállításaiSet the text color Szövegszín beállítása+ Create warped text Torzított szöveg létrehozásaSettings: Beállítások:Shape Dynamics AlakdinamikaSharpen Tool Élesítődiff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsvindex 544ead05a..584ef448f 100644--- a/crates/ui-egui/src/i18n/id.tsv+++ b/crates/ui-egui/src/i18n/id.tsv@@ -1462,6 +1462,7 @@Set shape fill type Atur jenis isian bentukSet shape stroke type Atur jenis stroke bentukSet the text color Atur warna teks+ Create warped text Buat teks warpShadows BayanganShape: Bentuk:Sharpening Penajamandiff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsvindex 40b468926..6f7cf3834 100644--- a/crates/ui-egui/src/i18n/it.tsv+++ b/crates/ui-egui/src/i18n/it.tsv@@ -1483,6 +1483,7 @@Set shape fill type Imposta tipo riempimento formaSet shape stroke type Imposta tipo traccia formaSet the text color Imposta colore testo+ Create warped text Crea testo deformatoShadows OmbreShape: Forma:Sharpening Contrastodiff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsvindex 1d64bf868..2e9d86ec4 100644--- a/crates/ui-egui/src/i18n/ja.tsv+++ b/crates/ui-egui/src/i18n/ja.tsv@@ -1485,6 +1485,7 @@Set shape fill type シェイプの塗りの種類を設定Set shape stroke type シェイプの線の種類を設定Set the text color 文字色を設定+ Create warped text ワープテキストを作成Shadows シャドウShape: シェイプ:Sharpening シャープdiff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsvindex e76a3c982..5aeaf20ec 100644--- a/crates/ui-egui/src/i18n/ko.tsv+++ b/crates/ui-egui/src/i18n/ko.tsv@@ -1457,6 +1457,7 @@Set shape fill type 모양 채우기 유형 설정Set shape stroke type 모양 획 유형 설정Set the text color 텍스트 색상 설정+ Create warped text 뒤틀린 텍스트 만들기Shadows 어두운 영역Shape: 모양:Sharpening 선명 효과diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsvindex 2c9416c70..aea65c48f 100644--- a/crates/ui-egui/src/i18n/nl.tsv+++ b/crates/ui-egui/src/i18n/nl.tsv@@ -1466,6 +1466,7 @@Set shape fill type Vultype van vorm instellenSet shape stroke type Lijntype van vorm instellenSet the text color De tekstkleur instellen+ Create warped text Verbogen tekst makenShadows SchaduwenShape: Vorm:Sharpening Verscherpingdiff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsvindex eee1e61a9..ba8fd7af0 100644--- a/crates/ui-egui/src/i18n/pl.tsv+++ b/crates/ui-egui/src/i18n/pl.tsv@@ -1481,6 +1481,7 @@Set shape fill type Ustaw typ wypełnienia kształtuSet shape stroke type Ustaw typ obrysu kształtuSet the text color Ustaw kolor tekstu+ Create warped text Utwórz wypaczony tekstShadows CienieShape: Kształt:Sharpening Wyostrzaniediff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsvindex 3e10fe7db..04be6a5c8 100644--- a/crates/ui-egui/src/i18n/pt-br.tsv+++ b/crates/ui-egui/src/i18n/pt-br.tsv@@ -1463,6 +1463,7 @@Set shape fill type Definir tipo de preenchimento da formaSet shape stroke type Definir tipo de traçado da formaSet the text color Definir a cor do texto+ Create warped text Criar texto deformadoShadows SombrasShape: Forma:Sharpening Nitidezdiff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsvindex 862788630..63ecf634f 100644--- a/crates/ui-egui/src/i18n/ru.tsv+++ b/crates/ui-egui/src/i18n/ru.tsv@@ -782,6 +782,7 @@Set shape fill type Тип заливки фигурыSet shape stroke type Тип обводки фигурыSet the text color Цвет текста+ Create warped text Создать деформированный текстOnly Web Colors Только web-цветаOverlay Color Цвет наложенияOverlay Opacity Непрозрачность наложенияdiff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsvindex b91b67b3e..bb7d2f17f 100644--- a/crates/ui-egui/src/i18n/sr.tsv+++ b/crates/ui-egui/src/i18n/sr.tsv@@ -1446,6 +1446,7 @@Set shape fill type Podesi vrstu popune oblikaSet shape stroke type Podesi vrstu obruba oblikaSet the text color Postavi boju teksta+ Create warped text Napravi iskrivljeni tekstShadows SenkeShape: Oblik:Sharpening Izoštravanjediff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsvindex 4c8f06ccc..9f710549f 100644--- a/crates/ui-egui/src/i18n/tr.tsv+++ b/crates/ui-egui/src/i18n/tr.tsv@@ -1442,6 +1442,7 @@Set shape fill type Şekil doldurma türünü ayarlaSet shape stroke type Şekil kontur türünü ayarlamaSet the text color Metin rengini ayarlama+ Create warped text Çarpık metin oluşturShadows GölgelerShape: Şekil:Sharpening Bilemediff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsvindex 39597c15c..ed5b4de73 100644--- a/crates/ui-egui/src/i18n/uk.tsv+++ b/crates/ui-egui/src/i18n/uk.tsv@@ -759,6 +759,7 @@Set shape fill type Установити тип заливки фігуриSet shape stroke type Установити тип обведення фігуриSet the text color Установити колір тексту+ Create warped text Створити деформований текстOnly Web Colors Лише вебкольориOverlay Color Колір накладанняOverlay Opacity Непрозорість накладанняdiff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsvindex ac7123d85..2254010c2 100644--- a/crates/ui-egui/src/i18n/vi.tsv+++ b/crates/ui-egui/src/i18n/vi.tsv@@ -870,6 +870,7 @@Right align text Căn chữ phảiToggle text orientation Đổi hướng chữSet the text color Đặt màu chữ+ Create warped text Tạo chữ uốnCancel any current edits (Esc) Hủy chỉnh sửa hiện tại (Esc)Commit any current edits ({key}) Áp dụng chỉnh sửa hiện tại ({key})Author: Tác giả:diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsvindex 2307739ed..f3637050d 100644--- a/crates/ui-egui/src/i18n/zh-hans.tsv+++ b/crates/ui-egui/src/i18n/zh-hans.tsv@@ -1498,6 +1498,7 @@Set shape fill type 设置形状填充类型Set shape stroke type 设置形状描边类型Set the text color 设置文字颜色+ Create warped text 创建变形文字Shadows 阴影Shape: 形状:Sharpening 锐化diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsvindex 478489f8c..fc58d4e86 100644--- a/crates/ui-egui/src/i18n/zh-hant.tsv+++ b/crates/ui-egui/src/i18n/zh-hant.tsv@@ -1494,6 +1494,7 @@Set shape fill type 設定形狀填滿類型Set shape stroke type 設定形狀筆畫類型Set the text color 設定文字顏色+ Create warped text 建立彎曲文字Shadows 陰影Shape: 形狀:Sharpening 銳利化diff --git a/crates/ui-egui/src/icon_data.rs b/crates/ui-egui/src/icon_data.rsindex 9301f709c..e7e919bd9 100644--- a/crates/ui-egui/src/icon_data.rs+++ b/crates/ui-egui/src/icon_data.rs@@ -134,6 +134,7 @@ pub static ICONS: &[(&str, &[u8])] = &[("symmetry-vertical", include_bytes!("../../../assets/icons/symmetry-vertical.svg")),("swatch-book", include_bytes!("../../../assets/icons/swatch-book.svg")),("text-cursor", include_bytes!("../../../assets/icons/text-cursor.svg")),+ ("text-warp", include_bytes!("../../../assets/icons/text-warp.svg")),("toggle-left", include_bytes!("../../../assets/icons/toggle-left.svg")),("toggle-right", include_bytes!("../../../assets/icons/toggle-right.svg")),("trash", include_bytes!("../../../assets/icons/trash.svg")),diff --git a/crates/ui-egui/src/type_tool.rs b/crates/ui-egui/src/type_tool.rsindex 564112748..3f08e385b 100644--- a/crates/ui-egui/src/type_tool.rs+++ b/crates/ui-egui/src/type_tool.rs@@ -1785,6 +1785,14 @@ pub fn options_bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) {if resp.clicked() {open_color_picker(app, [c[0], c[1], c[2]]);}+ // Create warped text, after the swatch as in Photoshop (#5911): the Type › Warp Text… dialog.+ let can_warp = crate::menus::is_enabled(app, "type.warpText");+ if ui.add_enabled_ui(can_warp, |ui| crate::icons::button(ui, "text-warp", 24.0, false, tl!("Create warped text"))).inner.clicked()+ && let Err(e) = crate::menus::invoke(app, &ui.ctx().clone(), "type.warpText", json!({}))+ {+ app.ui.status = e;+ app.ui.status_error = true;+ }if app.ui.text_edit.is_some() {ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {ui.add_space(8.0);diff --git a/crates/ui-egui/src/type_tool_tests.rs b/crates/ui-egui/src/type_tool_tests.rsindex 725d2890f..43f668b7c 100644--- a/crates/ui-egui/src/type_tool_tests.rs+++ b/crates/ui-egui/src/type_tool_tests.rs@@ -1356,6 +1356,7 @@ fn the_font_menu_lists_served_families() {mod multi_layer_formatting {use super::*;use egui::accesskit::Role;+ use egui_kittest::kittest::NodeT;use photocraft_doc::text::{AntiAlias, CharStyle, Orientation, TextAlign};fn selected(app: &mut PhotocraftApp, ids: &[LayerId]) {@@ -1726,6 +1727,28 @@ mod multi_layer_formatting {assert_eq!(style(h.state(), id, 0), expected);}}++ /// #5911: the options bar's Create warped text button opens Warp Text for the selected type+ /// layers, as Type › Warp Text… does; with no type layer to warp it is greyed.+ #[test]+ fn options_bar_warp_button_warps_the_selected_type_layers() {+ let (app, ids) = fixture();+ let mut h = controls(app, false);+ h.get_by_role_and_label(Role::Button, "Create warped text").click();+ h.run();+ let dialog = h.state().ui.dialogs.last().unwrap();+ assert_eq!(dialog.fields.get("__command").and_then(|c| c.as_str()), Some("type.warpText"));+ let dialog = dialog.id;+ h.state_mut().ui.dialog_mut(dialog).unwrap().fields.insert("style".into(), json!("arc"));+ crate::dialogs::confirm(h.state_mut(), dialog).unwrap();+ for id in &ids[..2] {+ assert!(text(h.state(), *id).warp.is_some(), "a selected layer is warped");+ }+ assert!(text(h.state(), ids[2]).warp.is_none(), "an unselected layer is left alone");+ h.state_mut().run("layer.new.layer", json!({})).unwrap();+ h.run();+ assert!(h.get_by_role_and_label(Role::Button, "Create warped text").accesskit_node().is_disabled());+ }}/// #1132: with the Move tool, double-clicking type on the canvas edits it (Photoshop CC 2019+):