mirror of
https://github.com/daijro/camoufox.git
synced 2026-10-05 00:00:20 +00:00
The bundle was three per-OS directories, so a face used by more than one OS was
stored more than once: 2955 files, 3.96 GB, of which 1.63 GB (41%) was
byte-identical copies. That was not a decision, it was the absence of one --
the DIRECTORY was the only selection mechanism, so fontconfig could be scoped to
an OS only by giving that OS its own full copy of everything it needed.
Each face is now stored once, in a directory named for the set of OSes that use
it (L, M, W, LM, LW, MW, LMW). An OS reads the four groups its letter appears
in; bundle/fonts/groups.json records the mapping and
utils._generate_fontconfig hands fontconfig exactly those directories.
1513 faces, 2.16 GB
lin -> L+LM+LMW+LW (792) mac -> LM+LMW+M+MW (779) win -> LMW+LW+MW+W (809)
package before after
linux 3.96 GB 2.16 GB (-46%)
macos 2.21 GB 1.31 GB (-41%)
windows 2.69 GB 1.79 GB (-34%)
pythonlib/camoufox/fonts.json is BYTE-IDENTICAL across the change: the same
families are renderable and reportable on all three OSes. The saving is pure
redundancy.
The group directory is also a better gate than what it replaces. The 455
<rejectfont> globs in fontconfig/windows/fonts.conf are gone: a face Windows
must not see is simply not in a group Windows reads (verified: 0 of the 243
formerly rejected basenames appear in any Windows group). Those globs were
unsound anyway -- 114 bundled filenames contain [ ] (e.g. ReemKufi[wght].ttf),
which fontconfig parses as a character class, so they silently matched nothing.
macOS (CoreText) and Windows (DirectWrite) cannot read subfolders, so package.py
flattens the groups for those targets and the allowlist gates them, as before.
The bundle itself leaves git. It is 2.16 GB extracted and 843 MB as .tar.xz;
GitHub rejects files over 100 MiB, and an xz archive cannot be delta-compressed,
so committing it -- split into ~9 parts -- would append the whole archive to
history on every font change, paid by everyone who clones the repo. It is now a
release asset in its own tag namespace (font-bundle-*, excluded from build.yml
so it does not trigger a browser build), fetched on demand:
make fetch-fonts download + verify make fonts-extract unpack
make fonts-check verify only make fonts-clean drop the unpack
scripts/data/font-bundle.json pins the asset name, size and sha256, so a commit
still names exactly one bundle and a truncated download fails loudly instead of
producing a browser that reports fonts it cannot render. This is the trust model
the build already uses for the Firefox source (`make fetch` pulls a ~500 MB
tarball from archive.mozilla.org), so a clone was never buildable offline.
Only the compressed archive is kept; bundle/fonts/ is extracted on demand and is
gitignored. Round-trip verified byte-identical. package-* now depend on
fonts-extract, and gen-fonts-json.py / verify-fonts.py fail with the fix
("run make fonts-extract") rather than a stack trace.
642 font blobs (974 MB) leave the index. bundle/fonts/000_README.txt moves to
bundle/FONTS-README.txt and cleanfonts.sh to scripts/, since bundle/fonts/ is
now ignored.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
11 lines
521 B
JSON
11 lines
521 B
JSON
{
|
|
"tag": "font-bundle-v1",
|
|
"asset": "fonts-bundle-v1.tar.xz",
|
|
"size": 842795560,
|
|
"sha256": "8f345ce22a475c45eb9974d3e739fe1a2f5a742882c58727dbc55ab69cae8953",
|
|
"url": "https://github.com/JWriter20/camoufox/releases/download/font-bundle-v1/fonts-bundle-v1.tar.xz",
|
|
"repo": "JWriter20/camoufox",
|
|
"urlTemplate": "https://github.com/{repo}/releases/download/{tag}/{asset}",
|
|
"note": "The font bundle is a release asset, not repo content. See scripts/fetch-fonts.py. Regenerate with --write-spec after rebuilding it."
|
|
}
|