Skip to content

Commit

Permalink
Add support for font-size-adjust into the font stack
Browse files Browse the repository at this point in the history
font-size-adjust allows you to amend the perceived x-height of fallback fonts to match your original font. A specific use case for us would be getting foreign characters that are not in NTA to show up with matching metrics.

For NTA the original x-heights are 0.5 for regular text and 0.525 for bold (this can be tested by adding a font-size-adjust to gov.uk and adjusting the property until no difference is seen when it’s toggled). Applying these values makes the fallback of Arial match NTA’s metrics.

Current support is Firefox (and Chrome behind a flag).
  • Loading branch information
Robin Whittleton committed Apr 26, 2016
1 parent 491ec77 commit 8413c1c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions stylesheets/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ $is-print: false !default;
font-weight: $font-weight;
text-transform: none;

@if $toolkit-font-stack == $NTA-Light {
@if $font-weight > 400 {
font-size-adjust: 0.525;
} @else {
font-size-adjust: 0.5;
}
}

@include media(tablet) {
font-size: $font-size;
line-height: $line-height;
Expand Down

0 comments on commit 8413c1c

Please sign in to comment.