Skip to content

Commit 054fffa

Browse files
authored
feat(site): offline lato 2.0, systemfonts, no googleimport by default
This PR bundles the recent Lato 2.0 Font. It uses the same styles as the previous googleFonts Import does. This fixes possible GDPR issues as the default theme now disables googlefont import. I implemented a new variable @fonts which allows for a totally free description of font faces to be imported if needed. Each declared property will be used, so one can customize them as needed by that single variable. Disabling the whole import can be done via @importFont: false or setting @font: {} or setting @fontName: '' just as one likes. The new variables for unicode or font properties are done to simplify the default import and of course if one just wants to adjust them without redeclaring the whole @font variable mixin. I also added @supportIE which allows to disable the woff-font import, as all other supported browsers support woff2 already. This new variable and also the icon font-face will be adjusted accordingly in a separate PR... in case you might ask/wonder 😉 The default theme uses Lato-Latin 2.0 now which is smaller in size but includes the most important glyphs for European Latin-based languages which were missing in Lato v1 (via googlefonts) like in "Řeřicha" It also uses Lato with Greek+Cyrillic+Extended 2.0 via unicode-range property which makes sure the font is only loaded when related characters are used inside the page. If no character matches at all, the system fonts will be used as fallback. I created the unicode ranges by analyzing the fonts character ranges using fontforge/fontforge I also added an optional theme to adjust the font via a change in theme.config: systemfont (which completely disables any font import and uses the platform system fonts only instead AND adjusts the bold setting so the overall visual appearance is very similar) See comments below for more info. The used Lato fonts are available free of charge under the SIL Open Font License from http://www.latofonts.com
1 parent 28948f4 commit 054fffa

22 files changed

+132
-6
lines changed

src/theme.less

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,19 @@
6060
Fonts
6161
-------------------*/
6262

63-
.loadFonts() when (@importGoogleFonts) {
64-
@import (css) url('@{googleProtocol}fonts.googleapis.com/css2?family=@{googleFontRequest}');
63+
.loadFonts() {
64+
& when (@importGoogleFonts) {
65+
@import (css) url('@{googleProtocol}fonts.googleapis.com/css2?family=@{googleFontRequest}');
66+
}
67+
& when (@importFonts) and not (@fontName = ''){
68+
each(@fonts, {
69+
@font-face {
70+
each(@value,{
71+
@{key}: @value;
72+
});
73+
}
74+
})
75+
}
6576
}
6677

6778
/*------------------

src/themes/amazon/globals/site.variables

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
@fontSize : 13px;
1010
@fontName : 'Arial';
1111
@importGoogleFonts : false;
12+
@importFonts: false;
1213

1314
@h1: 2.25em;
1415

302 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)