mirror of
https://github.com/storytold/deckcraft.git
synced 2026-12-01 18:23:52 -06:00
Apply review fixes
- crates/text/src/shape.rs - crates/text/src/symbol.rs
This commit is contained in:
@@ -255,12 +255,13 @@ fn shape_cells(
|
||||
}
|
||||
}
|
||||
}
|
||||
// Items: maximal ranges of one level, face, script and shaping style (case mapping, language).
|
||||
// Items: maximal ranges of one level, face, script and shaping style (case mapping, language, a:sym symbol font).
|
||||
let upper = |i: usize| styles.get(char_style.get(i).copied().unwrap_or(0)).is_some_and(|st| st.caps != Caps::None);
|
||||
let lang = |i: usize| styles.get(char_style.get(i).copied().unwrap_or(0)).and_then(|st| st.lang.as_deref());
|
||||
let kern = |i: usize| styles.get(char_style.get(i).copied().unwrap_or(0)).is_some_and(|st| st.kern);
|
||||
let up = |i: usize| cells.get(i).is_some_and(|c| c.upright);
|
||||
let key = |i: usize| (levels.get(i).copied(), char_face.get(i).copied(), scripts.get(i).map(|s| s.0), upper(i), lang(i), kern(i), up(i));
|
||||
let sym = |i: usize| styles.get(char_style.get(i).copied().unwrap_or(0)).and_then(|st| st.sym.as_deref());
|
||||
let key = |i: usize| (levels.get(i).copied(), char_face.get(i).copied(), scripts.get(i).map(|s| s.0), upper(i), lang(i), kern(i), up(i), sym(i));
|
||||
let mut items: Vec<(usize, usize)> = Vec::new();
|
||||
let mut a = 0;
|
||||
while a < n {
|
||||
|
||||
@@ -32,8 +32,8 @@ pub(crate) fn symbol_map_char(face: &FontFace, ch: char, sym: Option<&str>) -> O
|
||||
|
||||
/// The Unicode look-alike that draws `ch`, a U+F0xx private-use code of the `a:sym` symbol font
|
||||
/// `sym`, when that font is not installed (or does not draw the code): the characters bullets use
|
||||
/// for these fonts. `None` when `ch` is not such a code, `sym` is not a symbol font, or the code
|
||||
/// has no standard Unicode character (the Symbol font's fragment glyphs).
|
||||
/// for these fonts. `None` when `ch` is not such a code, `sym` is not a symbol font, or a Symbol-font code
|
||||
/// has no standard Unicode character (its fragment glyphs); Wingdings and Webdings codes without a look-alike draw as a bullet.
|
||||
pub(crate) fn symbol_fallback_char(ch: char, sym: Option<&str>) -> Option<char> {
|
||||
let code = ch as u32;
|
||||
if !(0xF000..=0xF0FF).contains(&code) {
|
||||
|
||||
Reference in New Issue
Block a user