-
Notifications
You must be signed in to change notification settings - Fork 679
Bug 1490392: Reduce web font usage #4967
Changes from 6 commits
98da502
f27897f
93b0a33
707630c
8296a6c
6ce4f62
ddae2bc
5157838
5c05188
7c96947
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
{# because this is non-blocking, preload as early as possible #} | ||
<link rel="preload" href="{{ static('fonts/locales/ZillaSlab-Regular.woff2') }}" as="font" type="font/woff2" crossorigin /> | ||
<link rel="preload" href="{{ static('fonts/locales/ZillaSlab-Bold.woff2') }}" as="font" type="font/woff2" crossorigin /> | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ html { | |
} | ||
|
||
body { | ||
line-height: 1.5; | ||
line-height: 1.6; | ||
@include set-site-font-family(); | ||
@include set-font-size(15px); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't normally like to reduce the font size below 16px, but Verdana is big. Playing with https://meowni.ca/font-style-matcher/ shows that 15px (with some tiny tweaks like the line-height and some letter-spacing) is nearly identical to 16px Open Sans. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,6 @@ $padding-horizontal: 30px; | |
color: $accent-light; | ||
display: inline-block; | ||
@include set-font-size(17px); | ||
font-weight: bold; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Verdana's bold is heavier than Open Sans. I pulled the bold here (and a couple other spots) to minimize the difference. |
||
letter-spacing: .02em; | ||
@include bidi(((padding, $padding-vertical $padding-horizontal $padding-vertical 0, $padding-vertical 0 $padding-vertical $padding-horizontal),)); | ||
white-space: nowrap; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,3 @@ Fonts for Gaia demos | |
********************************************************************** */ | ||
|
||
@import 'base/fonts/moztt'; | ||
@import 'base/fonts/opensans'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is Gaia? I'll search repository history, and ask the writers. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From what I know, Gaia was the codename for the front-end codebase of Firefox-OS There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @schalkneethling is right: https://developer.mozilla.org/en-US/docs/Archive/B2G_OS/Platform/Gaia A lot of this was added in 2013, like bug 844531, to support documentation and samples. There's a few samples in the archive, like https://developer.mozilla.org/en-US/docs/Archive/B2G_OS/Firefox_OS_apps/Building_blocks/Slider/2.0. That one has been converted to use external assets, hosted on GitHub. Removing these may break some samples, but keeping those samples working is a low priority. Future work, including some research to see what will break. Update: opened https://bugzilla.mozilla.org/show_bug.cgi?id=1490411, looks safe to remove Gaia stuff. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ Provides main mixins for use within the MDN theme. | |
|
||
@mixin set-site-font-family() { | ||
font-family: $site-font-family; | ||
letter-spacing: -.05px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Prefer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be set here. |
||
} | ||
|
||
|
||
|
@@ -485,7 +486,7 @@ These are not dynamic but serve as mixins | |
|
||
@mixin callout() { | ||
@include restrict-line-length(); | ||
@include set-font-size(20px); | ||
@include set-font-size(19px); | ||
border: $section-border-width solid $accent-light; | ||
border-width: $section-border-width 0; | ||
padding: $grid-spacing 0; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,7 +110,7 @@ $error: #900; | |
typography | ||
====================================================================== */ | ||
$site-font-family-fallback: arial, x-locale-body, sans-serif; | ||
$site-font-family: 'Open Sans', $site-font-family-fallback; | ||
$site-font-family: 'Verdana', $site-font-family-fallback; | ||
$heading-font-family-fallback: 'Palatino', 'Palatino Linotype', x-locale-heading-secondary, serif; | ||
$heading-font-family: x-locale-heading-primary, zillaslab, $heading-font-family-fallback; | ||
$heading-line-height: 1.2; | ||
|
@@ -177,18 +177,18 @@ break points | |
- divide pixels by browser default font size (16px) | ||
- and multiply by 1em to convert unit to em. | ||
*/ | ||
$max-width-default: (1399px / 16px) * 1em; | ||
$small-desktop-ends: (1199px / 16px) * 1em; | ||
$tablet-ends: (1023px / 16px) * 1em; | ||
$mobile-ends: (767px / 16px) * 1em; | ||
$small-mobile-ends: (479px / 16px) * 1em; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was necessary to keep the same general width of our content. I tested the layout using devtools and we seem ok with the minor adjustments to our breakpoints. |
||
$max-width-default: (1399px / 15px) * 1em; | ||
$small-desktop-ends: (1199px / 15px) * 1em; | ||
$tablet-ends: (1023px / 15px) * 1em; | ||
$mobile-ends: (767px / 15px) * 1em; | ||
$small-mobile-ends: (479px / 15px) * 1em; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Is it possible to move There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. It is dividing by the base body font size. I would suggest updating the variable here https://github.com/mozilla/kuma/blob/master/kuma/static/styles/includes/_vars.scss#L132 to be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All set! |
||
|
||
$small-desktop-starts: $tablet-ends + .001em; | ||
$tablet-starts: $mobile-ends + .001em; | ||
$mobile-starts: $small-mobile-ends + .001em; | ||
|
||
$navigation-break-ends: (1100px / 16px) * 1em; | ||
$navigation-block-ends: (850px / 16px) * 1em; | ||
$navigation-break-ends: (1100px / 15px) * 1em; | ||
$navigation-block-ends: (850px / 15px) * 1em; | ||
|
||
$navigation-break-starts: $navigation-block-ends + .001em; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sneaking another preload in here now that we have it down to just the two web fonts. Helps a bit with rendering (about 35% reduction over not preloading for the home page which doesn't have much render work to begin with, but only about 5% reduction over no preload on an interactive example page), but mostly ensures the web fonts are available right away.