From 26ed00e3dc0f463026c358f9e9c6a1cabd75af40 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Debian Linux)" <rob@synchro.net>
Date: Tue, 22 Apr 2025 19:48:19 -0700
Subject: [PATCH] If lowercase char is not mapped to font, lookup the
 uppercased letter

Not all fonts have the lowercase chars mapped
---
 exec/load/tdfonts_lib.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/exec/load/tdfonts_lib.js b/exec/load/tdfonts_lib.js
index 7878793b00..29ed44d72d 100644
--- a/exec/load/tdfonts_lib.js
+++ b/exec/load/tdfonts_lib.js
@@ -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
     for (var i = 0; i < NUM_CHARS; i++) {
         // We need to find the index `i` in `charlist` that corresponds to `c`.
@@ -297,6 +297,14 @@ function lookupchar(c, font) {
     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)
 // This function's logic is now integrated into readchar.
 
-- 
GitLab