Norcleeh on Discord: magpie opened in a browser had no font setting in
Settings > General, while the app does. The rows were hidden on purpose:
/api/fonts answered 404 to a browser page and boot sent it no choice,
since the list is the fonts of the computer magpie runs on and the tab
can be on another one.
Now a browser tab (magpie web, or the app's page in a browser) has both
rows wherever magpie can read its fonts (boot's fonts; a nogui build
can't, and keeps them hidden). Its list is /api/fonts less the families
this browser doesn't draw (fonts.js here(): text in the family measures
apart from monospace's or serif's on a canvas), so another computer's
fonts and Safari's user-installed ones aren't offered. The choice is the
browser's own, in localStorage (magpie.fonts), applied by fonts.js
before the first paint; it neither changes nor takes the app's
settings.UIFont/CodeFont, and a settings save from a browser still
keeps the app's.
Run on mote at this tree (on b90e81da1), also GOOS=linux (nogui) and
GOOS=windows go vet ./internal/gui/..., go build, gofmt -l:
- fonts.test.cjs, font-cascade.test.cjs, win-fonts.test.cjs, i18n-keys
and the 42 drag/arrange GUI files, Chromium and WebKit, en and zh (and
ja/de where a file has them). The reds are 32 subtests in 4 files
that fail the same on origin/main b90e81da1 run alone (and one from
a stray path in the run command): i18n-keys "a
plugin's words are its own" (#3897), routing-rule-drag webkit de
(#3789), segs-press-redraw webkit (#3922), usage-agents-hide (#3414).
- go test -tags nogui ./internal/gui (TestCoreScriptBudget and
TestFontSettingsAPIAndBoot included) ok; go test ./internal/gui -run
Font (cgo, CoreText) ok.
- Real use: magpie built on mote, `magpie web` in a sandbox HOME, real
/api/fonts (204 families). Chromium offered 204, WebKit 179; Georgia
picked in each, the body drew it and kept it across a reload, and no
settings.json was written.
Broken by hand: fontsOn = !web (rows hidden as before): the new test
red in all four engine/language cases; here() returning the list
unfiltered: red with "a family this browser doesn't draw isn't
offered".
Not tried: a browser on a different computer from magpie (the canvas
filter is what covers it, checked with a family the test machine
lacks), Firefox, the Windows and Linux apps' pages in a browser.
Budget: not raised; the previous commit's 1,097 bytes cover it.