Selecting good fonts is a matter of design, getting suitable web-fonts a matter of knowledge. Not only, if we need some for special cases. With bootScore we can incorporate Google Fonts directly. We are even told how to host them locally, so we can bypass the notice in the privacy policy. Nevertheless, we have to get a little involved with Bootstrap as well:
Solution
- Choose from the Google Fonts:
- a font with serifs (e.g. pt-serif or noto-serif),
- a matching sans-serif font (e.g. pt-sans or noto-sans),
- a matching monospace font (pt-mono or noto-sans-mono)
- and maybe a special font for headlines (e.g. arima-madurai or eb-garamond)
- Select each font after another in the google-webfonts-helper and
- leave the charset on latin * select — if available
- select — if available — the sizes 400 and 700.
- select — if available — the styles regular, regular italic, bold and bold italic.
- copy the
font-face-code
created in google-webfonts-helper into the filescss/_bscore_custom.scss
. - download the zip-package from *google-webfonts-helper
- Create a folder
fonts
in your child theme. - Unzip all downloaded zip packages in the folder
fonts
. - Extend the file
scss/_bscore_variables.scss
with the lines:
$font-family-base: 'Noto sans', Verdana, sans-serif !default;
$font-family-sans-serif: 'Noto Sans', Verdana, sans-serif, !default;
$font-family-monospace: 'Noto Sans Mono', 'Courier New', monospace, !default;
$font-family-code: 'Noto Sans Mono', 'Courier New', monospace, !default;
$headings-font-family: 'EB Garamond', Garamond, serif !default;
$display-font-family: 'EB Garamond', Garamond, serif !default;
Background
Dealing with Fonts is — in terms of concept and content — a wide field1:
In typography, it is common to distinguish between serif fonts and sans-serif fonts. Serif fonts are better for printed running text because their horizontal extensions on the letter lead the eye in a better way. On the other hand, it was long thought that sans-serif fonts were more readable on screens. However, the finer the screens became over time, the finer the serifs could be displayed. The readability increased, and the eyes tired less. Thus — today — it is said that there is no longer any real difference in legibility: Serif fonts and sans-serif fonts can be used equally.
Using only one font for all, however, gets boring. At least the headings and body text should differ. On the other hand, too many fonts reduce readability due to the graphical unrest. And readability and immediate perceptibility is the measure of quality. Thus, the modern web designer works with pairs, one font for the headline, and one for the body text. This is why we are so often ‘recommended’ font pairs today, where the fonts are quite wildly combined.
In this context, the distinction between font-family and font-face is also important. With the CSS statement font-family: XYZ;
we tell the browser — imprecisely speaking — that it should display the text in an HTML tag with the font XYZ. In fact, however, we are telling it to display the text with a suitable font from the font family XYZ. With the CSS statement @font-face {...}
2, we have previously told it that a certain well-designed font from a certain font family (font-family: XYZ
) with a certain style (font-style: [normal|italic]
) and a certain weight (font-weight: [<400<...<700<]
) is available and where to find it. It is then up to the browser to pick the most suitable font out of the group font-family XYZ for a particular place in the HTML source code. After all, it must not only display the font itself but also take into account the specifications ‘normal, italic, bold, bold-italic’.3
If a specified font is not available — for example, because the browser could not download or understand it — then the browser chooses another ‘sans-serif’ resp. ‘serif’ font from those that are accessible. If a font of a font family does not exactly fit the other required properties, the browser can ‘produce’ them by tilting or amplifying a font computationally. However, such ‘calculated’ fonts look worse than those explicitly designed that way.4.
So, in principle, the web designer cannot be sure how her text will actually look on a reader’s computer. To increase the likelihood that the designer will be able to provide her reader with what she intends, the CSS statement font-family: XYZ;
may combine several font families — up to the generic serif
, sans-serif
, or monospace
family. The browser assures — for each letter — to take the first font from that family, with which it can display the letter as requested. Whether and how well this works also depends on the type and quality of the browser. To offer the designer even more certainty, the concept of Web Safe Fonts has emerged5: Fonts from that she knows that they are (mostly) available on the devices. From these fonts, she can choose a substitute that does not meet her design ideas optimally, but still well.
With respect to our context bootScore and Bootstrap, this creates a strategy for integrating Google fonts locally6:
We choose our preferred font pair and use — as recommended by bootScore — the google-webfonts-helper to download the corresponding Google fonts and insert the also generated @font-face
instructions into file scss/_bscore_custom.scss
.
In the file scss/_bscore_variables.scss
we then apply the Bootstrap methodology to decide for which HTML elements the fonts should be used:
With Bootstrap, we specify the ‘main font’ via the variable $font-family-base
. This can be the family of a serif font or a sans-serif font. Via the variable, $font-family-sans-serif
we specify the main sans-serif font. There is no variable $font-family-serif
. If we want to use a different family for the headings than the general main font, the variables $headings-font-family
and $display-font-family
would be responsible for this. Using this way, we easily can combine all combinations.
And how does this …
… support our migration to bootScore? Well, when the web designer has completed her work on good illustrations, she can relax and integrate tags and clouds into her site, improve her overview page and design her own landing page. Whether the resulting fullness really benefits her own reader, whether it can become slimmer and how, whether more discreet references and specific fonts also increase the readability, all this she should nevertheless consider while implementing these features. This post supports these steps towards a personalized bootScore site.
- cf. https://kinsta.com/de/blog/html-fonts/ [↩]
- cf. https://www.w3schools.com/cssref/css3_pr_font-face_rule.php [↩]
- cf. https://technicalcommunicationcenter.com/2020/06/10/whats-a-font-font-family-typeface-font-face/ [↩]
- Therefore it is important to provide the desired font family at least in the weights ‘400’ and ‘700’ and respectively in the types ‘regular’ and ‘italic’ [↩]
- cf. https://www.w3schools.com/cssref/css_websafe_fonts.php [↩]
- The alternative would be to load the fonts directly from Google font servers on a case-by-case basis. That makes your work easier. And complicates your privacy concept: Because when downloading, Google asks for user data, i.e. your reader’s data. The cause for that is your site. Therefore you have to point this out in your data protection concept. So it’s better if you download the fonts yourself, integrate them into your site, and deliver them yourself. [↩]