Self-host Google Fonts
Due to questionable privacy policy of Google Fonts (including them being called illegal by the Munich court [1]), I have decided to self-host the fonts. I have used the google-webfonts-helper[2] to load the subset version of the font. I have also added the `local()` source so that the font will not be loaded if the user has a font with the same name installed on their system. After this commit, toot requires no 3rd-party resources any more 🎉 [1]: https://rewis.io/urteile/urteil/lhm-20-01-2022-3-o-1749320/ [2]: https://google-webfonts-helper.herokuapp.com/
This commit is contained in:
parent
34d487c422
commit
4ecf304519
7 changed files with 39 additions and 19 deletions
|
@ -32,25 +32,6 @@
|
|||
/>
|
||||
|
||||
<link href="/style.css" rel="stylesheet" />
|
||||
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin />
|
||||
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap"
|
||||
rel="preload"
|
||||
as="style"
|
||||
/>
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap"
|
||||
rel="stylesheet"
|
||||
media="print"
|
||||
onload="this.media='all'"
|
||||
/>
|
||||
<noscript>
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
</noscript>
|
||||
|
||||
<link href="/favicon.ico" rel="icon" type="image/x-icon" />
|
||||
<link href="/apple-touch-icon.png" rel="icon" type="image/svg+xml" />
|
||||
|
|
38
src/scss/_fonts.scss
Normal file
38
src/scss/_fonts.scss
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* @source: https://codeberg.org/kytta/toot/src/branch/main/src/scss/_fonts.scss
|
||||
*
|
||||
* toot - Cross-instance share page for Mastodon
|
||||
* Copyright (C) 2020-2022 Nikita Karamov <me@kytta.dev>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local("Roboto"), url("/fonts/Roboto-400.woff2?v=29") format("woff2"),
|
||||
url("/fonts/Roboto-400.woff?v=29") format("woff");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Roboto Medium";
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local("Roboto Medium"), local("Roboto-Medium"),
|
||||
url("/fonts/Roboto-500.woff2?v=29") format("woff2"),
|
||||
url("/fonts/Roboto-500.woff?v=29") format("woff");
|
||||
}
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
@use "sass:color";
|
||||
@import "fonts";
|
||||
@import "variables";
|
||||
|
||||
* {
|
||||
|
|
BIN
src/static/fonts/Roboto-400.woff
Normal file
BIN
src/static/fonts/Roboto-400.woff
Normal file
Binary file not shown.
BIN
src/static/fonts/Roboto-400.woff2
Normal file
BIN
src/static/fonts/Roboto-400.woff2
Normal file
Binary file not shown.
BIN
src/static/fonts/Roboto-500.woff
Normal file
BIN
src/static/fonts/Roboto-500.woff
Normal file
Binary file not shown.
BIN
src/static/fonts/Roboto-500.woff2
Normal file
BIN
src/static/fonts/Roboto-500.woff2
Normal file
Binary file not shown.
Reference in a new issue