question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't find font family on Google Fonts API if family name contains multiple words, e.g. Libre Caslon Text

See original GitHub issue

Observed behaviour

At https://github.com/google/fonts/pull/2432, one of the WARNs is

WARN: METADATA.pb: Fontfamily is listed on Google Fonts API?

However, Libre Caslon Text is listed on the API.

I believe this issue may come from the faulty assumption that family names are a single word. The check that throws this warn ultimately depends on proper splitting in the following function:

https://github.com/googlefonts/fontbakery/blob/1f894dcb95b143242fc59c382541c3bb9516e386/Lib/fontbakery/profiles/googlefonts_conditions.py#L325-L334

https://github.com/googlefonts/fontbakery/blob/1f894dcb95b143242fc59c382541c3bb9516e386/Lib/fontbakery/profiles/googlefonts_conditions.py#L260-L267

If I’m following correctly, for LibreCaslonText[wght].ttf, it:

  • gets the string before .ttf
  • splits at [
  • ends up as [“LibreCaslonText”]
  • (unsuccessfully) tries to replace " " with "+"
  • searches for http://fonts.googleapis.com/css?family=LibreCaslonText when it should actually search for http://fonts.googleapis.com/css?family=Libre+Caslon+Text

Expected behaviour

We need to find a reliable way to search for the correct CSS URL, e.g. http://fonts.googleapis.com/css?family=Libre+Caslon+Text. I’m not sure what approach would be best between all families.

Maybe we should seek out camel-casing, and split the family name where there are capital letters? I’m not quite sure what spillover effects that might have, or what the best approach might be.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
arrowtypecommented, Apr 23, 2020

Hey @felipesanches, thanks for so clearly documenting the process of fixing this! It’s really interesting to read now, and I’m bookmarking it for the future when I try to make a similar fix myself. Thanks also for fixing this so quickly. 😃

1reaction
felipesanchescommented, Apr 22, 2020

@arrowtype, I am being more verbose than usual here in the hope of illustrating the way I typically deal with these issues and how I like to fix them by first capturing the bad behaviour in our code-tests.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Libre Caslon Text - Google Fonts
Google Fonts : Libre Caslon Text​​ Libre Caslon Text is optimized for web body text (typically set at 16px), whilst the companion family...
Read more >
CSS API update - Fonts - Google Developers
Google Fonts now fully supports variable fonts in the v2 API update. We'll explain how to call both single and multiple font families...
Read more >
How to best set the filenames of VFs · Issue #1817 · google/fonts
Currently we name VFs filenames as Family-Regular.ttf. I think filename Family-Roman.ttf and Family-Italic.ttf is better, especially as ...
Read more >
How can i import all google font at once? - Stack Overflow
Go to https://fonts.google.com/ and start clicking every, single, font, and every, single, font weight (better get some food and drink ready, it ...
Read more >
How to import a Google font which has two words in the name?
You will have to download and edit the theme file to include the font name and then import it back into Chargebee. Example:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found