fonts linux: test whitelist breakage
not an issue, but a Q for @pierov
In my much awaited but not yet deployed new fang-dangled snazzy TZP (30% smaller, 30% faster, with MOAR metrics), I am not just collecting font enumeration and sizes, but now also checking that any whitelist (or RFP's font vis) doesn't leak (as well as for missing bundled fonts in TB). But there is no need to check massive lists in TB, as most fonts are bundled: this would just adds lots of perf overhead
sample code
lists are snipped for brevity where stated
let fntMaster = {
// TB bundled
"bundled": {
"all": [ // 118 win/mac/linux
"Noto Sans Adlam","Noto Sans Balinese", // SNIP
],
"android": [],
"linux": [ // +16
"Arimo","Cousine", // SNIP
],
"mac": [ // +5
"Noto Sans Armenian","Noto Sans Hebrew", // SNIP
],
"windows": [ // +4
"Noto Naskh Arabic", // SNIP
],
},
// TB whitelist
"allowlist": {
"android": [],
"linux": [],
"mac": [
"AppleGothic","Apple Color Emoji", // SNIP
],
"windows": [
"Arial","Cambria Math" // SNIP
],
},
// TB unexpected: to catch failures
"blocklist": {
"android": [],
"linux": [
'Arial','Courier','Courier New','Noto Emoji','Noto Sans','Noto Serif',
'Noto Color Emoji','Noto Mono','Cantarell','DejaVu Sans','DejaVu Serif',
'Droid Sans','STIX','Symbola','Dingbats','FreeMono','Ubuntu',
],
"mac": ["Apple Symbols","Avenir","Charter","Impact","Palatino","Rockwell",],
"windows": ["Calibri","Candara","Corbel","Impact","Ebrima","Gabriola",],
},
so we end up with something like this, where the green [TB]
notation means no bundled fonts were missing AND we didn't leak anything outside the whitelist (I call it an allowlist on the page so as to not be offensive). The bundled list (122) is a subset of allowed (155), which is a subset of the fonts tested (162 - which includes a fake random font as a poison pill)
Now windows/mac is simple - I can add expected system fonts since win7/macOS10.12 to the "blocklist" and if they are detected then the whitelist is failing.
But linux is trickier. My initial "blocklist"ed items are, I think fairly common, especially on ubuntu and fedora, but I am not super linux font savvy. Can you improve on this list (without going massive on it: smaller is better) - see code example