You are here

function _google_webfont_loader_api_load_font in Webfont Loader 8

Same name and namespace in other branches
  1. 7 google_webfont_loader_api.module \_google_webfont_loader_api_load_font()

Loads font into the webfont stack.

1 call to _google_webfont_loader_api_load_font()
google_webfont_loader_api_page_attachments in ./google_webfont_loader_api.module
Implements hook_page_attachments().

File

./google_webfont_loader_api.module, line 222
Google Webfont Loader API primary file.

Code

function _google_webfont_loader_api_load_font($font_info, $filepath = 'public://') {
  $loader_js = _google_webfont_loader_api_load_js_from_fontinfo($font_info, $filepath);

  // If there are items in the loader_js, create a setting and load the render
  // css which is useless unless correct information regarding fonts are
  // actually loaded.
  if (count($loader_js) > 0) {

    // Start loading the css that will be rendered.
    if (isset($font_info['render_css'])) {
      if (is_array($font_info['render_css'])) {
        foreach ($font_info['render_css'] as $render_css) {
          _google_webfont_loader_api_add_css($filepath . '/' . $render_css);
        }
      }
      else {
        _google_webfont_loader_api_add_css($filepath . '/' . $font_info['render_css']);
      }
    }
  }
}