Embedded fonts vs. Domains

Permalink
Hey!

I've seen a couple of form topics on this topic, but I haven't found a super awesome answer. When I launch a website, sometimes the fonts that are being called via the typography.css don't appear when the domain has a www and does without. If I refresh the cache when logged in with www, it's fine and if you look at the domain without the www, the font disappears. The only solution I've figured out to fix this is to pull the typography.css in twice in different ways. Soo...

<link rel="stylesheet" type="text/css" href="<?php echo $this->getStyleSheet('typography.css'); ?>" />
   <link rel="stylesheet" type="text/css" href="<?php echo $this->getThemePath() ?>/typography.css" />


I don't have quotes around the font faces. And I have used the weird smilie face on the one line font-face line that some people were suggesting.

Just curious if anyone else has experienced this as well.

Thanks!

rainmaker
 
PineCreativeLabs replied on at Permalink Best Answer Reply
PineCreativeLabs
I would avoid trying to call the stylesheet twice, as that may cause conflicts.

Instead, I suggest doing this: pre-define the absolute url, then reference it when calling it, like so:

define('FONT_URL',BASE_URL.DIR_REL.'/packages/my_package/themes/my_theme/');
<link rel="stylesheet" type="text/css" href="<?php echo FONT_URL ?>typography.css" />


Doing this will force the absolute URL, so it should make it so it loads properly.
rainmaker replied on at Permalink Reply
rainmaker
I hated calling the stylesheet twice. It was bugging me. This is awesome! Do I place the define code line in the config file or in the header file?

Thanks!
PineCreativeLabs replied on at Permalink Reply
PineCreativeLabs
You would place the "define" line in the header (the same file that the <link...> line is in). You could actually just copy / paste the code I provided above into the header file, and you should be set.

Also, you could re-use the same defined variable FONT_URL multiple times for calling the other css files.
rainmaker replied on at Permalink Reply
rainmaker
Brilliant! Thanks!