Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

feat: add text case and typography style controls

MD20dcd9aab025
diff --git a/docs/text-typography.md b/docs/text-typography.md
new file mode 100644
index 00000000..bd430ed5
--- /dev/null
+++ b/docs/text-typography.md
@@ -0,0 +1,38 @@
+# Typography controls
+
+The Text inspector's Typography section uses the existing `IconButton`
+primitive for both rows. Its `checked` property owns the selected appearance;
+the inspector adds no colours, borders or custom pressed-state rules. These
+buttons suppress hover tooltips, while retaining their labels.
+
+- **B** toggles the existing font weight between bold (700) and regular (400).
+ Weights of 700 or more show the button selected. The weight selector remains
+ available and reflects the same value.
+- **I**, underlined **U**, and struck **S** independently toggle italic,
+ underline and strikethrough. All four styles can be combined.
+- **AA**, **aa**, and **Aa** select uppercase, lowercase and sentence case.
+ Clicking the selected case again restores the original appearance.
+ Sentence case lowercases the text and capitalizes its first alphabetic
+ character and those after `.`, `!`, `?` and their full-width equivalents.
+ This is punctuation-based casing, without language or abbreviation detection.
+
+Case changes preserve `content`, including its original spelling and case.
+The host converts a copy before font selection, shaping and wrapping, for both
+live preview and video export. Plain-text exports retain the source content.
+Decorations use the selected face's underline/strike metrics with an em-based
+fallback and join the glyph path, sharing fill, outline and shadow.
+
+The new `textCase`, `underline` and `strikethrough` style fields are saved with
+the project and reusable styles. Old styles default to original case with no
+decorations. Inspector edits use the existing batch-edit and undo/redo path.
+
+This branch starts at upstream commit
+`797c8c707be5f2c798bb99e0fffad20612552510` and does not include the separate
+caption features or personal Windows workflow changes.
+
+Validation: source wiring, JSON parsing and whitespace checks were performed.
+Rust regression tests cover source preservation, style serialization, old-style
+defaults and decoration pixels/layout. They have not been run: the Rust
+toolchain is unavailable locally and no build was requested. Manual UI and
+video-export verification remain pending. New strings are supplied in English and Italian, with explicit English
+fallback entries for the other locales. The locale inventory check passes.
diff --git a/src/crates/concat-host/src/cards.rs b/src/crates/concat-host/src/cards.rs
index 3eceae0b..452fe541 100644
--- a/src/crates/concat-host/src/cards.rs
+++ b/src/crates/concat-host/src/cards.rs
@@ -339,6 +339,8 @@ impl Painter {
font_size: 0.26,
font_weight: 800.0,
italic: false,
+ underline: false,
+ strikethrough: false,
color: "#ffffff".to_owned(),
align: concat_text::Align::Center,
stroke_width: 0.0,
diff --git a/src/crates/concat-host/src/titles.rs b/src/crates/concat-host/src/titles.rs
index 1208dc92..9d9fa554 100644
--- a/src/crates/concat-host/src/titles.rs
+++ b/src/crates/concat-host/src/titles.rs
@@ -570,11 +570,13 @@ fn reveal_of(words: &[WordRect], width: u32, height: u32) -> Arc<RevealMap> {
/// The document's style, field for field, in the painter's terms.
fn title_style(style: &TextStyle) -> TitleStyle {
TitleStyle {
- content: style.content.clone(),
+ content: style.display_content(),
font_family: style.font_family.clone(),
font_size: style.font_size,
font_weight: style.font_weight,
italic: style.italic,
+ underline: style.underline,
+ strikethrough: style.strikethrough,
color: style.color.clone(),
align: match style.align {
TextAlign::Left => Align::Left,
diff --git a/src/crates/concat-project/src/lib.rs b/src/crates/concat-project/src/lib.rs
index f6dae4f2..7645482c 100644
--- a/src/crates/concat-project/src/lib.rs
+++ b/src/crates/concat-project/src/lib.rs
@@ -41,6 +41,47 @@ pub use model::Project;
mod tests {
use serde_json::json;
+ #[test]
+ fn typography_preserves_source_and_round_trips() {
+ use crate::model::{TextCase, TextStyle};
+ let original = "«È UNA PROVA!» POI, UN’ALTRA. già qui? sì!";
+ let mut style = TextStyle {
+ content: original.into(),
+ text_case: TextCase::Sentence,
+ underline: true,
+ strikethrough: true,
+ ..Default::default()
+ };
+ assert_eq!(
+ style.display_content(),
+ "«È una prova!» Poi, un’altra. Già qui? Sì!"
+ );
+ assert_eq!(style.content, original);
+ let saved = serde_json::to_value(&style).unwrap();
+ let restored: TextStyle = serde_json::from_value(saved).unwrap();
+ assert_eq!(restored, style);
+ style.text_case = TextCase::Lower;
+ assert_eq!(style.display_content(), original.to_lowercase());
+ style.text_case = TextCase::Upper;
+ assert_eq!(style.display_content(), original.to_uppercase());
+ style.text_case = TextCase::Original;
+ assert_eq!(style.display_content(), original);
+ }
+
+ #[test]
+ fn old_styles_keep_their_original_appearance() {
+ use crate::model::{TextCase, TextStyle};
+ let style: TextStyle = serde_json::from_value(json!({
+ "content": "Keep MY Case", "italic": true, "fontWeight": 500
+ }))
+ .unwrap();
+ assert_eq!(style.text_case, TextCase::Original);
+ assert_eq!(style.display_content(), "Keep MY Case");
+ assert!(!style.underline && !style.strikethrough);
+ assert!(style.italic);
+ assert_eq!(style.font_weight, 500.0);
+ }
+
use crate::commands::{
ClipMove, ClipPatch, Command, NewMedia, PlayheadSide, TrackFlag, TrimEdge,
};
diff --git a/src/crates/concat-project/src/model.rs b/src/crates/concat-project/src/model.rs
index 218eed78..53e75608 100644
--- a/src/crates/concat-project/src/model.rs
+++ b/src/crates/concat-project/src/model.rs
@@ -1465,11 +1465,21 @@ impl Default for ShapeStyle {
}
}
+/// Display casing, independent of the editable source text.
+#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
+#[derive(Clone, Copy, PartialEq, Eq, Debug, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub enum TextCase {
+ Upper,
+ Lower,
+ Sentence,
+ #[default]
+ #[serde(other)]
+ Original,
+}
+
/// A title's styling. Sizes are fractions of the frame, so a title composed
-/// against 1080p lands correctly exported at 4K. A style arriving in a
-/// command needs only the fields it changes; the rest are the default's, so
-/// a caller can say `{ "content": "Hello" }` and get a title that looks like
-/// one the window would place.
+/// against 1080p lands correctly exported at 4K. Missing fields use defaults.
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", default)]
@@ -1487,6 +1497,12 @@ pub struct TextStyle {
pub font_weight: f64,
/// Italic when true. A style flag, not a separate face.
pub italic: bool,
+ /// Case is applied for painting; the editable source stays intact.
+ pub text_case: TextCase,
+ /// Draw an underline using the selected face's metrics.
+ pub underline: bool,
+ /// Draw a strike through the text using the selected face's metrics.
+ pub strikethrough: bool,
/// Fill colour as a CSS hex string, e.g. "#ffffff".
pub color: String,
/// Line alignment within the block; see [`TextAlign`].
@@ -1541,6 +1557,31 @@ pub struct TextStyle {
}
impl TextStyle {
+ /// The displayed text, without rewriting the source or saved captions.
+ pub fn display_content(&self) -> String {
+ match self.text_case {
+ TextCase::Original => self.content.clone(),
+ TextCase::Upper => self.content.to_uppercase(),
+ TextCase::Lower => self.content.to_lowercase(),
+ TextCase::Sentence => {
+ let mut result = String::new();
+ let mut initial = true;
+ for ch in self.content.to_lowercase().chars() {
+ if initial && ch.is_alphabetic() {
+ result.extend(ch.to_uppercase());
+ initial = false;
+ } else {
+ result.push(ch);
+ }
+ if matches!(ch, '.' | '!' | '?' | '。' | '!' | '?') {
+ initial = true;
+ }
+ }
+ result
+ }
+ }
+ }
+
/// Every number pulled into the range a title can be drawn at: a
/// hand-edited zero size would render an invisible title, and lines
/// cannot collapse onto each other.
@@ -1574,6 +1615,9 @@ impl Default for TextStyle {
font_size: 0.09,
font_weight: 700.0,
italic: false,
+ text_case: TextCase::Original,
+ underline: false,
+ strikethrough: false,
color: "#ffffff".to_owned(),
align: TextAlign::Center,
opacity: 1.0,
diff --git a/src/crates/concat-text/src/lib.rs b/src/crates/concat-text/src/lib.rs
index 08347d2e..87adc72f 100644
--- a/src/crates/concat-text/src/lib.rs
+++ b/src/crates/concat-text/src/lib.rs
@@ -71,6 +71,9 @@ pub struct TitleStyle {
pub font_weight: f64,
/// Italic when true.
pub italic: bool,
+ /// Decorations share the glyph fill, outline and shadow.
+ pub underline: bool,
+ pub strikethrough: bool,
/// Fill colour as `#rrggbb` or `#rrggbbaa`.
pub color: String,
/// Line alignment within the block.
@@ -1437,6 +1440,34 @@ fn paint(
.expect("a translated glyph path stays finite");
words.push_path(&placed);
}
+ // Font metrics keep decorations aligned across faces and resolutions.
+ let metric = |m: Option<ttf_parser::LineMetrics>, fallback: f32| {
+ m.map_or((fallback, (em * 0.05).max(1.0)), |m| {
+ (
+ -f32::from(m.position) / upem * em,
+ (f32::from(m.thickness).abs() / upem * em).max(1.0),
+ )
+ })
+ };
+ for (enabled, (offset, thickness)) in [
+ (style.underline, metric(own.underline_metrics(), em * 0.1)),
+ (
+ style.strikethrough,
+ metric(own.strikeout_metrics(), -em * 0.3),
+ ),
+ ] {
+ if enabled
+ && line.width > 0.0
+ && let Some(rect) = Rect::from_xywh(
+ left + indent,
+ baseline + offset - thickness / 2.0,
+ line.width,
+ thickness,
+ )
+ {
+ words.push_rect(rect);
+ }
+ }
let line_top = baseline - ascent;
for &(start_x, end_x) in &line.words {
word_rects.push(WordRect {
@@ -1913,6 +1944,8 @@ mod tests {
font_size: 0.09,
font_weight: 700.0,
italic: false,
+ underline: false,
+ strikethrough: false,
color: "#ffffff".to_owned(),
align: Align::Center,
stroke_width: 0.0,
@@ -1929,6 +1962,28 @@ mod tests {
}
}
+ #[test]
+ fn decorations_change_pixels_without_moving_the_text() {
+ let fonts = Fonts::new();
+ let plain = style("First line\nSecond line");
+ let base = render_frame(&fonts, &plain, 640, 360).unwrap();
+ for (underline, strikethrough) in [(true, false), (false, true), (true, true)] {
+ let decorated = TitleStyle {
+ underline,
+ strikethrough,
+ ..plain.clone()
+ };
+ let painted = render_frame(&fonts, &decorated, 640, 360).unwrap();
+ assert_ne!(painted.rgba, base.rgba);
+ assert_eq!(painted.words, base.words);
+ assert_eq!(painted.block_width, base.block_width);
+ assert_eq!(painted.block_height, base.block_height);
+ // The PNG export path and live preview share the same painter.
+ let exported = render(&fonts, &decorated, 640, 360).unwrap();
+ assert_eq!(exported.words, painted.words);
+ }
+ }
+
/// A limit narrower than the words wraps them: the block comes out no
/// wider than the limit and taller than the one-line block.
#[test]
diff --git a/src/crates/concat/locales/ar.json b/src/crates/concat/locales/ar.json
index 28a73474..d25b5328 100644
--- a/src/crates/concat/locales/ar.json
+++ b/src/crates/concat/locales/ar.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "سُمك الخط",
"textPanel.horizontal": "أفقي",
"textPanel.importFont": "استيراد خط…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "مائل",
"textPanel.layout": "التخطيط",
"textPanel.lineHeight": "ارتفاع السطر",
diff --git a/src/crates/concat/locales/az.json b/src/crates/concat/locales/az.json
index b0c2f61b..8eb8b338 100644
--- a/src/crates/concat/locales/az.json
+++ b/src/crates/concat/locales/az.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "Şrift qalınlığı",
"textPanel.horizontal": "Üfüqi",
"textPanel.importFont": "Şrift idxal et…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "Kursiv",
"textPanel.layout": "Düzülüş",
"textPanel.lineHeight": "Sətir hündürlüyü",
diff --git a/src/crates/concat/locales/bn.json b/src/crates/concat/locales/bn.json
index 65798185..7d8dda95 100644
--- a/src/crates/concat/locales/bn.json
+++ b/src/crates/concat/locales/bn.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "ফন্ট ওয়েট",
"textPanel.horizontal": "অনুভূমিক",
"textPanel.importFont": "একটি ফন্ট ইমপোর্ট করুন…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "ইটালিক",
"textPanel.layout": "লেআউট",
"textPanel.lineHeight": "লাইনের উচ্চতা",
diff --git a/src/crates/concat/locales/de.json b/src/crates/concat/locales/de.json
index ca3f9627..e3dff12f 100644
--- a/src/crates/concat/locales/de.json
+++ b/src/crates/concat/locales/de.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "Schriftstärke",
"textPanel.horizontal": "Horizontal",
"textPanel.importFont": "Schrift importieren…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "Kursiv",
"textPanel.layout": "Layout",
"textPanel.lineHeight": "Zeilenhöhe",
diff --git a/src/crates/concat/locales/en.json b/src/crates/concat/locales/en.json
index dcca0780..0fa477d8 100644
--- a/src/crates/concat/locales/en.json
+++ b/src/crates/concat/locales/en.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "Font Weight",
"textPanel.horizontal": "Horizontal",
"textPanel.importFont": "Import a font…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "Italic",
"textPanel.layout": "Layout",
"textPanel.lineHeight": "Line height",
diff --git a/src/crates/concat/locales/es.json b/src/crates/concat/locales/es.json
index ff0da7e1..ebb41d1d 100644
--- a/src/crates/concat/locales/es.json
+++ b/src/crates/concat/locales/es.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "Grosor de fuente",
"textPanel.horizontal": "Horizontal",
"textPanel.importFont": "Importar una fuente…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "Cursiva",
"textPanel.layout": "Disposición",
"textPanel.lineHeight": "Interlineado",
diff --git a/src/crates/concat/locales/fa.json b/src/crates/concat/locales/fa.json
index a1b8624b..38f027d9 100644
--- a/src/crates/concat/locales/fa.json
+++ b/src/crates/concat/locales/fa.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "وزن فونت",
"textPanel.horizontal": "افقی",
"textPanel.importFont": "وارد کردن قلم…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "ایتالیک",
"textPanel.layout": "چیدمان",
"textPanel.lineHeight": "ارتفاع خط",
diff --git a/src/crates/concat/locales/fr.json b/src/crates/concat/locales/fr.json
index 0f6f75eb..8629dfd2 100644
--- a/src/crates/concat/locales/fr.json
+++ b/src/crates/concat/locales/fr.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "Graisse de la police",
"textPanel.horizontal": "Horizontal",
"textPanel.importFont": "Importer une police…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "Italique",
"textPanel.layout": "Disposition",
"textPanel.lineHeight": "Interligne",
diff --git a/src/crates/concat/locales/he.json b/src/crates/concat/locales/he.json
index e71761df..a1f659d7 100644
--- a/src/crates/concat/locales/he.json
+++ b/src/crates/concat/locales/he.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "משקל גופן",
"textPanel.horizontal": "אופקי",
"textPanel.importFont": "ייבוא גופן…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "נטוי",
"textPanel.layout": "פריסה",
"textPanel.lineHeight": "גובה שורה",
diff --git a/src/crates/concat/locales/hi.json b/src/crates/concat/locales/hi.json
index 32b4c0bc..fcb6b518 100644
--- a/src/crates/concat/locales/hi.json
+++ b/src/crates/concat/locales/hi.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "फ़ॉन्ट मोटाई",
"textPanel.horizontal": "क्षैतिज",
"textPanel.importFont": "फ़ॉन्ट इंपोर्ट करें…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "इटैलिक",
"textPanel.layout": "लेआउट",
"textPanel.lineHeight": "पंक्ति ऊंचाई",
diff --git a/src/crates/concat/locales/hr.json b/src/crates/concat/locales/hr.json
index 7d183cc8..62708b0c 100644
--- a/src/crates/concat/locales/hr.json
+++ b/src/crates/concat/locales/hr.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "Debljina fonta",
"textPanel.horizontal": "Vodoravno",
"textPanel.importFont": "Uvezi font…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "Kurziv",
"textPanel.layout": "Raspored",
"textPanel.lineHeight": "Visina retka",
diff --git a/src/crates/concat/locales/id.json b/src/crates/concat/locales/id.json
index ca1a26b6..cda6a036 100644
--- a/src/crates/concat/locales/id.json
+++ b/src/crates/concat/locales/id.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "Ketebalan Font",
"textPanel.horizontal": "Mendatar",
"textPanel.importFont": "Impor font…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "Miring",
"textPanel.layout": "Tata letak",
"textPanel.lineHeight": "Tinggi baris",
diff --git a/src/crates/concat/locales/it.json b/src/crates/concat/locales/it.json
index 2434a02c..1504ad2c 100644
--- a/src/crates/concat/locales/it.json
+++ b/src/crates/concat/locales/it.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "Peso del carattere",
"textPanel.horizontal": "Orizzontale",
"textPanel.importFont": "Importa un font…",
+ "textPanel.style": "Stile",
+ "textPanel.letterCase": "Maiusc./minusc.",
+ "textPanel.underline": "Sottolineato",
+ "textPanel.strikethrough": "Barrato",
+ "textPanel.uppercase": "Maiuscolo",
+ "textPanel.lowercase": "Minuscolo",
+ "textPanel.sentenceCase": "Iniziale della frase",
"textPanel.italic": "Corsivo",
"textPanel.layout": "Impaginazione",
"textPanel.lineHeight": "Interlinea",
diff --git a/src/crates/concat/locales/ja.json b/src/crates/concat/locales/ja.json
index 5abf9cd0..94558d39 100644
--- a/src/crates/concat/locales/ja.json
+++ b/src/crates/concat/locales/ja.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "フォントの太さ",
"textPanel.horizontal": "水平",
"textPanel.importFont": "フォントを読み込む…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "斜体",
"textPanel.layout": "レイアウト",
"textPanel.lineHeight": "行の高さ",
diff --git a/src/crates/concat/locales/ko.json b/src/crates/concat/locales/ko.json
index b09f8873..bda3337a 100644
--- a/src/crates/concat/locales/ko.json
+++ b/src/crates/concat/locales/ko.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "글꼴 굵기",
"textPanel.horizontal": "가로",
"textPanel.importFont": "글꼴 가져오기…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "기울임",
"textPanel.layout": "레이아웃",
"textPanel.lineHeight": "줄 높이",
diff --git a/src/crates/concat/locales/nl.json b/src/crates/concat/locales/nl.json
index be1f7f20..30757bb0 100644
--- a/src/crates/concat/locales/nl.json
+++ b/src/crates/concat/locales/nl.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "Tekendikte",
"textPanel.horizontal": "Horizontaal",
"textPanel.importFont": "Lettertype importeren…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "Cursief",
"textPanel.layout": "Indeling",
"textPanel.lineHeight": "Regelhoogte",
diff --git a/src/crates/concat/locales/pl.json b/src/crates/concat/locales/pl.json
index 4963ff7e..a3544a84 100644
--- a/src/crates/concat/locales/pl.json
+++ b/src/crates/concat/locales/pl.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "Grubość czcionki",
"textPanel.horizontal": "W poziomie",
"textPanel.importFont": "Importuj czcionkę…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "Kursywa",
"textPanel.layout": "Układ",
"textPanel.lineHeight": "Wysokość wiersza",
diff --git a/src/crates/concat/locales/pt-BR.json b/src/crates/concat/locales/pt-BR.json
index bd409c82..5f845b21 100644
--- a/src/crates/concat/locales/pt-BR.json
+++ b/src/crates/concat/locales/pt-BR.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "Peso da fonte",
"textPanel.horizontal": "Horizontal",
"textPanel.importFont": "Importar uma fonte…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "Itálico",
"textPanel.layout": "Leiaute",
"textPanel.lineHeight": "Altura da linha",
diff --git a/src/crates/concat/locales/ru.json b/src/crates/concat/locales/ru.json
index cd7ecda6..49a13c03 100644
--- a/src/crates/concat/locales/ru.json
+++ b/src/crates/concat/locales/ru.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "Насыщенность шрифта",
"textPanel.horizontal": "По горизонтали",
"textPanel.importFont": "Импортировать шрифт…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "Курсив",
"textPanel.layout": "Компоновка",
"textPanel.lineHeight": "Высота строки",
diff --git a/src/crates/concat/locales/th.json b/src/crates/concat/locales/th.json
index 36e44e09..9cc0168e 100644
--- a/src/crates/concat/locales/th.json
+++ b/src/crates/concat/locales/th.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "น้ำหนักฟอนต์",
"textPanel.horizontal": "แนวนอน",
"textPanel.importFont": "นำเข้าฟอนต์…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "ตัวเอียง",
"textPanel.layout": "เลย์เอาต์",
"textPanel.lineHeight": "ความสูงบรรทัด",
diff --git a/src/crates/concat/locales/tr.json b/src/crates/concat/locales/tr.json
index 8eeba313..0fa73f1a 100644
--- a/src/crates/concat/locales/tr.json
+++ b/src/crates/concat/locales/tr.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "Yazı kalınlığı",
"textPanel.horizontal": "Yatay",
"textPanel.importFont": "Yazı tipi içe aktar…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "İtalik",
"textPanel.layout": "Yerleşim",
"textPanel.lineHeight": "Satır yüksekliği",
diff --git a/src/crates/concat/locales/uk.json b/src/crates/concat/locales/uk.json
index ad732222..cc8cd709 100644
--- a/src/crates/concat/locales/uk.json
+++ b/src/crates/concat/locales/uk.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "Товщина шрифту",
"textPanel.horizontal": "По горизонталі",
"textPanel.importFont": "Імпортувати шрифт…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "Курсив",
"textPanel.layout": "Компонування",
"textPanel.lineHeight": "Висота рядка",
diff --git a/src/crates/concat/locales/ur.json b/src/crates/concat/locales/ur.json
index 61659fd7..b87cff3a 100644
--- a/src/crates/concat/locales/ur.json
+++ b/src/crates/concat/locales/ur.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "فونٹ کا وزن",
"textPanel.horizontal": "افقی",
"textPanel.importFont": "فونٹ امپورٹ کریں…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "ترچھا",
"textPanel.layout": "ترتیب",
"textPanel.lineHeight": "سطر کی اونچائی",
diff --git a/src/crates/concat/locales/vi.json b/src/crates/concat/locales/vi.json
index b3945bd6..693247c2 100644
--- a/src/crates/concat/locales/vi.json
+++ b/src/crates/concat/locales/vi.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "Độ đậm phông chữ",
"textPanel.horizontal": "Ngang",
"textPanel.importFont": "Nhập phông chữ…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "Nghiêng",
"textPanel.layout": "Bố cục",
"textPanel.lineHeight": "Chiều cao dòng",
diff --git a/src/crates/concat/locales/zh-Hans.json b/src/crates/concat/locales/zh-Hans.json
index 77b4b2af..6055694d 100644
--- a/src/crates/concat/locales/zh-Hans.json
+++ b/src/crates/concat/locales/zh-Hans.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "字重",
"textPanel.horizontal": "水平",
"textPanel.importFont": "导入字体…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "斜体",
"textPanel.layout": "布局",
"textPanel.lineHeight": "行高",
diff --git a/src/crates/concat/locales/zh-TW.json b/src/crates/concat/locales/zh-TW.json
index 4d247d25..4c0c6c11 100644
--- a/src/crates/concat/locales/zh-TW.json
+++ b/src/crates/concat/locales/zh-TW.json
@@ -802,6 +802,13 @@
"textPanel.fontWeight": "字重",
"textPanel.horizontal": "水平",
"textPanel.importFont": "匯入字型…",
+ "textPanel.style": "Style",
+ "textPanel.letterCase": "Letter case",
+ "textPanel.underline": "Underline",
+ "textPanel.strikethrough": "Strikethrough",
+ "textPanel.uppercase": "Uppercase",
+ "textPanel.lowercase": "Lowercase",
+ "textPanel.sentenceCase": "Sentence case",
"textPanel.italic": "斜體",
"textPanel.layout": "佈局",
"textPanel.lineHeight": "行高",
diff --git a/src/crates/concat/src/presets.rs b/src/crates/concat/src/presets.rs
index bb749526..28840a44 100644
--- a/src/crates/concat/src/presets.rs
+++ b/src/crates/concat/src/presets.rs
@@ -96,6 +96,9 @@ struct PresetStyle {
font_size: Option<f64>,
font_weight: Option<f64>,
italic: Option<bool>,
+ text_case: Option<concat_project::model::TextCase>,
+ underline: Option<bool>,
+ strikethrough: Option<bool>,
color: Option<String>,
align: Option<String>,
opacity: Option<f64>,
@@ -126,6 +129,9 @@ impl PresetStyle {
.unwrap_or(base.font_weight)
.clamp(100.0, 900.0),
italic: self.italic.unwrap_or(false),
+ text_case: self.text_case.unwrap_or_default(),
+ underline: self.underline.unwrap_or(false),
+ strikethrough: self.strikethrough.unwrap_or(false),
color: self.color.unwrap_or(base.color),
align: match self.align.as_deref() {
Some("left") => TextAlign::Left,
diff --git a/src/crates/concat/src/studio.rs b/src/crates/concat/src/studio.rs
index 4069089a..375e3f23 100644
--- a/src/crates/concat/src/studio.rs
+++ b/src/crates/concat/src/studio.rs
@@ -5505,6 +5505,16 @@ impl Studio {
ClipField::FontSize => text.font_size = value.clamp(0.01, 0.5),
ClipField::FontWeight => text.font_weight = value.clamp(100.0, 900.0),
ClipField::Italic => text.italic = value != 0.0,
+ ClipField::Underline => text.underline = value != 0.0,
+ ClipField::Strikethrough => text.strikethrough = value != 0.0,
+ ClipField::TextCase => {
+ text.text_case = match value as i32 {
+ 1 => model::TextCase::Upper,
+ 2 => model::TextCase::Lower,
+ 3 => model::TextCase::Sentence,
+ _ => model::TextCase::Original,
+ };
+ }
ClipField::TextOpacity => text.opacity = value.clamp(0.0, 1.0),
ClipField::Align => {
text.align = match value as i32 {
@@ -10887,6 +10897,14 @@ impl Studio {
font_size: text.font_size as f32,
font_weight: text.font_weight as f32,
italic: text.italic,
+ underline: text.underline,
+ strikethrough: text.strikethrough,
+ text_case: match text.text_case {
+ model::TextCase::Original => 0,
+ model::TextCase::Upper => 1,
+ model::TextCase::Lower => 2,
+ model::TextCase::Sentence => 3,
+ },
fill,
fill_hex: hex_of(fill).into(),
align: align_of(text.align),
diff --git a/src/crates/concat/ui/inspector/text-panel.slint b/src/crates/concat/ui/inspector/text-panel.slint
index c15bb443..e6c24de5 100644
--- a/src/crates/concat/ui/inspector/text-panel.slint
+++ b/src/crates/concat/ui/inspector/text-panel.slint
@@ -342,10 +342,65 @@ export component TextPanel inherits VerticalLayout {
changed(v) => { root.set(ClipField.font-size, v); root.commit(); }
}
- SwitchRow {
- label: I18n.t("textPanel.italic");
- checked: root.selected.italic;
- toggled(on) => { root.set(ClipField.italic, on ? 1 : 0); root.commit(); }
+ Row {
+ label: I18n.t("textPanel.style");
+ label-width: root.label-w;
+ IconButton {
+ text: "B";
+ text-weight: 700;
+ label: I18n.t("textPanel.bold");
+ tooltip: false;
+ checked: root.selected.font-weight >= 700;
+ clicked => { root.set(ClipField.font-weight, root.selected.font-weight >= 700 ? 400 : 700); root.commit(); }
+ }
+ IconButton {
+ text: "I";
+ text-italic: true;
+ label: I18n.t("textPanel.italic");
+ tooltip: false;
+ checked: root.selected.italic;
+ clicked => { root.set(ClipField.italic, root.selected.italic ? 0 : 1); root.commit(); }
+ }
+ IconButton {
+ text: "U̲";
+ label: I18n.t("textPanel.underline");
+ tooltip: false;
+ checked: root.selected.underline;
+ clicked => { root.set(ClipField.underline, root.selected.underline ? 0 : 1); root.commit(); }
+ }
+ IconButton {
+ text: "S̶";
+ label: I18n.t("textPanel.strikethrough");
+ tooltip: false;
+ checked: root.selected.strikethrough;
+ clicked => { root.set(ClipField.strikethrough, root.selected.strikethrough ? 0 : 1); root.commit(); }
+ }
+ }
+
+ Row {
+ label: I18n.t("textPanel.letterCase");
+ label-width: root.label-w;
+ IconButton {
+ text: "AA";
+ label: I18n.t("textPanel.uppercase");
+ tooltip: false;
+ checked: root.selected.text-case == 1;
+ clicked => { root.set(ClipField.text-case, root.selected.text-case == 1 ? 0 : 1); root.commit(); }
+ }
+ IconButton {
+ text: "aa";
+ label: I18n.t("textPanel.lowercase");
+ tooltip: false;
+ checked: root.selected.text-case == 2;
+ clicked => { root.set(ClipField.text-case, root.selected.text-case == 2 ? 0 : 2); root.commit(); }
+ }
+ IconButton {
+ text: "Aa";
+ label: I18n.t("textPanel.sentenceCase");
+ tooltip: false;
+ checked: root.selected.text-case == 3;
+ clicked => { root.set(ClipField.text-case, root.selected.text-case == 3 ? 0 : 3); root.commit(); }
+ }
}
// The fill has no alpha of its own: the title's Opacity below is
diff --git a/src/crates/concat/ui/primitives/panel.slint b/src/crates/concat/ui/primitives/panel.slint
index 1ddca92b..f0b8efca 100644
--- a/src/crates/concat/ui/primitives/panel.slint
+++ b/src/crates/concat/ui/primitives/panel.slint
@@ -225,8 +225,11 @@ export component IconButton inherits Rectangle {
in property <Glyph> glyph;
/// text label instead of a glyph, for toggles like M / S
in property <string> text;
+ in property <int> text-weight: 400;
+ in property <bool> text-italic: false;
/// accessible name; also what a tooltip would show
in property <string> label;
+ in property <bool> tooltip: true;
in property <bool> checked;
in property <bool> enabled: true;
/// Destructive action: the button states in red instead of the neutral
@@ -337,6 +340,8 @@ export component IconButton inherits Rectangle {
text: root.text;
color: root.tint;
font-size: Theme.fs;
+ font-weight: root.text-weight;
+ font-italic: root.text-italic;
horizontal-alignment: center;
vertical-alignment: center;
}
@@ -357,7 +362,7 @@ export component IconButton inherits Rectangle {
// is worth most.
Tip {
text: root.label;
- active: touch.has-hover;
+ active: root.tooltip && touch.has-hover;
}
FocusRing {
diff --git a/src/crates/concat/ui/timeline/model.slint b/src/crates/concat/ui/timeline/model.slint
index 11950c10..390d3a87 100644
--- a/src/crates/concat/ui/timeline/model.slint
+++ b/src/crates/concat/ui/timeline/model.slint
@@ -169,7 +169,7 @@ export enum ClipField {
scale, offset-x, offset-y, rotation, stretch-x, stretch-y, opacity,
volume, speed, preserve-pitch, fade-in, fade-out,
flip-h, flip-v, blend, crop-left, crop-top, crop-right, crop-bottom,
- font-size, font-weight, italic, text-opacity, align,
+ font-size, font-weight, italic, underline, strikethrough, text-case, text-opacity, align,
stroke-width, shadow, line-height, tracking, text-width, text-height,
stroke-opacity,
/// the background's opacity is its colour's alpha, as the stroke's is;
@@ -486,6 +486,9 @@ export struct SelectedClipData {
font-size: float,
font-weight: float,
italic: bool,
+ underline: bool,
+ strikethrough: bool,
+ text-case: int,
fill: color,
fill-hex: string,
align: TextAlignment,