Repository navigation
Conversation
Themes already choose the fonts and ligatures (--sans, --mono,
--ligatures). This gives them more to choose from, and fixes two gaps when
a theme changes the font.
- The app bundles Inter, Fira Code, IBM Plex Mono, and Iosevka, which a
theme names in --sans or --mono ("Pocket Inter", ...) instead of shipping
font files of its own. A browser downloads only the ones a theme uses.
- Real italics: JetBrains Mono, Inter, IBM Plex Mono, and Iosevka bring
their own italic files, so code comments and emphasis are no longer
slanted by the browser. The default look gains JetBrains Mono's italic.
- The Nerd Fonts icons that prompts and tools print, as a font of icons
alone in the default --mono, fetched only when an icon shows.
- No flash on reload: the page preloads the app's fonts a theme names, as
it does the theme's own. Before, it preloaded Geist and JetBrains Mono
and then switched.
- The message box and the status line measure again when a theme's
stylesheets or a font finish loading. Before, a theme with a wider font
left the box too short for its text until the next keystroke.
web/fonts/SOURCES.md says where each font came from and how it was
checked; Iosevka and the Nerd Fonts symbols are trimmed, with every name
kept. The theme guide lists the fonts a theme can name.
Under the theme tools, the owner picks the theme in use's Text font, Code font, and Ligatures, with a preview. Each choice is saved into the theme (its fonts.css, which theme.css imports first, and whose values win over the theme's own), so everyone who uses it gets it at once. A theme that comes with the app is duplicated first; a theme of colors alone gets the stylesheet and the theme.json it needs.
- "Fonts for <theme>" is always there: a theme of the owner's has the menus; one that comes with the app shows its fonts, with Duplicate to change. - System Sans and System Mono, the device's own fonts, in the menus. - Text size: 13, 15, 17, or 20, or any size from 10 to 32 px typed in, in half pixels.
This branch has not been deployed
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.
Closes #114.
What changes
Fonts for a theme, in Appearance (
web/sheets/appearance.js,src/server/themes.ts,src/server/http/api.ts)=>,!==and a comment.fonts.css, whichtheme.cssimports first. Its values win over the theme's own, so the menus always show what is in use.PUT /api/themes/:id/fonts, which accepts only the fonts in the menus.theme.jsonthat a stylesheet needs.--sans,--monoand--ligatures, as before.The app's fonts (
web/fonts/,web/style.css)@font-facerules for:"Pocket Inter""Pocket Fira Code""Pocket IBM Plex Mono""Pocket Iosevka""Pocket Nerd Symbols""Pocket Mono"web/fonts/SOURCES.mdlists where each file came from.--mono, after JetBrains Mono.unicode-range, so a browser downloads it only when an icon shows.Preload and re-fit (
web/index.html,src/server/themes.ts,web/composer.js)index.htmlpreloads them before the first paint, so a reload doesn't flash Geist or JetBrains Mono first.Text size (
web/theme.js,web/sheets/appearance.js)Docs:
docs/extensions/themes.md(the app's fonts and Fonts for),docs/extensions/reference/theme-surface.md,docs/features.md, and font credits inREADME.md.Size: about 1,100 lines without the font files: roughly 500 of tests, about 220 of CSS, and the rest code and docs. A browser downloads only the fonts its theme uses. Iosevka is the largest, at about 3.4 MB for all six files.
Tests
test/font-ui.test.ts(Chromium), 6 tests:composer.jschange.test/themes.test.ts, 2 tests:themes.tsandindex.htmlchanges.fonts.css, keeps the theme's own CSS, and importsfonts.cssonly once;main(0.19.0): all 392 tests pass.npm run check, ESLint and Prettier pass.