mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-19 04:48:12 +00:00
feat(core): deal with non-breaking spaces
[no changelog]
This commit is contained in:
parent
a35e9ba5fa
commit
5188dfc83d
@ -5,6 +5,7 @@
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
<%
|
||||
import json
|
||||
import re
|
||||
|
||||
ALTCOIN_PREFIXES = (
|
||||
"binance",
|
||||
@ -55,7 +56,7 @@ impl TranslatedString {
|
||||
%if any(name.startswith(prefix + "__") for prefix in ALTCOIN_PREFIXES):
|
||||
#[cfg(feature = "universal_fw")]
|
||||
%endif
|
||||
Self::${name} => ${json.dumps(en_data.get(name, '""'))},
|
||||
Self::${name} => ${re.sub(r'\\u([0-9a-f]{4})', r'\\u{\g<1>}', json.dumps(en_data.get(name, '""')))},
|
||||
% endfor
|
||||
}
|
||||
}
|
||||
|
@ -285,6 +285,12 @@ impl Font {
|
||||
}
|
||||
|
||||
pub fn get_glyph(self, ch: char) -> Glyph {
|
||||
/* have the non-breaking space counted for width but not counted as a
|
||||
* breaking point */
|
||||
let ch = match ch {
|
||||
'\u{00a0}' => '\u{0020}',
|
||||
c => c,
|
||||
};
|
||||
let gl_data = display::get_char_glyph(ch as u16, self.into());
|
||||
|
||||
ensure!(!gl_data.is_null(), "Failed to load glyph");
|
||||
|
@ -107,7 +107,7 @@ def _resolve_path_to_texts(
|
||||
|
||||
if lower:
|
||||
texts = [t.lower() for t in texts]
|
||||
texts = [t.strip() for t in texts]
|
||||
texts = [t.replace("\xa0", " ").strip() for t in texts]
|
||||
return texts
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user