diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0321283b..0a7745de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - - uses: dtolnay/rust-toolchain@e814c742d4444ce2f3f6abddea7faf00161ed941 # 1.88.0 + - uses: dtolnay/rust-toolchain@87eb139fed4b08a67bd1fa429a21d1f5d523e03e # 1.92.0 - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 - run: cargo test --workspace --all-features --no-run - run: cargo test --workspace --all-features --no-fail-fast @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - - uses: dtolnay/rust-toolchain@e814c742d4444ce2f3f6abddea7faf00161ed941 # 1.88.0 + - uses: dtolnay/rust-toolchain@87eb139fed4b08a67bd1fa429a21d1f5d523e03e # 1.92.0 with: components: clippy, rustfmt - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 diff --git a/Cargo.toml b/Cargo.toml index 527944ec..38686a18 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "codex" version = "0.3.0" -rust-version = "1.88" # also change in ci.yml +rust-version = "1.92" # also change in ci.yml authors = ["The Typst Project Developers"] edition = "2024" description = "Human-friendly notation for Unicode symbols." diff --git a/src/styling.rs b/src/styling.rs index 822225bb..17055773 100644 --- a/src/styling.rs +++ b/src/styling.rs @@ -5,7 +5,7 @@ use std::iter::FusedIterator; /// The version of [Unicode](https://www.unicode.org/) that this version of the /// styling module is based on. -pub const UNICODE_VERSION: (u8, u8, u8) = (17, 0, 0); +pub const UNICODE_VERSION: (u8, u8, u8) = (18, 0, 0); /// A style for mathematical symbols. /// @@ -67,7 +67,8 @@ pub enum MathStyle { Bold, /// Italic style. May be serif or sans-serif depending on the font. /// - /// Supported characters: latin, greek, dotless, and the extra ħ (U+0127). + /// Supported characters: latin, greek, dotless, and the extra ħ (U+0127) + /// and 𝾕 (U+1DF95). Italic, /// Bold italic style. May be serif or sans-serif depending on the font. /// @@ -266,7 +267,7 @@ impl MathStyle { (_, true, None) if is_latin(c) | is_lower_greek(c) => MathStyle::BoldItalic, (_, true, None) if is_upper_greek(c) => MathStyle::Bold, (_, true, _) if is_digit(c) | matches!(c, 'Ϝ' | 'ϝ') => MathStyle::Bold, - (_, _, Some(true) | None) if matches!(c, 'ı' | 'ȷ' | 'ħ') => { + (_, _, Some(true) | None) if matches!(c, 'ı' | 'ȷ' | 'ħ' | '𝾕') => { MathStyle::Italic } (_, _, Some(true) | None) if is_hebrew(c) => MathStyle::Hebrew, @@ -413,7 +414,7 @@ pub fn to_style(c: char, style: MathStyle) -> ToStyle { /// All functions in this module expect that characters have been normalized /// through [`conversions::normalize`]. /// -/// [Unicode Core Specification - Section 22.2, Letterlike Symbols]: +/// [Unicode Core Specification - Section 22.2, Letterlike Symbols]: /// [Letterlike Symbols]: /// [Mathematical Alphanumeric Symbols]: /// [Arabic Mathematical Alphabetic Symbols]: @@ -472,8 +473,8 @@ mod conversions { /// The character given by adding `delta` to the codepoint of `c`. #[inline] - fn apply_delta(c: char, delta: u32) -> char { - std::char::from_u32((c as u32) + delta).unwrap() + fn apply_delta(c: char, delta: i32) -> char { + std::char::from_u32((c as u32).strict_add_signed(delta)).unwrap() } pub fn to_bold(c: char) -> char { @@ -519,6 +520,8 @@ mod conversions { // Dotless symbols (U+1D6A4..U+1D6A5) 'ı' => 0x1D573, 'ȷ' => 0x1D46E, + // Ligature long s (U+1D6A6) + '𝾕' => -0x8EF, // Italic Greek symbols (U+1D6E2..U+1D714) 'Α'..='Ρ' => 0x1D351, 'ϴ' => 0x1D2FF, @@ -878,7 +881,7 @@ mod conversions { 'Γ' => 0x1DAB, 'Π' => 0x1D9F, // Double-struck large operator (U+2140) - '∑' => return '⅀', // delta is negative + '∑' => -0xD1, // delta is negative // Mathematical Alphanumeric Symbols Block (U+1D400..U+1D7FF) // Double-struck symbols (U+1D538..U+1D56B)