Skip to content
Snippets Groups Projects
Commit 26ed00e3 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

If lowercase char is not mapped to font, lookup the uppercased letter

Not all fonts have the lowercase chars mapped
parent ba79c367
No related branches found
No related tags found
No related merge requests found
Pipeline #8883 passed
...@@ -280,7 +280,7 @@ function readchar(i, font) { // glyph argument is no longer needed, we return th ...@@ -280,7 +280,7 @@ function readchar(i, font) { // glyph argument is no longer needed, we return th
} }
function lookupchar(c, font) { function lookupchar_code(c, font) {
var char_code = c.charCodeAt(0); // Get the ASCII value of the character var char_code = c.charCodeAt(0); // Get the ASCII value of the character
for (var i = 0; i < NUM_CHARS; i++) { for (var i = 0; i < NUM_CHARS; i++) {
// We need to find the index `i` in `charlist` that corresponds to `c`. // We need to find the index `i` in `charlist` that corresponds to `c`.
...@@ -297,6 +297,14 @@ function lookupchar(c, font) { ...@@ -297,6 +297,14 @@ function lookupchar(c, font) {
return -1; // Character not found in charlist return -1; // Character not found in charlist
} }
// Lookup the uppercase char if lowercase char not mapped to font
function lookupchar(c, font) {
var result = lookupchar_code(c, font);
if (result == -1)
result = lookupchar_code(c.toUpperCase(), font);
return result;
}
// ibmtoutf8 function (using system.text_to_utf8 as a replacement for iconv) // ibmtoutf8 function (using system.text_to_utf8 as a replacement for iconv)
// This function's logic is now integrated into readchar. // This function's logic is now integrated into readchar.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment