Closed (fixed)
Project:
@font-your-face
Version:
7.x-1.0-beta3
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Jan 2011 at 23:52 UTC
Updated:
20 Feb 2011 at 19:10 UTC
Jump to comment: Most recent file
Comments
Comment #1
carvalhar commentedPS:
if i manually access the css file, with the correct path, i can see that the CSS code is right.
http://localhost/drupal7/sites/default/files/fontyourface/font.css?kwq1q
h2 { font-family: 'AcknowledgementMedium'; }
body { font-family: 'ActionManRegular'; }
.field-items { font-family: 'Allerta'; }
Comment #2
sreynen commentedI'm pretty sure I know where the problem is, but I'm not yet sure how to solve it. The problem, I think, is with this code in the fontyourface_add_css_in_preprocess() function:
What that's doing is taking the file wrapper CSS path that gets passed into the function, which is something like "public://fontyourface/font.css" and converting it to the path to the CSS file relative to the base_path(), which is what drupal_add_css() takes, e.g. "sites/default/files/fontyourface/font.css". I haven't found any way to do this in Drupal 7, so I wrote the code above. I was worried it wouldn't be reliable when I wrote it and it sounds like it's not. Specifically, it looks like it fails on Windows, maybe because that slash is a backslash on Windows? I'm going to ask around more and see if there isn't a more platform-neutral way to do this with core D7 functions.
@carvalhar, if you're able to tell me what drupal_realpath('.') and base_path() each return on your Windows system, that would be useful.
Comment #3
carvalhar commentedHi,
I got these values:
full_path = C:\xampp\htdocs\drupal7\sites\default\files\fontyourface\font.css
base_path = C:\xampp\htdocs\drupal7
css_path = C:\xampp\htdocs\drupal7\sites\default\files\fontyourface\font.css
I found a function:
conf_path()
http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/conf_path
It does check for the default directories, i suppose "files/fontyourface" will be the same always no?
I'm using this code and the url is working properly:
$css_path = conf_path() . "/files/fontyourface/font.css";
I got a url like: http://localhost/drupal7/sites/default/files/fontyourface/font.css?kwq1q7
BUT some fonts doesn't change, and some case i get a serif-bad-look very different from the font i choose.
AcknowledgementMedium -> Bad serif, wrong font (seens like a default browser font)
ActionManRegular -> doesn't change nothing
Allerta -> OK
BUT, i can see all 3 fonts working very well at admin preview.
Any way to solve it?
Thanks,
Carlos
Comment #4
sreynen commentedI'd rather not get into conf_path() as that's not necessarily related to the files directory. You could, for example, have your settings.php in sites/default and your files directory in sites/localhost/files or vice versa.
I think this patch should fix it. Let me know if it works for you.
Comment #6
sreynen commentedI'm not sure why that patch is causing a fatal error on the test bot. It's working for me locally. Moving back to "needs review" status.
Comment #7
carvalhar commentedok, it worked fine.
About the font problem, what do you think it should be? At preview they're ok...
Comment #8
sreynen commented@carvalhar, which font provider are those fonts from?
Comment #9
sreynen commentedMaking the title a little more descriptive, in case anyone else is having the same problem.
Comment #10
carvalhar commentedFont Squirrel 'AcknowledgementMedium'
Font Squirrel 'ActionManRegular'
Allerta KERNEST
The two that doesn't work are from Font Squirrel.
Comment #11
carvalhar commentedI noticed that if i enable this module's block, the content from Squirrel appears as a image, not text.
Comment #12
sreynen commentedThis patch is in beta 3, so I think the original issue here is fixed. @carvalhar, I think your other issue may have been fixed in #1038574: Font Squirrel fonts not loading. If you're still having problems with beta 3, please open a new issue.