Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
13 changes: 8 additions & 5 deletions src/styling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down Expand Up @@ -265,7 +266,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,
Expand Down Expand Up @@ -448,8 +449,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 {
Expand Down Expand Up @@ -495,6 +496,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,
Expand Down Expand Up @@ -854,7 +857,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)
Expand Down
Loading