Repository navigation
Type mode: style picker that sets weight class and italic flags - #24
Merged
Merged
Conversation
The font's Style was a bare text box: nothing listed the styles that exist, and the name never reached usWeightClass, fsSelection or macStyle (those came only from the look's Weight and Slant modifiers), so a font named "Bold" exported as weight 400 and "Italic" as upright unless it leaned. - Style is now a picker: Thin to Black (100-900), upright and italic, plus "Custom name…" for anything else. The base font's own style is the default for a new font and is marked "base". - A standard style sends its weight class and italic flag to the export; a custom name keeps the old behaviour (weight and slope from the look). - The engine takes an optional italic flag, so an upright italic gets ITALIC in fsSelection/macStyle, and a non-RIBBI italic names ID 2 "Italic" instead of "Regular". - @font-face weight now reads ExtraLight as 200 and ExtraBold as 800. - The Use font dialog suggests the standard names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Merged
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.
Glitch or intentional?
A bit of both. Free text was on purpose: OpenType lets a style be called anything ("Display", "Condensed Bold"), and the field has been a plain input since 0.2. The gap was that nothing showed which styles exist, and the name was never checked or used for the font's flags:
usWeightClasscame only from the look's Weight modifiers (400 when there were none). The bold and italic bits infsSelectionandmacStylecame only from Weight and Slant.So a font named "Bold" exported as weight 400, and one named "Italic" was flagged upright unless it slanted. Apps then grouped and style-linked it wrongly. The web kit's
@font-faceguessed the weight with a regex, so ExtraLight came out as 300 and ExtraBold as 700.What changed
weightClassand the newitalicflag to the engine, which setsusWeightClass,fsSelection,macStyleand STAT from them. An upright italic gets the italic bits too, and for an italic style that isn't Regular, Bold, Italic or Bold Italic, name ID 2 is now "Italic" instead of "Regular". A name the picker can't read, such as "Display", works as before: weight and slope come from the look.@font-facenow uses the same mapping. The "Use font" dialog suggests the standard names.The app is dark-only (
color-scheme: dark), so emulating a light scheme changes nothing. I checked it in dark.Tests
fontStyles.test.ts: every standard style maps to its weight and italic flag and back; spellings like "Semi Bold", "Demibold", "Heavy Oblique" and "Hairline" are read; the look's weight; thespecOffields;@font-face.style_sets_weight_and_italic_flags: writes a Light Italic that doesn't slant and a Bold, then reads back the weight,fsSelection,macStyleand name IDs 1, 2 and 17.npx tsc --noEmit -p ui,npx vitest run(134),npx vite buildandcargo testall pass.The screenshot is stored on the
pr-assets/type-style-pickerbranch and can be deleted after review.🤖 Generated with Claude Code