Download & Extend

Fonts enabled in theme .info are never disabled

Project:@font-your-face
Version:7.x-2.x-dev
Component:Google Fonts (provider)
Category:bug report
Priority:normal
Assigned:sreynen
Status:closed (fixed)

Issue Summary

Hello,

I'm looking at using this module on a project, and I'm having some issues. None of the fonts I've tried are loading. I'm getting the "Make sure the font exists in the google_fonts_api list" error. It works with Droid Sans, but not the other two fonts I tried adding the following in my theme:

fonts[google_fonts_api][] = "Telex&subset=latin#regular"
fonts[google_fonts_api][] = "Asap&subset=latin#regular"

They do exist:

http://fonts.googleapis.com/css?family=Telex
http://fonts.googleapis.com/css?family=Asap

I have the fontyourface + google API fonts modules enabled, but not the UI. Views is not being used on the project, and I'm not able to add it. Not sure if that has anything to do with why I'm having this problem, but from reading other issues it seems like it may be relevant.

Am I doing something wrong? Thanks. :)

Comments

#1

Also, just noticed that when I use "Droid Sans" this is the output I get and it doesn't look right to me:

<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Contrail One:regular|Droid Sans:regular|Droid Serif:regular&amp;subset=latin" media="all" />

This is the code I have in the theme:

fonts[google_fonts_api][] = "Droid Sans&subset=latin#regular"

At first, I had the example from the README file, which is "Contrail One," but that's gone so that probably shouldn't be there.

#2

Category:support request» bug report
Assigned to:Anonymous» sreynen

Yes, all Google web fonts are supported.

Your theme info looks right, and you shouldn't need the UI nor Views for that to work. The theme embedding is relatively new functionality, so my guess is you've discovered a new bug. It will be a couple days before I'll have time to confirm that.

On the Contrail One issue, I can already confirm that's a bug. The info file parsing enables fonts, but there's nothing disabling them, so they stay enabled even if you remove them from the info file. I think instead of enabling them, we should probably just be loading them with the current page. That would also be a bit faster, since it doesn't involve writing to the database.

#3

Hey, thanks so much for the quick response! :)

I'm happy to test a patch/fix when you get around to it! Thanks again.

#4

Title:Are all Google Fonts Supported?» Fonts enabled in theme .info are never disabled
Version:7.x-2.0» 7.x-2.x-dev
Status:active» needs review

On the first issue, I get different URLs suggested for those fonts, and these URLs seem to work:

fonts[google_fonts_api][] = "Asap&subset=latin#400"
fonts[google_fonts_api][] = "Telex&subset=latin#400"

My guess is at some point between when you imported the fonts and now, the Google API started referring to weights by number (400) rather than name (regular), which broke the URL matching. I don't see a good fix for this, since the URL is our only UUID for fonts, and that info comes directly from Google. Hopefully they won't make a habit of changing those.

On the issue of fonts enabling when added to the .info file, I committed a change to the -dev version that adds the fonts to the registry rather than auto-enabling them. This won't help with the fonts you already have enabled, but should prevent the problem from repeating. If you need to disable a font previously enabled via the .info file and can't enable the UI module on the site, I think your only option is doing that directly in the database by setting fontyourface_font.enabled from 1 to 0.

#5

Status:needs review» fixed

I'm going to mark this as fixed and do a 7.x-2.1 review. If anyone is still having these problems with the 7.x-2.1 release, please re-open.

#6

I actually did try this at first but it didn't work. The example you posted is working now, which is great, but the syntax doesn't match the instructions from Google fonts, so it would be good to include some documentation if possible. Right now I don't know how to get the other font weights and/or extended character sets. It would be ideal if we could just paste in what the Google page tells us to, but since that doesn't work, I'm wondering what the patterns are to accomplish this.

The process I followed was this:

  1. Found the font I want: http://www.google.com/webfonts#UsePlace:use/Collection:Asap
  2. Checked the example in README.txt: fonts[google_fonts_api][] = "Contrail One&subset=latin#regular" and figured, okay, I just grab the "family" query string from Google and add it.
  3. Did so in my .info file: fonts[google_fonts_api][] = "Asap:400,700,400italic,700italic&subset=latin,latin-ext"
  4. And FAIL.

So, just trying to get to a point where I understand this enough to be able to explain it to the team that will be using it. Any help would be appreciated. Thanks :)

#7

You should see a "in theme" tab on the apply page that gives you the exact syntax to put in your .info file. If you're not seeing that, or the syntax from there isn't working, let me know. I've created a new issue to make that clearer in the README.txt: #1450832: Change README.txt description of theme inclusion to suggest pulling syntax directly from UI

#8

Ah, well I'm not seeing it because I cannot use the UI without Views. I'll subscribe to the other issue. Thanks. :)

#9

Can you use the UI on a dev site? I think that's the only way we can provide the correct syntax. The paths come from the API, which doesn't necessary match directly to the user-facing URLs on Google's site.

#10

I'm not able to add Views on this one. :s I could personally create a dev site to try it, but that's too much to expect the client to do that on each site that gets rolled out on this platform. Anyway, it's all good if Views is required for this... That is certainly your prerogative and totally understandable. I'll find some other way to do it. :D

It's probably worth updating the README though, stating that the UI is required (at least during development) to find out what strings to use in the .info file.

#11

The theme .info syntax part of the UI doesn't actually need Views, but it's all wrapped in the same module right now. Maybe we should move that to the main module or a new single-purpose module.

#12

That would be great! If you guys get around to it, I'd be happy to test it out. :D

#13

Hey Jacine,

just for clarification: the font-your-face module importes each font variant as a single entry.
To use them in your theme.info, you need to declare each variant on a separate line.

Did so in my .info file: fonts[google_fonts_api][] = "Asap:400,700,400italic,700italic&subset=latin,latin-ext"

Please try the following:

fonts[google_fonts_api][] = "Asap&subset=latin#400"
fonts[google_fonts_api][] = "Asap&subset=latin-ext#400"
fonts[google_fonts_api][] = "Asap&subset=latin#700"
fonts[google_fonts_api][] = "Asap&subset=latin-ext#700"
fonts[google_fonts_api][] = "Asap&subset=latin#400italic"
fonts[google_fonts_api][] = "Asap&subset=latin-ext#400italic"

I think this will work.

#14

That does work, thank you BarisW. :)

#15

Hey guys, I just wanted to let you know that I am now able to use Views on this project, so I no longer have to worry about this issue. Thank you very much for the help/support. :D

#16

Status:fixed» closed (fixed)

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

nobody click here