mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-25 07:10:43 -04:00
Use unicode standard 0xA0-0xFF for Latin 1 characters (#1263)
* Update chars 0xA0-0xFF to match unicode * Update ui_text.hpp Update chars 0xA0-0xFF to match unicode * Use unicode 0xB0 for degree character * Clang
This commit is contained in:
parent
6b4f1a552e
commit
a44e8b9921
3 changed files with 23 additions and 4 deletions
|
@ -24,11 +24,26 @@
|
|||
namespace ui {
|
||||
|
||||
Glyph Font::glyph(const char c) const {
|
||||
size_t index;
|
||||
|
||||
if (c < c_start) {
|
||||
// Non-display C0 Control characters - map to blank (index 0)
|
||||
return {w, h, data};
|
||||
}
|
||||
const size_t index = c - c_start;
|
||||
if (index >= c_count) {
|
||||
|
||||
// Handle gap in glyphs table for C1 Control characters 0x80-0x9F
|
||||
if (c < C1_CONTROL_CHARS_START) {
|
||||
// ASCII chars <0x80:
|
||||
index = c - c_start;
|
||||
} else if (c >= C1_CONTROL_CHARS_START + C1_CONTROL_CHARS_COUNT) {
|
||||
// Latin 1 chars 0xA0-0xFF
|
||||
index = c - c_start - C1_CONTROL_CHARS_COUNT;
|
||||
} else {
|
||||
// C1 Control characters - map to blank
|
||||
return {w, h, data};
|
||||
}
|
||||
|
||||
if (index >= c_count) { // Latin Extended characters > 0xFF - not supported
|
||||
return {w, h, data};
|
||||
} else {
|
||||
return {w, h, &data[index * data_stride]};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue