Bundle the site's typefaces in the Android app - #69
Merged
Merged
Conversation
The app was set in the device's serif, sans and monospace faces as stand-ins. It now carries the site's three, Bitter, IBM Plex Sans and IBM Plex Mono, under the Open Font Licence, with each licence in the app's assets. Both licences reserve the font's name, so a subset or converted copy could not ship under it. The files are the designers' own as published in the google/fonts repository, unmodified, and audit/fonts.py pins each to the git hash of its upstream file, with a CI step and tests that watch it fail on a changed byte, a missing or unpinned font and a missing licence. Bitter and Plex Sans are variable fonts. Each weight is set on the weight axis explicitly: asked only for a weight, Compose draws Bitter in its default master, which is its thinnest. The fonts add about 0.6 MB to the download.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
The app has been set in the device's serif, sans and monospace faces as stand-ins. It now carries the site's three typefaces, each in its role:
designsystem/src/main/res/font/holds five files from the google/fonts repository, byte for byte:bitter.ttfofl/bitter/Bitter[wght].ttf(variable)ibm_plex_sans.ttfofl/ibmplexsans/IBMPlexSans[wdth,wght].ttf(variable)ibm_plex_mono_regular.ttfofl/ibmplexmono/IBMPlexMono-Regular.ttfibm_plex_mono_medium.ttfofl/ibmplexmono/IBMPlexMono-Medium.ttfibm_plex_mono_semibold.ttfofl/ibmplexmono/IBMPlexMono-SemiBold.ttfBoth OFL licence texts ship in the app's assets, as the licence requires.
Theme.ktpoints each role at its family. Every weight the scale uses is set on the variable fonts' weight axis.audit/fonts.pypins each font to the git hash of its upstream file. It also requires each licence to be present and still name its reserved font name. It comes with tests and a CI step.Why unmodified
Both licences reserve the name: "Bitter Pro" for Bitter, "Plex" for IBM Plex. A subset or a merged copy of the site's WOFF2 files would be a modified version still carrying the reserved name. So the originals are bundled, and the audit keeps them original: a font saved again by a tool renders the same and breaks the licence silently.
Checks
python audit/fonts.pypasses, and the audit tests pass: 51 in all, 8 new. The new tests cover a changed byte, a missing font, an unpinned font, a missing licence, and a licence without its reserved name.