Skip to content

Commit 5aaedac

Browse files
tweak (#358)
1 parent 7981535 commit 5aaedac

File tree

4 files changed

+64
-33
lines changed

4 files changed

+64
-33
lines changed

js/fonts.js

+34-18
Original file line numberDiff line numberDiff line change
@@ -1387,11 +1387,11 @@ function get_system_fonts(METRIC) {
13871387
// 1802957: FF109+: -moz no longer applied but keep for regression testing
13881388
// add bogus '-default-font' to check they are falling back to actual default
13891389
let oList = {
1390-
'moz_fonts': [
1390+
'fonts_moz': [
13911391
'-default-font','-moz-bullet-font','-moz-button','-moz-button-group','-moz-desktop','-moz-dialog','-moz-document',
13921392
'-moz-field','-moz-info','-moz-list','-moz-message-bar','-moz-pull-down-menu','-moz-window','-moz-workspace',
13931393
],
1394-
'system_fonts': ['caption','icon','menu','message-box','small-caption','status-bar']
1394+
'fonts_system': ['caption','icon','menu','message-box','small-caption','status-bar']
13951395
}
13961396
let aProps = ['font-size','font-style','font-weight','font-family']
13971397
let hash, btn ='', data = {}, notation = 'moz_fonts' == METRIC ? default_red : rfp_red
@@ -1418,7 +1418,7 @@ function get_system_fonts(METRIC) {
14181418
for (const k of Object.keys(tmpdata).sort()) {data[k] = tmpdata[k]; count += tmpdata[k].length}
14191419
hash = mini(data)
14201420
// moz: defaults since at least 115 on win/linux: assume android/mac the same: i.e switch to generic font-families
1421-
if ('moz_fonts' == METRIC) {
1421+
if ('fonts_moz' == METRIC) {
14221422
if ('windows' == isOS || 'mac' == isOS || 'linux' == isOS) {
14231423
if ('fe778289' == hash) {notation = default_green} // 16px normal 400 serif
14241424
} else if ('android' == isOS) {
@@ -1447,6 +1447,7 @@ function get_system_fonts(METRIC) {
14471447
if ('7e83ef35' == hash) {notation = rfp_green} // 12px normal 400 Roboto
14481448
}
14491449
}
1450+
if (isSmart) {count = (count +'').padStart(2,' ')} // aesthetics: align the last three "font" health metrics
14501451
btn = addButton(12, METRIC, Object.keys(data).length +'/'+ count)
14511452
} catch(e) {
14521453
hash = e; data = zErrLog
@@ -1526,8 +1527,19 @@ function get_widget_fonts(METRIC) {
15261527

15271528
function get_unicode() {
15281529
/* https://www.bamsoftware.com/talks/fc15-fontfp/fontfp.html#demo */
1529-
// FF86+: 1676966: gfx.font_rendering.fallback.async
1530-
// set chars directly in HTML to force fallback ASAP
1530+
/* NOTES
1531+
FF86+: 1676966: gfx.font_rendering.fallback.async
1532+
- set chars directly in HTML to force fallback ASAP
1533+
FF131+ nightly: 1900175 + 1403931 ride the train
1534+
- Enable USER_RESTRICTED for content processes on Nightly
1535+
- security.sandbox.content.level > 7
1536+
- this affected (FF win11 at least) clientrect/offset + actualBounding
1537+
- 0x3095 + 0x532D (2 CJK chars)
1538+
- almost always both in every style except cursive never affected
1539+
- only changed in http(s), file:// not affected
1540+
- so reminder that generally we should always be using https for final testing/analysis
1541+
*/
1542+
15311543
let t0 = nowFn()
15321544
let styles = ['cursive','monospace','sans-serif','serif','system-ui'] // system-ui = FF92+
15331545
// don't use 'none': this is default style + font per style for each language
@@ -1648,16 +1660,20 @@ function get_unicode() {
16481660
let div = dom.ugDiv, span = dom.ugSpan, slot = dom.ugSlot,
16491661
canvas = dom.ugCanvas, ctx = canvas.getContext('2d')
16501662
let rangeH, rangeW, wType, hType, width, height
1651-
// each char
1652-
fntCodes.forEach(function(code) {
1653-
let codeString = String.fromCodePoint(code)
1654-
slot.textContent = codeString // set once
1655-
let isFirst = code == fntCodes[0]
1656-
// each style
1657-
styles.forEach(function(stylename) {
1658-
slot.style.fontFamily = stylename
1663+
1664+
// each style
1665+
styles.forEach(function(stylename) {
1666+
slot.style.fontFamily = stylename
1667+
let isFirst = stylename == styles[0]
1668+
// each code
1669+
fntCodes.forEach(function(code) {
1670+
let codeString = String.fromCodePoint(code)
1671+
slot.textContent = codeString // set once
1672+
//slot.style.fontFamily = stylename
1673+
16591674
// only typecheck once: first char on first style
1660-
let isTypeCheck = (isFirst && stylename == styles[0])
1675+
let isFirstCode = code == fntCodes[0]
1676+
let isTypeCheck = (isFirst && isFirstCode)
16611677
// offset: span width, div height
16621678
// offset is just purely for info purposes: redundant with clientrect
16631679
if (isOffset) {
@@ -1726,7 +1742,7 @@ function get_unicode() {
17261742
if (oTM[k]['proceed']) {
17271743
let prefix = k == 'width' ? 'glyphs_' : ''
17281744
try {
1729-
let isOnce = oTM[k]['all'] == false && isFirst
1745+
let isOnce = oTM[k]['all'] == false && isFirstCode
17301746
if (oTM[k]['all'] || isOnce) {
17311747
let measure = tm[k]
17321748
if (isTypeCheck) {
@@ -1789,9 +1805,9 @@ const outputFonts = () => new Promise(resolve => {
17891805
get_document_fonts('document_fonts'), // sets fntDocEnabled
17901806
get_script_defaults('script_defaults'),
17911807
get_fonts('font_sizes'), // uses fntDocEnabled
1792-
get_system_fonts('moz_fonts'),
1793-
get_system_fonts('system_fonts'),
1794-
get_widget_fonts('widget_fonts'),
1808+
get_system_fonts('fonts_moz'),
1809+
get_system_fonts('fonts_system'),
1810+
get_widget_fonts('fonts_widget'),
17951811
get_formats(),
17961812
get_woff2('woff2'),
17971813
get_graphite('graphite'), // uses fntDocEnabled

js/globals.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const btnList = ['alerts', 'errors', 'lies']
1919

2020
const jsFilesExpected = 14,
2121
gSectionsExpected = 16,
22-
expectedMetrics = 152
22+
expectedMetrics = 153
2323
let jsFiles = 0, gCount = 0, gCountTiming = 0
2424

2525
// global

js/screen.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,17 @@ const outputUA = (os = isOS) => new Promise(resolve => {
14121412
})
14131413

14141414
const outputFD = () => new Promise(resolve => {
1415+
let METRIC = 'infinity_architecture', res
1416+
try {
1417+
const f = new Float32Array(1)
1418+
const u8 = new Uint8Array(f.buffer)
1419+
f[0] = Infinity - Infinity
1420+
res = u8[3]
1421+
} catch(e) {
1422+
res = e+''
1423+
}
1424+
addBoth(3, METRIC, res)
1425+
14151426
if (!isGecko) {
14161427
let aList = ['browser','logo','wordmark','browser_architecture','os','version']
14171428
aList.forEach(function(item) {addBoth(3, item, zNA)})
@@ -1470,7 +1481,7 @@ const outputFD = () => new Promise(resolve => {
14701481
addBoth(3, 'browser', (isMullvad ? 'Mullvad Browser' : (isTB ? 'Tor Browser' : 'Firefox')))
14711482

14721483
// eval
1473-
let METRIC = 'eval.toString'
1484+
METRIC = 'eval.toString'
14741485
try {
14751486
let len = eval.toString().length
14761487
if (runST) {len = 43}

tzp.html

+17-13
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@
400400
<tr><td>[css] branding</td><td class="mono" id="fdBrandingCss"></td></tr>
401401
<tr><td>[css] browser</td><td class="mono" id="fdResourceCss"></td></tr>
402402
<tr><td>[browser] architecture</td><td class="c mono" id="browser_architecture"></td></tr>
403+
<tr><td>[infinity] architecture</td><td class="c mono" id="infinity_architecture"></td></tr>
403404
<tr><td>browser</td><td class="mono">
404405
<span class="c" id="browser"></span> | <span class="c" id="logo"></span> | <span class="c" id="wordmark"></span>
405406
</td></tr>
@@ -739,11 +740,14 @@
739740
<tr><td><div class="ttip"><span class="icon">[ i ]</span>
740741
<span class="ttxt">proportional font<br>monospace size<br>sans-serif size<br>serif size</span></div>
741742
&nbsp; script defaults</td><td class="c mono" id="script_defaults"></td></tr>
742-
<tr><td>[css | test] woff2 <sup>2</sup></td><td class="mono"><span id="cssWoff2"></span> | <span class="c" id="woff2"></span>
743+
<tr><td>[css | test] woff2 <sup>2</sup></td><td class="mono border-bottom">
744+
<span id="cssWoff2"></span> | <span class="c" id="woff2">
745+
</span>
743746
</td></tr>
744747
<!--fonts-->
745-
<tr><td></td><td><span class="s12">fonts</span></td></tr>
746-
<tr><td>[groups] fonts <sup>3</sup></td><td class="c mono" id="font_sizes_groups"></td></tr>
748+
<tr><td>[groups] fonts <sup>3</sup></td>
749+
<td class="mono"><span class="c" id="font_sizes_groups"></span>
750+
<div class="btn-right s99">fonts</div></td></tr>
747751
<tr><td><span id="labelF" class="btn btn0" onClick="togglerows('F','btn')">[+]</span>
748752
[sizes | names] fonts <sup>3</sup></td>
749753
<td class="mono"><span class="c" id="font_sizes"></span> | <span class="c" id="font_names"></span></td>
@@ -765,18 +769,19 @@
765769
<tr class="togF"><td>client range</td><td class="c mono border-bottom" id="fontsDomRectClientRange"></td></tr>
766770

767771
<tr><td>[base sizes] fonts <sup>3</sup></td><td class="c mono" id="font_sizes_base"></td></tr>
768-
<tr><td>[moz] fonts</td><td class="c mono" id="moz_fonts"></td></tr>
769-
<tr><td>[system] fonts</td><td class="c mono" id="system_fonts"></td></tr>
770-
<tr><td>[widget] fonts</td><td class="c mono" id="widget_fonts"></td></tr>
772+
<tr><td>[moz] fonts</td><td class="c mono" id="fonts_moz"></td></tr>
773+
<tr><td>[system] fonts</td><td class="c mono" id="fonts_system"></td></tr>
774+
<tr><td>[widget] fonts</td><td class="mono border-bottom"><span class="c" id="fonts_widget"></span></td></tr>
771775
<!--glyphs-->
772-
<tr><td></td><td><span class="s12">glyphs</span></td></tr>
773-
<tr><td>clientrect <sup>4</sup></td><td class="c mono" id="glyphs_clientrect"></td></tr>
774-
<tr><td>[measureText] width <sup>4</sup></td><td class="c mono" id="glyphs_width"></td></tr>
776+
<tr><td>clientrect <sup>4</sup></td>
777+
<td class="mono"><span class="c" id="glyphs_clientrect"></span>
778+
<div class="btn-right s99">glyphs</div></td></tr>
779+
<tr><td>[measureText] width <sup>4</sup></td><td class="mono border-bottom"><span class="c" id="glyphs_width"></span></td></tr>
775780
<!--tm-->
776-
<tr><td></td><td><span class="s12">textmetrics</span></td></tr>
777781
<tr><td>actualBoundingBoxAscent | Descent</td>
778782
<td class="mono"><span class="c spaces" id="glyphs_actualBoundingBoxAscent"></span>
779783
| <span class="c" id="glyphs_actualBoundingBoxDescent"></span>
784+
<div class="btn-right s99">textmetrics</div>
780785
</td></tr>
781786
<tr><td>actualBoundingBoxLeft | Right</td><td class="mono">
782787
<span class="c spaces" id="glyphs_actualBoundingBoxLeft"></span>
@@ -1041,9 +1046,8 @@
10411046
<p id="optDetail">detail <input type="radio" name="optOverlay" id="optFormat_detail" value="_detail" checked onchange="metricsAction()"></p>
10421047
<p>summary <input type="radio" name="optOverlay" id="optFormat_summary" value="_summary" onchange="metricsAction()"></p>
10431048
<p id="optFlat">flat <input type="radio" name="optOverlay" id="optFormat_flat" value="_flat" onchange="metricsAction()"></p>
1044-
<p id="optList">list <input type="radio" name="optOverlay" id="optFormat_list"value="_list" onchange="metricsAction()"></p>
1045-
<span id="groupHealth">
1046-
–––<p>all <input type="radio" name="optHealth" checked id="healthAll" onchange="metricsAction()"></p>
1049+
<p id="optList">list <input type="radio" name="optOverlay" id="optFormat_list" value="_list" onchange="metricsAction()"></p>
1050+
<span id="groupHealth">–––<p>all <input type="radio" name="optHealth" checked id="healthAll" onchange="metricsAction()"></p>
10471051
<p><span class="good"></span><input type="radio" name="optHealth" id="healthPass" onchange="metricsAction()"></p>
10481052
<p><span class="bad"></span><input type="radio" name="optHealth" id="healthFail" onchange="metricsAction()"></p>
10491053
</span>

0 commit comments

Comments
 (0)