Skip to content

Commit 1dfbe15

Browse files
tweak (#374)
1 parent aadc947 commit 1dfbe15

File tree

2 files changed

+67
-56
lines changed

2 files changed

+67
-56
lines changed

js/fonts.js

+60-48
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,14 @@ let fntMaster = {
125125
'ヘルベチカ','タイムズロマン','クーリエ', // Arial, TNR, Courier - >Courier New
126126
],
127127
windowsface: [
128+
// weighted
128129
'Arial Black','Segoe UI Light','Segoe UI Semibold', // 7
129130
'Segoe UI Semilight', // 8
130131
'Microsoft JhengHei Light','Microsoft YaHei Light','Segoe UI Black', // 8.1
131132
'Malgun Gothic Semilight', // 10
133+
// other
134+
'Georgia','MS Gothic','Tahoma', // system
135+
'Noto Sans Gujarati','Noto Serif Dogra','Twemoji Mozilla', // bundled
132136
],
133137
},
134138
// TB unexpected
@@ -138,6 +142,7 @@ let fntMaster = {
138142
'Noto Color Emoji','Noto Emoji','Noto Mono','Noto Sans','Noto Serif', // notos
139143
'Cantarell','DejaVu Sans','DejaVu Serif','Droid Sans','STIX', // fedora
140144
'Dingbats','FreeMono','Ubuntu', // ubuntu
145+
'Bitstream Charter','C059','Nimbus Sans','P052','Quicksand', // debian
141146
'Liberation Mono','Liberation Sans','Liberation Serif', // popular
142147
'Noto Serif Hmong Nyiakeng','Noto Sans Symbols2','STIX Math', // TB12 fontnames
143148
],
@@ -147,16 +152,24 @@ let fntMaster = {
147152
'.Helvetica Neue DeskInterface', // dot-prefixed font families on mac = hidden // tb#42377
148153
],
149154
windows: [
150-
'Calibri', 'Candara', // 'Corbel','Ebrima','Gabriola', // system
151-
'MS Dlg Shell', // system that should point to Microsoft Sans Serif
155+
'Calibri','Candara', // system
156+
'MS Shell Dlg', // system alias == Microsoft Sans Serif
152157
'Gill Sans','Gill Sans MT', // MS bundled
153-
'Noto Serif Hmong Nyiakeng', // 'Noto Sans Symbols2', // TB12 fontnames
158+
// other
159+
'Noto Sans Symbols2', // TB12 bundled
154160
],
155161
windowsface: [
162+
// weighted
156163
// 'Arial Narrow', // ToDo: uncomment once we block it
157164
'Calibri Light', // 8
158165
'Microsoft JhengHei UI Light','Nirmala UI Semilight', // 8.1
159166
'Candara Light','Corbel Light','Yu Gothic UI Light', // 10
167+
// other
168+
'Corbel','Ebrima', // system
169+
'Gill Sans','Gill Sans MT', // MS bundled
170+
'Noto Serif Hmong Nyiakeng', // TB12 bundled
171+
'Arabic Transparent', // fontSubstitutes do not apply even if allowed
172+
'MS Serif','Roman', // system aliases do not apply even if allowed
160173
],
161174
},
162175
// kBaseFonts: https://searchfox.org/mozilla-central/search?path=StandardFonts*.inc
@@ -270,6 +283,7 @@ let fntMaster = {
270283
//*/
271284
],
272285
windowsface :[
286+
// weighted
273287
'Arial Black','Arial Narrow','Segoe UI Light','Segoe UI Semibold', // 7
274288
'Calibri Light','Segoe UI Semilight', // 8
275289
// 8.1
@@ -297,7 +311,7 @@ let fntMaster = {
297311
'Shonar Bangla','Shruti','SimHei','Simplified Arabic','Traditional Arabic','Tunga','UD Digi Kyokasho N-B','UD Digi Kyokasho N-R',
298312
'UD Digi Kyokasho NK-B','UD Digi Kyokasho NK-R','UD Digi Kyokasho NP-B','UD Digi Kyokasho NP-R','Urdu Typesetting','Utsaah',
299313
'Vani','Vijaya','Vrinda','Yu Mincho',
300-
// localized ^
314+
// localized from ^
301315
'바탕', // Batang
302316
'BIZ UDPゴシック', // BIZ UDPGothic
303317
'굴림', // Gulim
@@ -469,7 +483,6 @@ let fntMaster = {
469483
}
470484

471485
function set_fntList() {
472-
let fntListBaseName = isTB ? 'allowlist' : 'kBaseFonts'
473486
let build = (gLoad || isFontSizesMore !== isFontSizesPrevious)
474487

475488
if (build) {
@@ -620,39 +633,52 @@ function set_fntList() {
620633
fntData.baselang.sort()
621634
fntData.fpp.sort()
622635
fntData.full.sort()
623-
// fntBtns
624-
let str = 'fonts_'+ isOS, fntBtnBundled, fntBtnSystem, fntBtnBase, fntBtnBaseLang, fntBtnFPP, fntBtnUnexpected, fntBtnAll
625-
fntBtnBundled = addButton(12, str +'_bundled', fntData.bundled.length, 'btnc', 'lists')
626-
fntBtnSystem = addButton(12, str +'_system', fntData.system.length, 'btnc', 'lists')
627-
fntBtnUnexpected = addButton(12, str +'_unexpected', fntData.unexpected.length, 'btnc', 'lists')
628-
fntBtnBase = addButton(12, str +'_'+ fntListBaseName, fntData.base.length, 'btnc', 'lists')
629-
fntBtnBaseLang = addButton(12, str +'_kLangPackFonts', fntData.baselang.length, 'btnc', 'lists')
630-
fntBtnFPP = addButton(12, str +'_FPP', fntData.fpp.length, 'btnc', 'lists')
631-
fntBtnAll = addButton(12, str, fntData.full.length, 'btnc', 'lists')
636+
632637
// fntBtn
633-
if ('android' == isOS) {
634-
fntBtn = fntBtnAll
635-
} else if (isTB) {
636-
fntBtn = fntBtnSystem +' + '+ fntBtnBundled +' = '+ fntBtnBase +' + '+ fntBtnUnexpected +' = '+ fntBtnAll
637-
} else if ('windows' == isOS) {
638-
fntBtn = fntBtnBase +' + '+ fntBtnBaseLang +' = '+ fntBtnFPP +' + '+ fntBtnUnexpected +' = '+ fntBtnAll
638+
let fntobj = {}
639+
if ('android' == isOS || !isTB && 'linux' == isOS) {
640+
fntobj = fntData.full
641+
} else if (isTB || 'windows' == isOS) {
642+
if (isTB) {
643+
fntobj = {'1. system': {count: fntData.system.length, 'fonts': fntData.system},
644+
'2. bundled': {count: fntData.bundled.length, 'fonts': fntData.bundled},
645+
'3. allowlist': {count: fntData.base.length, 'fonts': fntData.base},
646+
}
647+
} else {
648+
fntobj = {'1. kBaseFonts': {count: fntData.base.length, 'fonts': fntData.base},
649+
'2. kLangPackFonts': {count: fntData.baselang.length, 'fonts': fntData.baselang},
650+
'3. FPP': {count: fntData.fpp.length, 'fonts': fntData.fpp},
651+
}
652+
}
653+
fntobj['4. unexpected'] = {count: fntData.unexpected.length, 'fonts': fntData.unexpected}
654+
fntobj['5. tested'] = {count: fntData.full.length, 'fonts': fntData.full}
639655
} else {
640-
fntBtn = (isOS !== 'linux' ? fntBtnBase : '') + fntBtnAll
656+
//mac
657+
fntobj = {'1. kBaseFonts': {count: fntData.base.length, 'fonts': fntData.base},
658+
'2. unexpected': {count: fntData.unexpected.length, 'fonts': fntData.unexpected},
659+
'3. tested': {count: fntData.full.length, 'fonts': fntData.full},
660+
}
641661
}
642-
// fntBtnFaces
643-
let fntBtnFaces = '', strface = 'font_faces_'+ isOS
662+
fntData['summary'] = fntobj
663+
fntBtn = addButton(12, 'fonts_'+ isOS, fntData.full.length +' fonts', 'btnc', 'lists')
664+
665+
// fontFaces
644666
if (fntFaceData.full.length) {
645-
fntBtnUnexpected = addButton(12, strface +'_unexpected', fntFaceData.unexpected.length, 'btnc', 'lists')
646-
fntBtnBase = addButton(12, strface +'_'+ fntListBaseName, fntFaceData.base.length, 'btnc', 'lists')
647-
fntBtnBaseLang = addButton(12, strface +'_kLangPackFonts', fntFaceData.baselang.length, 'btnc', 'lists')
648-
fntBtnFPP = addButton(12, strface +'_FPP', fntFaceData.fpp.length, 'btnc', 'lists')
649-
fntBtnAll = addButton(12, strface, fntFaceData.full.length, 'btnc', 'lists')
650667
if (isTB) {
651-
fntBtnFaces = fntBtnBase +' + '+ fntBtnUnexpected +' = '+ fntBtnAll
668+
fntobj = {'1. allowlist': {count: fntFaceData.base.length, 'fonts': fntFaceData.base},
669+
'2. unexpected': {count: fntFaceData.unexpected.length, 'fonts': fntFaceData.unexpected},
670+
'3. tested': {count: fntFaceData.full.length, 'fonts': fntFaceData.full}
671+
}
652672
} else {
653-
fntBtnFaces = fntBtnBase +' + '+ fntBtnBaseLang +' = '+ fntBtnFPP +' + '+ fntBtnUnexpected +' = '+ fntBtnAll
673+
fntobj = {'1. kBaseFonts': {count: fntFaceData.base.length, 'fonts': fntFaceData.base},
674+
'2. kLangPackFonts': {count: fntFaceData.baselang.length, 'fonts': fntFaceData.baselang},
675+
'3. FPP': {count: fntFaceData.fpp.length, 'fonts': fntFaceData.fpp},
676+
'4. unexpected': {count: fntFaceData.unexpected.length, 'fonts': fntFaceData.unexpected},
677+
'5. tested': {count: fntFaceData.full.length, 'fonts': fntFaceData.full}
678+
}
654679
}
655-
fntBtn = fntBtnFaces +' | '+ fntBtn
680+
fntFaceData['summary'] = fntobj
681+
fntBtn = addButton(12, 'font_faces_'+ isOS, fntFaceData.full.length +' faces', 'btnc', 'lists') +' | '+ fntBtn
656682
}
657683
}
658684
}
@@ -661,22 +687,8 @@ function set_fntList() {
661687

662688
// fnt*Btn data
663689
if (gRun || build) {
664-
let str = 'fonts_'+ isOS
665-
let strface = 'font_faces_'+ isOS
666-
addDetail(str +'_system', fntData.system, 'lists')
667-
addDetail(str +'_bundled', fntData.bundled, 'lists')
668-
addDetail(str +'_'+ fntListBaseName, fntData.base, 'lists')
669-
addDetail(str +'_kLangPackFonts', fntData.baselang, 'lists')
670-
addDetail(str +'_FPP', fntData.fpp, 'lists')
671-
addDetail(str +'_unexpected', fntData.unexpected, 'lists')
672-
addDetail(str, fntData.full, 'lists')
673-
if (fntFaceData.full.length) {
674-
addDetail(strface +'_'+ fntListBaseName, fntFaceData.base, 'lists')
675-
addDetail(strface +'_kLangPackFonts', fntFaceData.baselang, 'lists')
676-
addDetail(strface +'_FPP', fntFaceData.fpp, 'lists')
677-
addDetail(strface +'_unexpected', fntFaceData.unexpected, 'lists')
678-
addDetail(strface, fntFaceData.full, 'lists')
679-
}
690+
addDetail('fonts_'+ isOS, fntData.summary, 'lists')
691+
addDetail('font_faces_'+ isOS, fntFaceData.summary, 'lists')
680692
}
681693
}
682694

@@ -698,7 +710,7 @@ function get_document_fonts(METRIC) {
698710
}
699711

700712
const get_fontfaces = (METRIC) => new Promise(resolve => {
701-
// testing non regular fonts + font face leaks
713+
// testing non regular fonts + font face leaks (i.e not just light/black etc)
702714
// it is problematic to test weighted fonts because you don't know
703715
// if it's synthesized, a variable font, or an actual font(name)
704716
// blocking document fonts does not affect this test

tzp.html

+7-8
Original file line numberDiff line numberDiff line change
@@ -714,23 +714,15 @@
714714
<span class="c" id="fontshash"></span>
715715
<div class="btn-right"><span class="c" id="fntBtn"></span></div>
716716
</td></tr>
717-
<tr><td>[test] graphite <sup>1</sup></td><td class="c mono" id="graphite"></td></tr>
718-
<tr><td>[css | test] woff2 <sup>2</sup></td><td class="mono">
719-
<span id="cssWoff2"></span> | <span class="c" id="woff2"></span></td></tr>
720717
<tr><td><div class="ttip"><span class="icon">[ i ]</span>
721718
<span class="ttxtx">browser.display.use_document_fonts</span></div>
722719
&nbsp; document fonts</td><td class="c mono" id="document_fonts"></td></tr>
723720
<tr><td><div class="ttip"><span class="icon">[ i ]</span>
724721
<span class="ttxtb">layout.css.font-tech.enabled</span></div>
725722
&nbsp; font-format | font-tech</td><td class="mono"><span class="c" id="font-format"></span> | <span class="c" id="font-tech"></span>
726723
</td></tr>
727-
<tr><td><div class="ttip"><span class="icon">[ i ]</span>
728-
<span class="ttxt">proportional font<br>monospace size<br>sans-serif size<br>serif size</span></div>
729-
&nbsp; script defaults</td><td class="c mono" id="script_defaults"></td></tr>
730724
<!--fonts-->
731725
<tr><td>[faces] fonts</td><td class="mono" id="font_faces"></td></tr>
732-
<tr><td>[methods] fonts <sup>3</sup></td>
733-
<td class="c mono" id="font_sizes_methods"></td></tr>
734726
<tr><td><span id="labelFS" class="btn btn0" onClick="togglerows('FS','btn')">[+]</span>
735727
[sizes | names] fonts <sup>3</sup></td>
736728
<td class="mono"><span class="c" id="font_sizes"></span> | <span class="c" id="font_names"></span></td>
@@ -749,10 +741,15 @@
749741
<tr><td>[base sizes] fonts <sup>3</sup></td><td class=" mono">
750742
<span class="c" id="font_sizes_base"></span> | <span class="c" id="font_sizes_base_reported"></span>
751743
</td></tr>
744+
<tr><td>[methods] fonts <sup>3</sup></td><td class="c mono" id="font_sizes_methods"></td></tr>
752745
<tr><td>[moz] fonts</td><td class="c mono" id="fonts_moz"></td></tr>
753746
<tr><td>[system] fonts</td><td class="c mono" id="fonts_system"></td></tr>
754747
<tr><td>[widget] fonts</td><td class="c mono" id="fonts_widget"></td></tr>
755748
<tr><td>glyphs <sup>4</sup></td><td class="c mono" id="glyphs"></td></tr>
749+
<tr><td>[test] graphite <sup>1</sup></td><td class="c mono" id="graphite"></td></tr>
750+
<tr><td><div class="ttip"><span class="icon">[ i ]</span>
751+
<span class="ttxt">proportional font<br>monospace size<br>sans-serif size<br>serif size</span></div>
752+
&nbsp; script defaults</td><td class="c mono" id="script_defaults"></td></tr>
756753
<!--tm-->
757754
<tr><td>actualboundingbox | baseline</td><td class="mono">
758755
<span class="c spaces" id="textmetrics_actualboundingbox"></span> | <span class="c" id="textmetrics_baseline"></span>
@@ -761,6 +758,8 @@
761758
<span class="c spaces" id="textmetrics_emheight"></span> | <span class="c" id="textmetrics_fontboundingbox"></span>
762759
</td></tr>
763760
<!--<tr><td>[measureText] width <sup>4</sup></td><td class="c mono" id="textmetrics_width"></td></tr>-->
761+
<tr><td>[css | test] woff2 <sup>2</sup></td><td class="mono">
762+
<span id="cssWoff2"></span> | <span class="c" id="woff2"></span></td></tr>
764763
<tr><td colspan="2"></td></tr>
765764
<!--creds-->
766765
<tr><td colspan="2"><span class="no_color">custom font from </span>

0 commit comments

Comments
 (0)