Skip to content

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.md
index 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.svg
new file mode 100644
index 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.tsv
index 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ě tvaru
Set shape stroke type Nastavit typ tahu tvaru
Set the text color Nastavit barvu textu
+ Create warped text Vytvořit deformovaný text
Shadows Stíny
Shape: Tvar:
Sharpening Doostření
diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv
index 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 festlegen
Set shape stroke type Konturtyp der Form festlegen
Set the text color Textfarbe festlegen
+ Create warped text Verkrümmten Text erstellen
Shadows Tiefen
Shape: Form:
Sharpening Scharfzeichnung
diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv
index 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.tsv
index 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 forma
Set shape stroke type Establecer el tipo de trazo de la forma
Set the text color Establecer el color del texto
+ Create warped text Crear texto deformado
Shadows Sombras
Shape: Forma:
Sharpening Enfoque
diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv
index 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 forme
Set shape stroke type Définir le type de contour de la forme
Set the text color Définir la couleur du texte
+ Create warped text Créer un texte déformé
Shadows Ombres
Shape: Forme :
Sharpening Netteté
diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv
index 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ásai
Set the overlay options for the Crop tool A Körbevágás eszköz fedvénybeállításai
Set the text color Szövegszín beállítása
+ Create warped text Torzított szöveg létrehozása
Settings: Beállítások:
Shape Dynamics Alakdinamika
Sharpen Tool Élesítő
diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv
index 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 bentuk
Set shape stroke type Atur jenis stroke bentuk
Set the text color Atur warna teks
+ Create warped text Buat teks warp
Shadows Bayangan
Shape: Bentuk:
Sharpening Penajaman
diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv
index 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 forma
Set shape stroke type Imposta tipo traccia forma
Set the text color Imposta colore testo
+ Create warped text Crea testo deformato
Shadows Ombre
Shape: Forma:
Sharpening Contrasto
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index 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.tsv
index 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.tsv
index 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 instellen
Set shape stroke type Lijntype van vorm instellen
Set the text color De tekstkleur instellen
+ Create warped text Verbogen tekst maken
Shadows Schaduwen
Shape: Vorm:
Sharpening Verscherping
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index 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łtu
Set shape stroke type Ustaw typ obrysu kształtu
Set the text color Ustaw kolor tekstu
+ Create warped text Utwórz wypaczony tekst
Shadows Cienie
Shape: Kształt:
Sharpening Wyostrzanie
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index 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 forma
Set shape stroke type Definir tipo de traçado da forma
Set the text color Definir a cor do texto
+ Create warped text Criar texto deformado
Shadows Sombras
Shape: Forma:
Sharpening Nitidez
diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv
index 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.tsv
index 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 oblika
Set shape stroke type Podesi vrstu obruba oblika
Set the text color Postavi boju teksta
+ Create warped text Napravi iskrivljeni tekst
Shadows Senke
Shape: Oblik:
Sharpening Izoštravanje
diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv
index 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ü ayarla
Set shape stroke type Şekil kontur türünü ayarlama
Set the text color Metin rengini ayarlama
+ Create warped text Çarpık metin oluştur
Shadows Gölgeler
Shape: Şekil:
Sharpening Bileme
diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv
index 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.tsv
index 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ải
Toggle text orientation Đổi hướng chữ
Set the text color Đặt màu chữ
+ Create warped text Tạo chữ uốn
Cancel 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.tsv
index 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.tsv
index 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.rs
index 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.rs
index 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.rs
index 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+):