-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fonts: testing font sizes #1555
Comments
Arch Linux GNOME 42.4 3452.86 x 308 : URW Chancery L, Z003 |
Ubuntu 22.04 3072 x 371 : Noto Sans Mono CJK HK, Noto Sans Mono CJK JP, Noto Sans Mono CJK KR, Noto Sans Mono CJK SC, Noto Sans Mono CJK TC |
This research is for arkenfox or for TZP? |
W10 22H2
|
macOS Monterey 12.6:
|
Windows 11 21H2
|
TZP click me for details if you are bored
The issue with TZP perf is that lets say I run the test and it takes 450ms - 300ms of that was in fonts: namely 200ms enumerating fonts, and 100ms measuring glyphs. And that's with a windows list of 250 fonts. Mac is 440 fonts, linux is 470 fonts (or something) The ONLY way to speed this up is to do less measurements. It is the actual act of querying the dimensions that causes the slow down: e.g. I can set 100 fonts and it takes no time, but measuring each one in between, the dom has to populate all the properties even if the font used doesn't actually change (it's a bit more confusing than that because I am also setting a generic base font-family style) So one thing I have done is to speed up the measuring logic in two ways. Normally you measure against monospace, then serif, then sans-serif. I drop subsequent checks if the font has already been detected so as an example:
The reason you test against three generic font-families, is that if you don't you won't pick up all fonts. Something has to be the default font for each and there can be size collisions. For example if we only checked against monospace in windows, we wouldn't pick up Consolas, because that is the actual default font for monospace = the same as comparing monospace to monospace, or comparing consolas to consolas. anyway, long story short, this saved about 1/3rd of the time in enumerating fonts (it depends on what you fonts you have, but these lists are OS targeted and we get a reasonable number detected on the first i.e monospace). But still, fonts is a large chunk of the testing time taken. So that led me to another method which is to not use monospace, serif, sans-serif AT ALL in comparing, and to only measure against a single baseline
I won't get into the nuts and bolts of it all, suffice to say that this protects against font config fubars (such as Tor Browser, true story, not whitelisting Menlo on mac and thus never rendering monospace at all, ever = fucks up all the tests), because the font base line is an expected font that the system must have, and this base line size doesn't have collisions except with other expected system fonts (usually one) I only use this, so far, for windows and mac So we've gone from 100 fonts taking 300 measurements, down to 100 measurements: 2/3rds time saved, which on 200ms is a LOT. Which then brings me to how else to speed up the font enumeration tests. Again, the only way is to reduce the measurements, and we're now down to what fonts we test So any font I can skip testing, because it adds nothing to entropy, then I save one measurement - i.e it is expected to exist so would be found on the first pass, so only one measurement saved. e.g. windows OSes must have Times, Roman and Times New Roman. Probably because of their root origins, these three are always the same size. Same with Courier and Courier New. And some font names are aliases e.g. So by getting some data on size buckets, I can determine what other font names I can drop. Now this is not the end of it (reducing font lists to be checked), because the sizes themselves are likely equivalency. So it's a balance between reducing size collisions but not compromising always getting as much entropy as possible on detected fonts. edit: also the name of the game is NOT to detect all fonts, it is to maximize entropy |
Debian 12 bookworm - FF105 3072 x 371.584 : Noto Sans Mono CJK HK, Noto Sans Mono CJK JP, Noto Sans Mono CJK KR, Noto Sans Mono CJK SC, Noto Sans Mono CJK TC |
@1Naim (or anyone with windows 11) .. @abrahamjuliot Could do you do me a favor. I want to add some windows 11 only fonts, and would like you to test them for me. To do so
paste me the console bits: what was/wasn't found, and the size collisions TIA ❤️ 💋 🍰 🍻 |
|
umm, did you rerun the font section, because you're not even showing |
weird... you can always test font names one by one in https://arkenfox.github.io/TZP/tests/fontdebug.html, at least get something detected ... this is so weird, I might have to set up my new laptop (win10, brand new, sitting in a box for the last 9 months) ... hopefully I can upgrade to 11 without having to give MS an email account |
Hmmm, after the rerun, click on the font names details on the tzp page (maybe I've screwed up what data I'm looking at?) - edit, nvm |
Feel free to ask me to do more, I'm always happy to help. |
that's interesting ... I wouldn't have expected those to be the same size
going back to the first result
So something else affects the width: at least abraham + I seem to be the same. I do plan on building a test page to test all OS fonts and return same sizes etc zoom affects sizes, but does that universally, so fonts still match other fonts. Same with changing |
Firefox 105, OS X 10.14.6 2752.44 x 307.2 : SignPainter, SignPainter-HouseScript |
thanks for the mac info - definitely some saving to be made there (but I also need to expand the list with changes in the last two releases and additional option downloadable system fonts). I've been working on Tor Browser linux/windows fonts and FF windows fonts. I don't have a mac but will be working on those next - see arkenfox/TZP#197 - @fxbrit will be getting some home assignments
mac is currently
|
so zooming can affect the font groupings, but I only found two fonts (CJK ones) on my windows 7 that changed: instead of being in their own group, they merged with three other CJK ones as I zoomed up in size. This is not a concern what is a concern is that we have some different font groups on different windows results: for example, for 1Naim #1555 (comment) has all sitka's the same, on my windows 10 VM they are not - they are each unique sizes. There's also some conflicting groupings with various I copied over some win10 only fonts into a firefox/font profile and also got some groupings that can mimic what I have seen above, but not in windows 10 itself. So I am beginning to wonder if this is a case of windows 7 users, who had these fonts by default, upgraded to win10, where these fonts are now supplemental. And thus the differences in size groupings? Still doesn't explain, e.g Sitka. Anyway, I have scaled back some of the reductions, currently at 219 windows fonts tested - until I can confirm from multiple resources. My windows 10 VM is not activated and doesn't allow me to download additonal/supplemental windows fonts. Time I set up my new latop, methinks. Anyway, closing. Thanks for the help. It's been enlightening. ❤️ I will get mac results from the fish, and I have enough sources for windows. When needed I will open a new issue for Android and Linux. |
enumerating fonts is slow, and just saying "hey you have these system fonts" is boring. So lets collect sizes. Now, it's bit pointless (and SLOW) testing fonts that the user is expected to have and there is a size collision
for example: TB on linux bundles 140 font files (for 134 fonts) and all fonts are restricted to those. But something like 53 of those fonts are all the exact same size, so we could drop 52 of those .. and there are some other buckets of sizes with multiple fonts in them. Since they are all expected, we only need to measure one of each size
for example: on windows
and there's likely more: such as "Cordia New" and "CordiaUPC" always seem to be bundled together (I just need to check) and they are the same size. Same with "Browallia New", "BrowalliaUPC" | "Angsana New", "AngsanaUPC" ...
what I'm lacking is some data sets to make decisions: for example, of the 232 legit windows font names being tested, I do not have 102 of them on my windows 7
Am after TB on linux, FF on windows 8/8.1/10/11, FF mac. For Firefox, disable RFP so I can get size collisions for all the fonts you may have
STR
listfontsizes()
and hit enterexample
here is my windows 7
The text was updated successfully, but these errors were encountered: