Thanks for the help!
I fell into a rabbit hole here and have learned the reason I couldn’t use the fonts—but now it makes me wonder how anyone on any Apple device, including a Mac uses it… Anyway, here goes:
Since learning a precise list of extra installed fonts could be used to track someone across websites—so-called “font fingerprinting attacks”—Safari was modified ~6 years ago. (Not specifically mobile WebKit, just, Safari/WebKit.)
Apple changed it to always return
true whenever a script asked if a font existed—regardless of whether the font being queried about was installed or not (or even existed or not). It also made it so that if you tried to determine if you could display a particular glyph (kanji, kana, letter, punctuation mark, etc.) with
FontSet.check() or similar, you could only ask about a list of fonts—and would always get a return of
true when no font listed supported the requested glyph. (Other browsers adopted these privacy measures, and this behavior is what is documented at this moment on MDN.)
So all was well in the world… well, no, of course not. If you had a big database of glyphs and were willing to try every permutation of font list you needed to create a fingerprint, you could still generate one.
So Safari changed it so that it answered
true about system-standard fonts and
false to all others—installed or not. (The system-standard fonts differed between localizations, so it could still be used to see if someone had any font capable of displaying Japanese or not.)
Then, the next attack came in the form of malware sites creating long lists of fallback fonts in every possible permutation, displaying text in a block element with those lists, and then inspecting what size the element rendered was, which if chosen correctly could again get you the list of installed fonts—and voilà, font fingerprinting was back!
So now, Safari will only use system-standard fonts and remotely-served webfonts. (I guess that explains why, if you’ve bought any webfonts from Adobe lately, you don’t even get the option of downloading them in TrueType/OpenType format anymore.)
On a Mac, there’s a
defaults key you can change to allow the old behavior and make local fonts available to webpages again; and apparently, if you upgraded into a current macOS with custom fonts that Safari could use already installed, you got grandfathered in. So maybe the set of Mac users who had never installed a font before this restriction was put in place is relatively small? I dunno. Otherwise, I can’t explain why Mac users aren’t complaining all over this and other KSOF threads for the past couple years. (And indeed, checking my Mac, that font-fingerprinting checker I linked to above can see my Japanese fonts I’d installed years back—but not KSOF.)
Anyway, end of rabbit-hole—since userscripts so often rely on local font tricks, I figured it was worth documenting what I found over the past several hours.
I wish I had an answer, besides “use free webfonts, not locally-installed fonts”, since It seems this is supposed to soon be the default behavior on Windows and other cross-platform browsers, too? But a heads-up that this will soon be trouble seems worthwhile… ¯_(ツ)_/¯