Skip to content
Open
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
32 changes: 31 additions & 1 deletion src/styling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,9 @@ mod conversions {

#[inline]
pub fn is_upper_greek(c: char) -> bool {
matches!(c, 'Α'..='Ω' | '∇' | 'ϴ')
// The last character is U+2126 OHM SIGN, which canonically
// decomposes to the regular capital Omega (U+03A9).
matches!(c, 'Α'..='Ω' | '∇' | 'ϴ' | 'Ω')
}

#[inline]
Expand Down Expand Up @@ -463,6 +465,7 @@ mod conversions {
'ϴ' => 0x1D2C5,
'Σ'..='Ω' => 0x1D317,
'∇' => 0x1B4BA,
'Ω' => 0x1B59A,
'α'..='ω' => 0x1D311,
// Additional bold Greek symbols (U+1D6DB..U+1D6E1)
'∂' => 0x1B4D9,
Expand Down Expand Up @@ -500,6 +503,7 @@ mod conversions {
'ϴ' => 0x1D2FF,
'Σ'..='Ω' => 0x1D351,
'∇' => 0x1B4F4,
'Ω' => 0x1B5D4,
'α'..='ω' => 0x1D34B,
// Additional italic Greek symbols (U+1D715..U+1D71B)
'∂' => 0x1B513,
Expand All @@ -525,6 +529,7 @@ mod conversions {
'ϴ' => 0x1D339,
'Σ'..='Ω' => 0x1D38B,
'∇' => 0x1B52E,
'Ω' => 0x1B60E,
'α'..='ω' => 0x1D385,
// Additional bold italic Greek symbols (U+1D74F..U+1D755)
'∂' => 0x1B54D,
Expand Down Expand Up @@ -628,6 +633,7 @@ mod conversions {
'ϴ' => 0x1D373,
'Σ'..='Ω' => 0x1D3C5,
'∇' => 0x1B568,
'Ω' => 0x1B648,
'α'..='ω' => 0x1D3BF,
// Additional sans-serif bold Greek symbols (U+1D789..U+1D78F)
'∂' => 0x1B587,
Expand Down Expand Up @@ -666,6 +672,7 @@ mod conversions {
'ϴ' => 0x1D3AD,
'Σ'..='Ω' => 0x1D3FF,
'∇' => 0x1B5A2,
'Ω' => 0x1B682,
'α'..='ω' => 0x1D3F9,
// Additional sans-serif bold italic Greek symbols (U+1D7C3..U+1D7C9)
'∂' => 0x1B5C1,
Expand Down Expand Up @@ -940,3 +947,26 @@ mod conversions {
apply_delta(c, delta)
}
}

#[cfg(test)]
mod test {
use super::*;

/// U+2126 OHM SIGN canonically decomposes to U+03A9 GREEK CAPITAL LETTER
/// OMEGA and should therefore be styled the same way.
#[test]
fn ohm_sign_styles_like_capital_omega() {
const OHM: char = '\u{2126}';
const OMEGA: char = '\u{03A9}';

for f in [
conversions::to_bold,
conversions::to_italic,
conversions::to_bold_italic,
conversions::to_sans_serif_bold,
conversions::to_sans_serif_bold_italic,
] {
assert_eq!(f(OHM), f(OMEGA))
}
}
}
Loading