You are here

function fontsquirrel_preprocess_html in @font-your-face 7.2

Implements template_preprocess_html().

File

modules/fontsquirrel/fontsquirrel.module, line 58

Code

function fontsquirrel_preprocess_html(&$vars) {
  if (!empty($vars['fontyourface'])) {
    $paths = array();
    foreach ($vars['fontyourface'] as $used_font) {
      if ($used_font->provider == 'fontsquirrel') {
        $metadata = unserialize($used_font->metadata);
        if (module_exists('google_webfont_loader_api') && !empty($used_font->css_family)) {
          $font_info = array(
            'custom_families' => array(
              $used_font->css_family,
            ),
            'custom_style_css' => array(
              'fontyourface/fontsquirrel/' . $metadata['path'] . '-fontfacekit/stylesheet.css',
            ),
          );
          _google_webfont_loader_api_load_font($font_info);
        }
        else {
          $paths[] = $metadata['path'];
        }
      }

      // if
    }

    // foreach
    if (count($paths) > 0) {
      foreach ($paths as $path) {
        fontyourface_add_css_in_preprocess($vars, 'fontyourface/fontsquirrel/' . $path . '-fontfacekit/stylesheet.css');
      }

      // foreach
    }

    // if
  }

  // if
}