From f63f663acc3f56569c257c00874ef89d2ad37506 Mon Sep 17 00:00:00 2001 From: Thorin-Oakenpants Date: Fri, 6 Jan 2023 07:56:56 +0000 Subject: [PATCH] don't compound tofu in glyphs (#219) https://github.com/arkenfox/TZP/issues/166#issuecomment-1373285759 --- js/fonts.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/js/fonts.js b/js/fonts.js index c400d983..57ba9c1a 100644 --- a/js/fonts.js +++ b/js/fonts.js @@ -7,6 +7,7 @@ let fntCode = ['0x20B9','0x2581','0x20BA','0xA73D','0xFFFD','0x20B8','0x05C6', '0x061C','0x20E3','0xFFF9','0x0218','0x058F','0x08E4','0x09B3','0x1C50','0x2619', // '0xFFFF', // we add this tofu later ], + fntCodeUsed = [], fntStrA = "mmmLLLmmmWWWwwwmmmllliii", fntStrB = "", fntList = [], // what we use @@ -18,8 +19,6 @@ let fntCode = ['0x20B9','0x2581','0x20BA','0xA73D','0xFFFD','0x20B8','0x05C6', baseFontsNames = [], // baseFonts w/out any fallback fonts (used to create arrays etc) baseFontsFull = [] // merged baseFonts + baseMaster -fntCode.sort() - /*** TEMP FUNCTIONS ***/ function listfontsizes() { let sizelog = [] @@ -1269,7 +1268,6 @@ function get_unicode() { output() } - let fntCodeUsed = fntCode function filter_tofu() { // skip FF android and TB: very little tofu if (isFF && isOS == "android" || isTB) { @@ -1295,7 +1293,7 @@ function get_unicode() { fntTofuChars.push(String.fromCodePoint(code)) } }) - fntCodeUsed = fntCode.filter(x => !fntTofu.includes(x)) + fntCodeUsed = fntCodeUsed.filter(x => !fntTofu.includes(x)) if (gRun) { let tofuPerf = ""; if (canPerf) {tofuPerf = " | "+ (performance.now() - tofuStart) +" ms"} log_debug("tofu", fntTofu.join(" ") + tofuPerf) @@ -1303,8 +1301,12 @@ function get_unicode() { } } catch(e) {} } - filter_tofu() - fntCodeUsed.push('0xFFFF') // ensure one tofu + // do once + if (fntCodeUsed.length == 0) { + fntCode.forEach(function(code) {fntCodeUsed.push(code)}) + filter_tofu() + fntCodeUsed.push('0xFFFF') // ensure one tofu + } run() }) }