function edge_fonts_fontyourface_import in @font-your-face 7.2
Implements hook_fontyourface_import().
File
- modules/
edge_fonts/ edge_fonts.module, line 22 - Edge Fonts module main file.
Code
function edge_fonts_fontyourface_import() {
include_once 'edge_fonts.list.inc';
// Get available fonts.
$families = edge_fonts_list();
$variants = 0;
foreach ($families as $family_name => $family) {
foreach ($family['variants'] as $fvd => $variant) {
$font = new stdClass();
$font->provider = 'edge_fonts';
$font->name = $family['name'] . ' ' . $variant['name'];
$font->css_family = $family_name;
$font->css_weight = $fvd[1] . '00';
if ($fvd[0] == 'i') {
$font->css_style = 'italic';
}
$metadata = array(
'variant' => $fvd,
);
$font->metadata = serialize($metadata);
$font->url = 'http://www.edgefonts.com/?font=' . $family_name . ':' . $fvd . '#list-of-available-fonts';
$font->license = 'Font license';
$font->license_url = $variant['license'];
fontyourface_save_font($font);
$variants++;
}
}
drupal_set_message(t('!fonts Edge Fonts of !families families imported/updated.', array(
'!fonts' => $variants,
'!families' => count($families),
)));
fontyourface_log('!fonts Edge Fonts of !families families imported/updated.', array(
'!fonts' => $variants,
'!families' => count($families),
));
// Return TRUE if we succeeded in importing something, FALSE if not.
return (bool) count($families);
}