You are here

function fonts_com_api_to_font in @font-your-face 7.2

Translates API font to @font-your-face format.

3 calls to fonts_com_api_to_font()
fonts_com_import_from_project in modules/fonts_com/fonts_com.module
Imports fonts from a given project.
fonts_com_import_process in modules/fonts_com/fonts_com.module
Processes importing fonts.
fonts_com_saved_api_font in modules/fonts_com/fonts_com.module
Loads saved version of API font, or saves new copy if not already saved.

File

modules/fonts_com/fonts_com.module, line 1299

Code

function fonts_com_api_to_font($import_font) {
  $metadata = array(
    'details' => $import_font,
  );
  if (isset($import_font->project)) {
    $metadata['project_id'] = $import_font->project->ProjectKey;
  }

  // if
  $font = new stdClass();
  $font->name = $import_font->FontName;
  $font->url = 'http://webfonts.fonts.com/en-US/Project/ChooseFonts?ViewDetails=T&ViewFontID=' . $import_font->FontID . '&AddFontToPalette=T';
  $font->provider = 'fonts_com';
  $font->metadata = serialize($metadata);
  $font->css_family = $import_font->FontCSSName;
  $font->css_style = '';
  $font->css_weight = '';
  if (isset($import_font->FontFoundryName)) {
    $font->foundry = $import_font->FontFoundryName;
  }

  // if
  $font->tags = array();
  return $font;
}