Problem/Motivation

How about including the fonts in the Umami demo theme, and not rely on Google?

Pros:

  • Not relying on the Google CDN.
  • Avoid potentially slow load times.
  • More privacy-friendly.

Cons:

  • A little extra work coding it.
  • Increased size of the packaged Drupal core archive. Approximately 100 kB? The fonts are binaries which won't benefit.much from compression.

I originally raised the question in #2943657: Embedding only needed weights for Open Sans and Scope One (#19). There were a few comments about font licenses, but in the end @alexpott commented:

... it looks like there has been a change to what can be packages so maybe these fonts can be packaged - see #2919135: Update /git-repository-usage-policy to allow "GPL friendly" licensed non-code assets

Proposed resolution

Adds Open Sans and Scope One fonts (latin1 encoding only), but all web font formats, to Drupal core.

Remaining tasks

Needs frontend framework manager review.

User interface changes

CommentFileSizeAuthor
#77 2960583_77.patch3.16 KBandy-blum
#75 2960583_70-75.txt2.36 KBandy-blum
#75 2960583_75.patch76.23 KBandy-blum
#70 2960583-70.patch76.62 KBAnchal_gupta
#70 interdiff-2960583-67_70.txt63.85 KBAnchal_gupta
#67 2960583-56.patch140.46 KBAnchal_gupta
#66 2960583-55.patch166.57 KBAnchal_gupta
#63 2960583-54.patch166.57 KBAnchal_gupta
#63 interdiff-2960583-53_54.txt1.96 KBAnchal_gupta
#53 interdiff-52-53.txt3.88 KBressa
#53 includefonts-2960583-53.patch167.17 KBressa
#52 includefonts-2960583-52.patch167.17 KBressa
#50 umami-source-sans-pro.png4.99 MBEli-T
#50 umami-home-inter.png4.92 MBEli-T
#46 Screenshot 2022-04-04 at 16-25-47 About Umami ddev_gitpod.png219.33 KBEli-T
#46 Screenshot 2022-04-04 at 16-24-22 Give it a go and grow your own herbs ddev_gitpod.png3.83 MBEli-T
#46 Screenshot 2022-04-04 at 16-21-12 Give it a go and grow your own herbs ddev_gitpod.png3.84 MBEli-T
#46 Screenshot 2022-04-04 at 16-19-51 Main courses ddev_gitpod.png1.05 MBEli-T
#46 Screenshot 2022-04-04 at 16-18-24 Main courses ddev_gitpod.png1.06 MBEli-T
#46 Screenshot 2022-04-04 at 16-16-53 Super easy vegetarian pasta bake ddev_gitpod.png1.15 MBEli-T
#46 Screenshot 2022-04-04 at 16-15-43 Super easy vegetarian pasta bake ddev_gitpod.png1.15 MBEli-T
#46 Screenshot 2022-04-04 at 16-13-17 Recipes ddev_gitpod.png2.82 MBEli-T
#46 Screenshot 2022-04-04 at 16-12-18 Recipes ddev_gitpod.png2.82 MBEli-T
#46 Screenshot 2022-04-04 at 16-11-17 Articles ddev_gitpod.png1.82 MBEli-T
#46 Screenshot 2022-04-04 at 16-10-16 Articles ddev_gitpod.png1.82 MBEli-T
#46 Screenshot 2022-04-04 at 16-08-43 Home ddev_gitpod.png3.3 MBEli-T
#46 Screenshot 2022-04-04 at 16-05-16 Home ddev_gitpod.png3.32 MBEli-T
#46 home.png3.71 MBEli-T
#45 includefonts-2960583-45.patch80.34 KBressa
#42 2960583-ubuntu-with-local-fonts.png178.43 KBshaal
#37 includefonts-2960583-37.patch87.5 KBressa
#36 includefonts-2960583-36.patch349.35 KBressa
#5 includefonts-2960583-5.patch328.91 KBparijke

Issue fork drupal-2960583

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ressa created an issue. See original summary.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Eli-T’s picture

Scope One is licensed under SIL Open Font Licence 1.1 https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL_web. This is the same license as used for Font Awesome as listed at https://www.drupal.org/packaging-whitelist?title=font, therefore it looks like we can include it in the theme.

Open Sans uses Apache License 2.0 .This is the same license as used for which Facebook PHP SDK, Google Code Prettify, which are also on our packaging whitelist https://www.drupal.org/packaging-whitelist?page=1 so looks like we can also use it in the theme.

So this looks good to proceed from a licensing PoV. Also would be good for people installing without network connectivity etc. So let's do it!

kjay’s picture

Issue tags: +Novice, +DrupalEurope

Working with @eli-t and @mradcliffe at DrupalEurope. We can confirm that we have all just checked the licensing as described in #3. Should be good for including the font in the theme subject to relevant product manager review/approval.

parijke’s picture

I gave it a shot, downloading the fonts from google and embedded them in the base.css

Eli-T’s picture

Status: Active » Needs review
ressa’s picture

Thanks @parijke, great work! It looks fine in Firefox and Chromium on Ubuntu. I tested IE11 on Windows 8.1 and Safari 11.1 on macOS High Sierra via Browserstack, and it also looks good.

PS. I really like how patch-testing can be done super fast, with the recently included Quick Start Command:

mkdir drupal && cd drupal && curl -sSL https://www.drupal.org/download-latest/tar.gz | tar -xz --strip-components=1
wget https://www.drupal.org/files/issues/2018-09-20/includefonts-2960583-5.patch
git apply -v includefonts-2960583-5.patch
php core/scripts/drupal quick-start demo_umami
kjay’s picture

siliconmeadow’s picture

Status: Needs review » Reviewed & tested by the community

Good work @parijke. The patch applied cleanly and all appears to work properly out-of-the-box.

parijke’s picture

Thank you for the compliment... it's my first ever contribution to core

Not Real’s picture

Instead of downloading the fonts from google I recommend using https://google-webfonts-helper.herokuapp.com/fonts/

Also be aware that the line
+ src: local('Open Sans Regular'), local('OpenSans-Regular'),

Will mean that the font is loaded from the users own computer (local) before the font is loaded from the web site

Normally this won't be a problem BUT if the user has a different font with the same name OR they have only installed one weight of the font locally this will cause issues

parijke’s picture

It is the preferred way recommended by Google. I think because it makes sense to load from locsl if it exists there to optimize performance.

Can't foresee if this would cause any problems.

andrewmacpherson’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs review
Issue tags: +Performance

It adds an extra ~400kb to the packaged Drupal core archive, so I've added a conargument to the issue summary. Currently the TGZ is 16.24mb.

Setting back to needs review, and tagging, for performance. @alexpott's comment in the related issue sounds like a tacit approval, but I'd like to hear a performance opinion.

IMO the privacy and reliability pro arguments have a lot of weight. I think we can live with the extra size.

andrewmacpherson’s picture

Issue summary: View changes

I made some mess in the summary. Cleaning it up.

parijke’s picture

We could reduce somewhat if we decide to support only Modern Browsers. That would skip the need of packaging the .eot .svg and .ttf files

longwave’s picture

We surely don't need the .eot file at least, as we don't support IE8 and below anyway? IE9 and higher will use the .woff if I understand correctly.

parijke’s picture

I believe so too.... Anyone who can approve this before I make a new patch? @kjay?

Eli-T’s picture

Looks like [#1475972], specifically https://www.drupal.org/node/1475972#gplv2-compatible-licenses contradicts my reasoning in #3, as pointed out by @laurii on today's initiative call ☹️

parijke’s picture

Can this https://www.drupal.org/project/drupal/issues/2936841 be done with the fonts as well? That would address the con mentioned in #13

parijke’s picture

@Eliot is there a difference in licensing using the fonts online or in the distribution? If not, the licensing discussion shouldn't affect this issue but goes for using the fonts in general, right?

kjay’s picture

Looks like [#1475972], specifically https://www.drupal.org/node/1475972#gplv2-compatible-licenses contradicts my reasoning in #3, as pointed out by @laurii on today's initiative call ☹️

Discussed in this week's OOTB call and @smaz noted that [#1475972] states:

Drupal also permits GPL-incompatible non-code assets (e.g. fonts, icons, etc.) to be packaged and/or distributed as long as the maintainer has the right to distribute them (i.e. they must have a free/libre license that permits them to be distributed “in aggregate” with GPL code). Such licenses are whitelisted as “GPLv-friendly”.

Despite Open Sans being Apache 2.0 and is not white-listed as GPLv2 compatible, being a font, it seems reasonable to conclude that we are able to bundle it so long as Apache 2.0 permits us to do so. Checking the Apache 2.0 license is therefore probably the next task.

volkswagenchick’s picture

Issue tags: +badcamp 2018

tagging for badcamp 2018

drumm’s picture

A well-maintained Unicode font will be updated frequently across various character sets. New emoji are added regularly and there are improvements for various languages.

This might not be a problem since the demo content is relatively static. Regular updates to the packaged fonts, and some discouragement from using the font in production, should be planned on.

volkswagenchick’s picture

Issue tags: +fldc19, +sfdug, +dcnj19

Tagging for upcoming contribution days.

Eli-T’s picture

volkswagenchick’s picture

Issue tags: +midcamp2019

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

markconroy’s picture

Hi All,

Just checking in to see if someone could summarize what we need to have this marked as RTBC. It looks like we have a working patch and general agreement about including the fonts.

The main issue that seems to be outstanding is @drumm's thought about fonts being updated, which is mitigated by our content being static and not relying on emojis and things like that.

With that being the case, I _think_ we could move this to RTBC. Anyone against that?

Adding some tags for visibility.

mradcliffe’s picture

Issue summary: View changes
Issue tags: -Novice

I am removing the Novice tag from this issue because there isn't a task for a Novice to do. This might change. I queued the patch in #5 for 9.2.x. It may make sense to mark this RTBC or try to re-upload the patch for 9.2.x.

markconroy’s picture

Since no one has disagreed with #31, I'm going to mark this as RTBC so we can get a frontend framework manager to review it.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

ressa’s picture

Here is an updated patch with the latest versions of the Open Sans and Scope One fonts, and some other necessary adjustments. I am not including an interdiff, since it would mostly be weird LF݈CԄ'J'{\w font characters.

Should .eot, and maybe other formats be removed?

ressa’s picture

The .svg fonts contain a lot of words which are caught by CSpell. I checked if any other core theme embed fonts, and Olivero does, but only use .woff and .woff2 formats. I had a look at https://caniuse.com/woff (98.48% supported) and https://caniuse.com/woff2 (96.61% supported) and most browsers are supported ... So I removed the older legacy fonts, which also reduces it to ~100 kB.

markconroy’s picture

Priority: Normal » Major

Bumping this to major, we need to give this serious attention very quickly given the court rulings in the EU about Google Fonts.

shaal’s picture

By including the font in Drupal core (#37), we eliminate all the potential legal issues?

ressa’s picture

Excerpt from German Court Rules Websites Embedding Google Fonts Violates GDPR (January 31, 2022):

The unauthorized disclosure of the plaintiff's IP address by the unnamed website to Google constitutes a contravention of the user's privacy rights, the court said, adding the website operator could theoretically combine the gathered information with other third-party data to identify the "persons behind the IP address."

Including the font in Umami would prevent this from happening, since Google is not being contacted.

Also, the patch in #37 needs review, so feel free to check if it works or not.

shaal’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
178.43 KB

I tested #37 using DrupalPod.

Fonts were loaded locally, without Google's domain.

Webpagetest.org report: https://www.webpagetest.org/result/220308_BiDc0H_ASF/

Screenshot from that report:
Performance test waterfall charts

ressa’s picture

Issue tags: +GDPR

Adding tag.

lauriii’s picture

Status: Reviewed & tested by the community » Needs work

Scope One is a compatible license meaning those assets could be packaged in Drupal. 👍

Unfortunately, Open Sans is licensed under Apache 2.0 which is not compatible with our licensing, meaning we can't include it in the package. 😓 We will likely have to try to find an alternative font which would be licensed under a compatible license.

ressa’s picture

Status: Needs work » Needs review
FileSize
80.34 KB

Thanks for confirming that Scope One has a compatible license @lauriii.

Here's a re-rolled patch with the Public Sans font, which is licensed under the SIL Open Font License 1.1, just as Scope One. With 4.1K Github stars, it looks well supported.

The SIL Open Font License 1.1 is listed as allowed under Drupal's Licenses compatible with GPL-2.0-or-later and GPL-friendly licenses so perhaps Public Sans could work as a replacement for Open Sans?

I found it via this search: https://github.com/search?q=sans+font+sil

Eli-T’s picture

I have installed with and without the patch in #49 on Drupal 9.3.9 on gitpod so we can compare Umami with Open Sans and Public Sans.

Here is the home page with Open Sans (left, unpatched) and Public Sans (right patched). Note the privacy badger warning for calling Google fonts does not show up when patched.

Full homepage with Open Sans

Full homepage with Public Sans

Article page with Open Sans

Article page with Public Sans

Recipe page with Open Sans

Recipe page with Public Sans

Individual recipe with Open Sans

Individual recipe with Public Sans

Tag page with Open Sans

Tag page with Public Sans

Individual article with Open Sans

Individual article with Public Sans

markconroy’s picture

Those screenshots with Public Sans look great to me. I'm not a designer so will defer to @kjay to verify, but this looks like a really good solution.

ressa’s picture

Thanks for the thorough work @Eli-T, and great to see both Privacy Badger and uBlock Origin in a relaxed state :)

Eli-T’s picture

Status: Needs review » Needs work

@lauriii has suggested a couple of other alternative fonts with licences compatible with Drupal:

Considering these two alongside Public Sans, it looks like Inter is actually the closest font to what we're already proposing so I'll provide another patch to trial that instead and generate some more screenshots.

Eli-T’s picture

Issue summary: View changes
FileSize
4.92 MB
4.99 MB

Now I'm not too sure if Inter is the closest suggestion so here's the home page in the original font, the Public Sans font used in the @ressa patch and the two suggested by @lauriii for design feedback/discussion.

Open Sans (original)

Only local images are allowed.

Public Sans (as suggested in #45)

Only local images are allowed.

Inter

Source Sans Pro

On closer consideration, I think as far as the character shapes are concerned, Source Sans Pro is the closest match and best works with the design, but some small amount of CSS work would be needed to adjust the size and spacing to more closely match the current font.

ckrina’s picture

Agreed with @Eli-T about the shape: Source Sans Pro is closer to Open Sans, so the style would match better.

But be aware Source Sans Pro font x-size is smaller, meaning using this one would probably need a follow-up to generally increase font sizes. The design tendency is to use bigger fonts than the ones resulting with this changes (even the same font size is set).

Maybe the second closer font on a style perspective would be Inter.

ressa’s picture

Status: Needs work » Needs review
FileSize
167.17 KB

Thanks for the comprehensive comparisons @Eli-T and feedback @ckrina. It sounds like Source Sans Pro could work, if we adjust font size and spacing.

As a first step, here is a patch with Source Sans Pro. I realized that originally, Open Sans included files with weights 400, 400i, 700, and 700i, so I have included them as well.

ressa’s picture

Fixing Expected double quotes string-quotes message in test.

Status: Needs review » Needs work

The last submitted patch, 53: includefonts-2960583-53.patch, failed testing. View results

ressa’s picture

Status: Needs work » Needs review
markconroy’s picture

I'm not sure why this issue says #53 failed, since it's green.

Are we good to put this to RTBC?

ressa’s picture

Status: Needs review » Needs work

It was a Quickedit: Element ... is not clickable false positive (see #2829040: [meta] Known intermittent, random, and environment-specific test failures). I re-ran the test and it completed, which I should have added a comment about for clarity, sorry about that.

The feedback from @Eli-T and @ckrina is that Source Sans Pro is the closest match, which is the font in the new patch. But the font size and spacing might need adjusting, so changing Status.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

ressa’s picture

To keep this moving, maybe someone could point out places where the font size and spacing needs updating? I just ran the patch with the Source Sans Pro font against 9.5.x and it passed (#53), so that bit is still working.

lauriii’s picture

We still need to address #51.

+++ b/core/profiles/demo_umami/themes/umami/css/base.css
@@ -3,6 +3,67 @@
+    url("../fonts/source-sans-pro-v21-latin-regular.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */

Let's create a Drupal 10 version of the patch without the "woff" fonts because all browsers supported by Drupal 10 support woff2.

andy-blum’s picture

Version: 9.5.x-dev » 10.1.x-dev

Anchal_gupta’s picture

I have rerolled the patch against 10.1x.
also addressed #60 and applied the changes.

lauriii’s picture

Status: Needs work » Needs review

Thank you for the patch! Changing status to Needs review to trigger a CI run.

andy-blum’s picture

Status: Needs review » Needs work

Thanks @Anchal_gupta for the patch! There are a couple issues:

  1. The font-face declarations are all broken, I believe this is due to the fact that the src property is not terminated with a semicolon. Note the url definition is trailed by a comma when it should be a semicolon.
    /* source-sans-pro-regular - latin */
    @font-face {
      font-family: "Source Sans Pro";
      src:
        local("Source Sans Pro"),
        url("../fonts/source-sans-pro-v21-latin-regular.woff2") format("woff2"), /* Chrome 26+, Opera 23+, Firefox 39+ */
    
      font-weight: 400;
      font-style: normal;
    }
        
  2. Since we're no longer using the .woff files, we shouldn't include them in the patch. Please remove these and re-upload.
Anchal_gupta’s picture

please ignore this patch. I have again reuploaded the patch in the same thread

Anchal_gupta’s picture

Thanks for your suggestions @andy-blum
I have addressed point 1. and 2. on comment #65
Here, I have Attached a patch again with fixed the error

ressa’s picture

Status: Needs work » Needs review

Thanks, changing status to trigger test.

andy-blum’s picture

Status: Needs review » Needs work

Patch in #67 still contains .woff files.

Additionally, to aid in the review of your fixes please do the following:

  • name your patches in the format <issue number>-<comment number> so that the patch number and comment numbers line up instead of incrementing the numbers of the patch.
  • provide an interdiff between incremental patches to help identify the changes from patch to patch.

If you're at drupalcon right now and would like some assistance in any of this, you can reach out to one of the mentors in mentored contribution or find me in the orange shirt at the front-end table in general contribution.

Anchal_gupta’s picture

FileSize
63.85 KB
76.62 KB

Thanks, @andy-blum for consistently reviewing my fixes and noticing my mistake, and assisting me. Really I grateful to you and next time I will remember that and follow this step
.Woff Files have been removed
I have attach the patch and interdiff also.

ressa’s picture

Thanks @Anchal_gupta, please also change status to Needs review, to trigger the test.

Anchal_gupta’s picture

Status: Needs work » Needs review

Okay, Thanks @ressa, I changed the status to trigger test.

andy-blum’s picture

Patch #70 works - the only change I'd request is to remove the comments around the font-face declarations. They don't add anything particularly valuable to core, so let's remove those and then we should be in good shape.

andy-blum’s picture

Status: Needs review » Needs work
andy-blum’s picture

Status: Needs work » Needs review
FileSize
76.23 KB
2.36 KB

New patch & interdiff

andy-blum’s picture

FileSize
3.16 KB

New patch to satisfy the linter

ckrina’s picture

Status: Needs review » Reviewed & tested by the community

Even though this isn't changing the font-size, I think the overall result looks OK. So moving this to RTBC.

lauriii’s picture

This was reviewed by @ckrina and I have reviewed this as well. Also discussed this with @justafish and @xjm and we agreed to backport this down until 9.5.x because Umami has no BC policy.

alexpott’s picture

Version: 10.1.x-dev » 9.5.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 1f1b26680c to 10.1.x and 141f888d82 to 10.0.x and ff1f52eb41 to 9.5.x. Thanks!

As per @lauriii and @xjm backported to 9.5.x

  • alexpott committed 9925f1d on 10.1.x
    Issue #2960583 by ressa, Anchal_gupta, andy-blum, parijke, Eli-T, shaal...

  • alexpott committed 141f888 on 10.0.x
    Issue #2960583 by ressa, Anchal_gupta, andy-blum, parijke, Eli-T, shaal...

  • alexpott committed ff1f52e on 9.5.x
    Issue #2960583 by ressa, Anchal_gupta, andy-blum, parijke, Eli-T, shaal...
alexpott’s picture

Committed 9925f1d and pushed to 10.1x. Thanks!
Committed 141f888 and pushed to 10.0.x. Thanks!
Committed ff1f52e and pushed to 9.5.x. Thanks!

ressa’s picture

It's so great to see this issue completed, and no longer rely on a third party. Thanks to everybody here who made it happen!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.