function fonts_com_font_inline_css in @font-your-face 7.2
Returns CSS for a given font.
2 calls to fonts_com_font_inline_css()
- fonts_com_browse_form in modules/
fonts_com/ fonts_com.module - Shows browse filters and results.
- fonts_com_preprocess_html in modules/
fonts_com/ fonts_com.module - Implements template_preprocess_html().
File
- modules/
fonts_com/ fonts_com.module, line 244
Code
function fonts_com_font_inline_css($font) {
$metadata = unserialize($font->metadata);
$font_css = '@font-face {' . "\n";
$font_css .= " font-family: " . $font->css_family . ";" . "\n";
$font_css .= ' src: url("' . $metadata['details']->EOTURL . '");' . "\n";
$combined_sources = array();
$combined_sources[] = 'url("' . $metadata['details']->TTFURL . '") format("truetype")';
$combined_sources[] = 'url("' . $metadata['details']->WOFFURL . '") format("woff")';
if (preg_match('#origId=([^&]+)&#i', $metadata['details']->SVGURL, $svg_match)) {
$combined_sources[] = 'url("' . $metadata['details']->SVGURL . '#' . $svg_match[1] . '") format("svg")';
}
// if
$font_css .= ' src: ' . implode(', ', $combined_sources) . ';' . "\n";
if ($font->css_style != '') {
$font_css .= ' font-style: ' . $font->css_style . ';' . "\n";
}
// if
if ($font->css_weight != '') {
$font_css .= ' font-weight: ' . $font->css_weight . ';' . "\n";
}
// if
$font_css .= '}' . "\n";
return $font_css;
}