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

Host font locally #284

Open
John-H-Smith opened this issue Nov 10, 2022 · 3 comments
Open

Host font locally #284

John-H-Smith opened this issue Nov 10, 2022 · 3 comments

Comments

@John-H-Smith
Copy link

As of some changes in the eu-gdpr, loading google fonts directly from google is not allowed anymore.
As the url of the google font 'neucha' is hardcoded within the css file, using papercss is not easy anymore for all website owners in the eu.
So, I would highly appreciate if there is an option of using papercss with the neucha font hosted locally.
Currently, I worked arount with manually changing to a local hosted font, but it's not future proof for updates and so on.

@rhyneav
Copy link
Member

rhyneav commented Nov 24, 2022

Hey @John-H-Smith, I think some update here makes sense. What does your current override look like? We currently conditionally import the Google font based on if it is set:

// _config.scss

// The src for fonts (false to disable)
$font-src: 'https://fonts.googleapis.com/css?family=Neucha|Patrick+Hand+SC&display=swap' !default;

// Imports
@if $font-src {
  @import url($font-src);
}

I wonder if making a switch over to something like Font Source and totally leaving the Google ecosystem would be a good step forward, but curious to hear what would work best for you and other EU website owners.

@John-H-Smith
Copy link
Author

John-H-Smith commented Nov 25, 2022

Hi @rhyneav , thank you for your answer!
For my current workaround, I downloaded the sources of the font-families 'neucha' and 'Patrick Hand SC' and set the font-family in a custom css file like so:

/* latin */
@font-face {
  font-family: 'Neucha';
  font-style: normal;
  font-weight: 400;
  src: url(/fonts/neucha.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin */
@font-face {
  font-family: 'Patrick Hand SC';
  font-style: normal;
  font-weight: 400;
  src: url(/fonts/Patrick_hand_sc.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

I know it's not a great way, but it works for the moment.

Moving to Font Source or something else is sadly no option. In the EU, you have to actively accept the loading of ANY data from a cdn, doesn't matter if it's google or something else. So for using papercss, currently every website has to include a cookie banner which allows you to accept the loading of the fonts.
The only way to get rid of that permission thing is to self-host the font on the same site.

@Oli8
Copy link
Contributor

Oli8 commented Jun 8, 2023

https://gwfh.mranftl.com/fonts might be worth looking into

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

No branches or pull requests

3 participants