Skip to content

Commit

Permalink
don't compound tofu in glyphs (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thorin-Oakenpants authored Jan 6, 2023
1 parent 42b20f1 commit f63f663
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions js/fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = []
Expand Down Expand Up @@ -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) {
Expand All @@ -1295,16 +1293,20 @@ 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)
log_debug("tofu", fntTofuChars.join(" "))
}
} 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()
})
}
Expand Down

0 comments on commit f63f663

Please sign in to comment.