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

Add support for font-size-adjust into the font stack #271

Merged
merged 1 commit into from
Apr 26, 2016

Conversation

robinwhittleton
Copy link
Contributor

font-size-adjust allows you to amend the aspect value of fallback fonts to match your original font: https://www.w3.org/TR/css-fonts-3/#font-size-adjust-prop. 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 aspect ratios 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). Testing shows minor changes, but it could be useful in certain situations, for example:

NTA (with or without font-size-adjust):
nta

Arial with font-size-adjust:
arial_with_fsa

Arial without font-size-adjust:
arial_without_fsa

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).
@fofr
Copy link
Contributor

fofr commented Apr 26, 2016

Looks good to me 👍. Do you have equivalent screenshots for the bold variant?

@robinwhittleton
Copy link
Contributor Author

Oh yeah, knew I’d forgotten something. There’s actually no difference either way with the bold weight, but we need to include it in case the bold text is down the cascade from a font-size-adjust: 0.5.

NTA with font-size-adjust:
nta

Arial with font-size-adjust:
arial_with_fsa

Arial without font-size-adjust:
arial_without_fsa

@fofr fofr merged commit 1d40977 into master Apr 26, 2016
@fofr fofr deleted the font-size-adjust-support branch April 26, 2016 13:07
@fofr
Copy link
Contributor

fofr commented Apr 26, 2016

👍

tombye added a commit to Crown-Commercial-Service/digitalmarketplace-buyer-frontend that referenced this pull request Jun 10, 2016
Chrome seems to be increasing the font slightly
when `font-size-adjust` is set (which we have been
doing since this change to the govuk frontend
toollkit:

alphagov/govuk_frontend_toolkit#271

The grid used for `.footer-meta` sets its columns
to `display: inline-block' (to have more control
over the vertical spacing) which can mean their
horizontal spacing is effected by changes to how
lines of content are rendered. It seems having
`font-size-adjust` set is increasing the
horizontal spacing of the line on which they sit,
meaning they can no longer git on it.
tombye added a commit to Crown-Commercial-Service/digitalmarketplace-buyer-frontend that referenced this pull request Jun 10, 2016
Chrome seems to be increasing the font slightly
when `font-size-adjust` is set (which we have been
doing since this change to the govuk frontend
toollkit:

alphagov/govuk_frontend_toolkit#271

The grid used for `.footer-meta` sets its columns
to `display: inline-block' (to have more control
over the vertical spacing) which can mean their
horizontal spacing is effected by changes to how
lines of content are rendered. It seems having
`font-size-adjust` set is increasing the
horizontal spacing of the line on which they sit,
meaning they can no longer git on it.
tombye added a commit to Crown-Commercial-Service/digitalmarketplace-supplier-frontend that referenced this pull request Jun 13, 2016
Chrome seems to be increasing the font slightly
when `font-size-adjust` is set (which we have been
doing since this change to the govuk frontend
toollkit:

alphagov/govuk_frontend_toolkit#271

The grid used for `.footer-meta` sets its columns
to `display: inline-block' (to have more control
over the vertical spacing) which can mean their
horizontal spacing is effected by changes to how
lines of content are rendered. It seems having
`font-size-adjust` set is increasing the
horizontal spacing of the line on which they sit,
meaning they can no longer git on it.
tombye added a commit to Crown-Commercial-Service/digitalmarketplace-admin-frontend that referenced this pull request Jun 13, 2016
Chrome seems to be increasing the font slightly
when `font-size-adjust` is set (which we have been
doing since this change to the govuk frontend
toollkit:

alphagov/govuk_frontend_toolkit#271

The grid used for `.footer-meta` sets its columns
to `display: inline-block' (to have more control
over the vertical spacing) which can mean their
horizontal spacing is effected by changes to how
lines of content are rendered. It seems having
`font-size-adjust` set is increasing the
horizontal spacing of the line on which they sit,
meaning they can no longer git on it.
tombye added a commit to Crown-Commercial-Service/digitalmarketplace-supplier-frontend that referenced this pull request Jun 15, 2016
Chrome seems to be increasing the font slightly
when `font-size-adjust` is set (which we have been
doing since this change to the govuk frontend
toollkit:

alphagov/govuk_frontend_toolkit#271

The grid used for `.footer-meta` sets its columns
to `display: inline-block' (to have more control
over the vertical spacing) which can mean their
horizontal spacing is effected by changes to how
lines of content are rendered. It seems having
`font-size-adjust` set is increasing the
horizontal spacing of the line on which they sit,
meaning they can no longer git on it.
tombye added a commit to Crown-Commercial-Service/digitalmarketplace-supplier-frontend that referenced this pull request Jun 16, 2016
Chrome seems to be increasing the font slightly
when `font-size-adjust` is set (which we have been
doing since this change to the govuk frontend
toollkit:

alphagov/govuk_frontend_toolkit#271

The grid used for `.footer-meta` sets its columns
to `display: inline-block' (to have more control
over the vertical spacing) which can mean their
horizontal spacing is effected by changes to how
lines of content are rendered. It seems having
`font-size-adjust` set is increasing the
horizontal spacing of the line on which they sit,
meaning they can no longer git on it.
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