Skip to content

Commit

Permalink
metrics: Update apple system font metrics (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeltaranto authored Apr 15, 2024
1 parent 75233b1 commit 121eb42
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
10 changes: 10 additions & 0 deletions .changeset/curvy-forks-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@capsizecss/metrics': patch
---

metrics: Update apple system font metrics

Previously the metrics provided for `-apple-system` and `BlinkMacSystemFont` were extracted from the `SF Pro` font, with a custom override to correct the `descent` metric.

Through work to support metrics for different font weights and styles, it was identified that MacOS uses the `SFNS` font.
Extracting the metrics from this font means no more custom overrides, and will now enable using this font as a fallback via postscript name soon too.
11 changes: 4 additions & 7 deletions packages/metrics/scripts/source-data/systemFontsData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,20 @@ if (!fontDirectory) {
);
}

const sfProBase: Omit<FontSourceList[number], 'family'> = {
const sfNSBase: Omit<FontSourceList[number], 'family'> = {
category: 'sans-serif',
files: {
regular: `${fontDirectory}/SF Pro.ttf`,
},
overrides: {
descent: -420,
regular: `${fontDirectory}/SFNS.ttf`,
},
} as const;

const systemFonts: FontSourceList = [
{
...sfProBase,
...sfNSBase,
family: '-apple-system',
},
{
...sfProBase,
...sfNSBase,
family: 'BlinkMacSystemFont',
},
{
Expand Down
8 changes: 4 additions & 4 deletions packages/metrics/scripts/systemFonts.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
{
"familyName": "-apple-system",
"capHeight": 1443,
"ascent": 1950,
"descent": -420,
"ascent": 1980,
"descent": -432,
"lineGap": 0,
"unitsPerEm": 2048,
"xHeight": 1040,
Expand Down Expand Up @@ -40,8 +40,8 @@
{
"familyName": "BlinkMacSystemFont",
"capHeight": 1443,
"ascent": 1950,
"descent": -420,
"ascent": 1980,
"descent": -432,
"lineGap": 0,
"unitsPerEm": 2048,
"xHeight": 1040,
Expand Down

0 comments on commit 121eb42

Please sign in to comment.