You are here

function fonts_com_saved_api_font in @font-your-face 7.2

Loads saved version of API font, or saves new copy if not already saved.

2 calls to fonts_com_saved_api_font()
fonts_com_browse_form in modules/fonts_com/fonts_com.module
Shows browse filters and results.
fonts_com_enable_from_active_project in modules/fonts_com/fonts_com.module
Enables fonts locally based on the current active project.

File

modules/fonts_com/fonts_com.module, line 1331

Code

function fonts_com_saved_api_font($import_font) {
  $url = 'http://webfonts.fonts.com/en-US/Project/ChooseFonts?ViewDetails=T&ViewFontID=' . $import_font->FontID . '&AddFontToPalette=T';
  $saved_fonts = fontyourface_get_fonts("url = '" . $url . "'");
  if (count($saved_fonts) > 0) {
    return array_shift($saved_fonts);
  }

  // if
  $font = fonts_com_api_to_font($import_font);
  fontyourface_save_font($font);
  return $font;
}