Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract and expose postscriptName & fullName from font metrics #195

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

michaeltaranto
Copy link
Contributor

The font metrics returned now include the postscriptName and fullName properties as authored by the font creator.

For example:

// Arial Regular metrics
{
  "familyName": "Arial",
  "fullName": "Arial",
  "postscriptName": "ArialMT",
  ...
}

// Arial Bold metrics
{
  "familyName": "Arial",
  "fullName": "Arial Bold",
  "postscriptName": "Arial-BoldMT",
  ...
}

These values are particularly useful when constructing CSS @font-face declarations, as they can be used to specify local(<font-face-name>) sources.
MDN recommends using both “to assure proper matching across platforms”.

@font-face {
  font-family: "Web Font Fallback";
  src: local('Arial Bold'), local('Arial-BoldMT');
  font-weight: 700;
  ascent-override: 89.3502%;
  descent-override: 23.1683%;
  size-adjust: 108.3377%;
}

@michaeltaranto michaeltaranto requested a review from a team as a code owner April 16, 2024 04:24
Copy link

changeset-bot bot commented Apr 16, 2024

🦋 Changeset detected

Latest commit: acf95a7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@capsizecss/metrics Minor
@capsizecss/unpack Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@michaeltaranto michaeltaranto merged commit aa77cb2 into master Apr 16, 2024
6 checks passed
@michaeltaranto michaeltaranto deleted the extract-postscript-and-full-name branch April 16, 2024 05:30
@seek-oss-ci seek-oss-ci mentioned this pull request Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants