Closed (fixed)
Project:
@font-your-face
Version:
7.x-2.x-dev
Component:
Typekit (provider)
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
10 Jul 2012 at 17:41 UTC
Updated:
13 Aug 2012 at 01:31 UTC
Jump to comment: Most recent file
Comments
Comment #1
sreynen commentedAs a work-around, you could remove the quotes from line 572 of fontyourface.module. Those quotes are necessary for some fonts, but not for Typekit. As a full fix, we'll need to treat Typekit a little differently. I think it's the only provider that uses multiple family names for the same font.
Comment #2
primus commentedThanks, that will work for now, I'll just make a note of it in case I update the module.
Comment #3
sreynen commentedThis should probably be higher than minor priority, even with a work-around.
Comment #4
sreynen commentedMarked #1659508: Typekit & Version 2.3 as a duplicate of this.
Comment #5
csmiller commentedThank you, removing the single quotes on line 572 fixed the problem.
Comment #6
Drave Robber commentedI couldn't quite reproduce the issue at hand as I could not find any such fonts in the trial version of Typekit (how does one recognize them - or am I missing something?), but the patch attached should deal with it.
A downside of this approach is that we're passing a sort of half-baked string to another module - these things easily break when something changes at one or another end. (That's why I at least added a comment.)
An alternative would trying to explode/re-implode the string in fontyourface.module (on condition of
$font->provider == 'typekit_api'), but that would fly even worse. See,font-family: 'Boom, bang!';is actually a valid declaration, and even if Typekit doesn't use anything like that now, we'd need to account for all possibilities and let loose a hungry regexp or two, which wouldn't help performance at all.Comment #7
sreynen commentedWe're currently saving valid font-family strings and making them invalid on output (for Typekit). Saving invalid strings and making them valid on output will fix the immediate problem, but seems likely to introduce new problems in the future (with anything else that uses those string), and fixing those problems with invalid strings in the database sounds like a problem worth trying to avoid. I think instead we should focus on making the output smarter.
I think originally the output didn't add quotes at all and relied on the provider to add the quotes. That was probably a better approach, but not practical to go back to that now. We could do a more targeted step back toward that. Rather than adding a Typekit-specific exception, we could add exceptions that look at the string itself. Specifically, if a string already starts with a quote, we shouldn't be adding new quotes. If we add that condition on output, then we just need to add a start and end quotes to your patch, and we'll have valid strings in both the database and output.
Am I missing anything?
Comment #8
Drave Robber commentedMakes sense. I'll roll a new patch.
(Blame my general disbelief in existence of 'third ways')
Comment #9
Drave Robber commentedThis patch implements sreynen's suggestions from #7.
Comment #10
sreynen commentedThis is committed.
I changed
if (strpos("'", $font->css_family) === 0) {toif ($font->css_family[0] === "'") {which should be a bit faster as it doesn't need to search through the whole string.Comment #11
sreynen commentedNote: to fix this problem on an install that already has Typekit fonts imported, you'll need to re-import Typekit after updating the code.