You are here

function _fontscom_api_parse_imported_font in @font-your-face 8.3

Parses and adds additional data to fonts.com font object.

Parameters

object $fontscom_font: Fonts.com font object.

1 call to _fontscom_api_parse_imported_font()
fontscom_api_fontyourface_import in modules/fontscom_api/fontscom_api.module
Implements hook_fontyourface_import().

File

modules/fontscom_api/fontscom_api.module, line 560
Fonts.com API module file.

Code

function _fontscom_api_parse_imported_font($fontscom_font) {
  $fontscom_font->name = $fontscom_font->FontName;
  $fontscom_font->css_style = 'normal';
  if (stripos('Italic', $fontscom_font->FontName) !== FALSE) {
    $fontscom_font->css_style = 'italic';
  }
  $fontscom_font->css_weight = 400;
  if (stripos('Extra Light', $fontscom_font->FontName) !== FALSE || stripos('Ultra Light', $fontscom_font->FontName) !== FALSE) {
    $fontscom_font->css_weight = 100;
  }
  if (stripos('Thin', $fontscom_font->FontName) !== FALSE) {
    $fontscom_font->css_weight = 200;
  }
  if (stripos('Light', $fontscom_font->FontName) !== FALSE) {
    $fontscom_font->css_weight = 300;
  }
  if (stripos('Medium', $fontscom_font->FontName) !== FALSE) {
    $fontscom_font->css_weight = 500;
  }
  elseif (stripos('SemiBold', $fontscom_font->FontName) !== FALSE || stripos('Semi Bold', $fontscom_font->FontName) !== FALSE) {
    $fontscom_font->css_weight = 600;
  }
  elseif (stripos('Bold', $fontscom_font->FontName) !== FALSE) {
    $fontscom_font->css_weight = 700;
  }
  elseif (stripos('Heavy', $fontscom_font->FontName) !== FALSE) {
    $fontscom_font->css_weight = 800;
  }
  elseif (stripos('Black', $fontscom_font->FontName) !== FALSE) {
    $fontscom_font->css_weight = 900;
  }
}