Skip to content

Commit 92d480f

Browse files
add variable fontWeight, #215
1 parent e082b04 commit 92d480f

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

tests/fontlists.html

+16-5
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@
6262
fntBaseDimensions = "",
6363
fntPoison = "",
6464
baseFonts = ['monospace','sans-serif','serif'],
65-
baseGeneric = baseFonts
65+
baseGeneric = baseFonts,
66+
fntWeight = "normal"
67+
6668

6769
// remember results across the two tests
6870
let notFoundInMin = [],
@@ -112,8 +114,11 @@
112114
android: [],linux: [],
113115
mac: [
114116
// ESR102 whitelist minus bundled
115-
// ToDo: mac: check PingFang + Songti variants from other: e.g. Songti SC Black","Songti SC Light","Songti TC Light"
116-
"AppleGothic","Apple Color Emoji","Arial","Arial Black","Arial Narrow","Courier","Geneva","Georgia","Heiti TC","Helvetica","Helvetica Neue",".Helvetica Neue DeskInterface","Hiragino Kaku Gothic ProN","Hiragino Kaku Gothic ProN W3","Hiragino Kaku Gothic ProN W6","Kailasa","Lucida Grande","Menlo","Monaco","PingFang HK","PingFang SC","PingFang TC","Songti SC","Songti TC","Tahoma","Thonburi","Times","Times New Roman","Verdana",
117+
"AppleGothic","Apple Color Emoji","Arial","Arial Black","Arial Narrow","Courier","Courier New","Geneva",
118+
"Georgia","Heiti TC","Helvetica","Helvetica Neue",".Helvetica Neue DeskInterface",
119+
"Hiragino Kaku Gothic ProN","Hiragino Kaku Gothic ProN W3","Hiragino Kaku Gothic ProN W6",
120+
"Kailasa","Lucida Grande","Menlo","Monaco","PingFang HK","PingFang SC","PingFang TC",
121+
"Songti SC","Songti TC","Tahoma","Thonburi","Times","Times New Roman","Verdana",
117122
],
118123
windows: [
119124
// ESR102 whitelist
@@ -486,7 +491,8 @@
486491

487492
let foundhash = mini(data)
488493
dom.results.innerHTML = display.join("<br>")
489-
+"<p><details><summary>"+ s12 +"ALL FOUND FONTS ["+ data.length +"] "+ sc + foundhash + allStr + poisonString + "</summary><p>"
494+
+"<p><details><summary>"+ s12 +"ALL FOUND FONTS ["+ data.length +"] "+ sc
495+
+ foundhash + allStr + " [font-weight: "+ fntWeight +"]" + poisonString + "</summary><p>"
490496
+ dataString + "<br><br></p></details>"
491497
}
492498
}
@@ -612,6 +618,11 @@
612618
fntPoison = ""
613619
oBaseFonts = {}
614620

621+
// check fntWeight
622+
fntWeight += ""
623+
let fntWeightValid = ["100","200","300","400","500","600","700","800","900","950",]
624+
if (!fntWeightValid.includes(fntWeight)) {fntWeight = "normal"}
625+
615626
const doc = document // or iframe.contentWindow.document
616627
const id = `font-fingerprint`
617628
const div = doc.createElement('div')
@@ -625,7 +636,7 @@
625636
left: -9999px!important;
626637
font-size: 256px !important;
627638
font-style: normal !important;
628-
font-weight: normal !important;
639+
font-weight: ` + fntWeight + ` !important;
629640
letter-spacing: normal !important;
630641
line-break: auto !important;
631642
line-height: normal !important;

0 commit comments

Comments
 (0)