You are here

function fontyourface_font_css in @font-your-face 7.2

Same name and namespace in other branches
  1. 8.3 fontyourface.module \fontyourface_font_css()
  2. 6.2 fontyourface.module \fontyourface_font_css()
  3. 7 fontyourface.module \fontyourface_font_css()

Creates CSS with any properties set on font.

9 calls to fontyourface_font_css()
edge_fonts_fontyourface_preview in modules/edge_fonts/edge_fonts.module
Implements hook_fontyourface_preview().
fontdeck_fontyourface_preview in modules/fontdeck/fontdeck.module
Implements hook_fontyourface_preview().
fonts_com_fontyourface_preview in modules/fonts_com/fonts_com.module
Implements hook_fontyourface_preview().
fontyourface_generate_css in ./fontyourface.module
Generates CSS.
fontyourface_wysiwyg_generate_css in modules/fontyourface_wysiwyg/fontyourface_wysiwyg.module
Generates CSS.

... See full list

File

./fontyourface.module, line 578

Code

function fontyourface_font_css($font) {
  $css = array();
  if ($font->css_family) {

    // Enclose font family definition in single quotes if not already enclosed.
    if ($font->css_family[0] === "'") {
      $family_list = $font->css_family;
    }
    else {
      $family_list = "'" . $font->css_family . "'";
    }

    // else
    if ($font->css_fallbacks) {
      $family_list .= ', ' . $font->css_fallbacks;
    }

    // if
    $css[] = 'font-family: ' . $family_list . ';';
  }

  // if
  if ($font->css_style) {
    $css[] = 'font-style: ' . $font->css_style . ';';
  }

  // if
  if ($font->css_weight) {
    $css[] = 'font-weight: ' . $font->css_weight . ';';
  }

  // if
  return implode(' ', $css);
}