From bb8b7a66baf116cdc5e56ac6bd5e7556043c7315 Mon Sep 17 00:00:00 2001 From: fGolke <87950255+fGolke@users.noreply.github.com> Date: Sat, 5 Apr 2025 21:58:33 +0200 Subject: [PATCH] Fix formatting --- crates/typst-layout/src/math/text.rs | 20 ++++++++------------ crates/typst-library/src/math/style.rs | 3 +-- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/crates/typst-layout/src/math/text.rs b/crates/typst-layout/src/math/text.rs index 043d95b3f..8c6c62af6 100644 --- a/crates/typst-layout/src/math/text.rs +++ b/crates/typst-layout/src/math/text.rs @@ -189,20 +189,16 @@ fn styled_char(styles: StyleChain, c: char, auto_italic: bool) -> char { let bold = EquationElem::bold_in(styles); let default_style = EquationElem::default_style_in(styles); let default_italic = match c { - 'a'..='z' | 'ħ' | 'ı' | 'ȷ' | - 'α'..='ω' | 'ϵ' | 'ϑ' | 'ϰ' | 'ϕ' | 'ϱ' | 'ϖ' => - matches!(default_style, MathStyle::Iso | MathStyle::Tex | MathStyle::French), - 'A'..='Z' => - matches!(default_style, MathStyle::Iso | MathStyle::Tex), - 'Α'..='Ω' => - matches!(default_style, MathStyle::Iso), - '∂' => - matches!(default_style, MathStyle::Tex | MathStyle::French), + 'a'..='z' | 'ħ' | 'ı' | 'ȷ' | 'α'..='ω' | 'ϵ' | 'ϑ' | 'ϰ' | 'ϕ' | 'ϱ' | 'ϖ' => { + matches!(default_style, MathStyle::Iso | MathStyle::Tex | MathStyle::French) + } + 'A'..='Z' => matches!(default_style, MathStyle::Iso | MathStyle::Tex), + 'Α'..='Ω' => matches!(default_style, MathStyle::Iso), + '∂' => matches!(default_style, MathStyle::Tex | MathStyle::French), _ => false }; - let italic = EquationElem::italic_in(styles).unwrap_or( - auto_italic && default_italic && matches!(variant, Sans | Serif), - ); + let italic = EquationElem::italic_in(styles) + .unwrap_or(auto_italic && default_italic && matches!(variant, Sans | Serif)); if let Some(c) = basic_exception(c) { return c; diff --git a/crates/typst-library/src/math/style.rs b/crates/typst-library/src/math/style.rs index 759f3ed17..f74082994 100644 --- a/crates/typst-library/src/math/style.rs +++ b/crates/typst-library/src/math/style.rs @@ -253,7 +253,6 @@ pub enum MathVariant { Bb, } - /// A rule describing which letters and symbols are italic by default. #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Cast, Hash)] // #[derive(Serialize, Deserialize, Cast)] @@ -266,5 +265,5 @@ pub enum MathStyle { // Lowercase letters and [partial] italic. French, // Everything upright. - Upright + Upright, }