function fontsquirrel_fontyourface_preview in @font-your-face 7.2
Same name and namespace in other branches
- 6.2 modules/fontsquirrel/fontsquirrel.module \fontsquirrel_fontyourface_preview()
- 6 modules/fontsquirrel/fontsquirrel.module \fontsquirrel_fontyourface_preview()
- 7 modules/fontsquirrel/fontsquirrel.module \fontsquirrel_fontyourface_preview()
Implements hook_fontyourface_preview().
File
- modules/
fontsquirrel/ fontsquirrel.module, line 19
Code
function fontsquirrel_fontyourface_preview($font, $text = NULL, $size = 18) {
$output = '';
$metadata = unserialize($font->metadata);
if ($text == NULL) {
$text = $font->name;
}
// if
if ($size == 'all') {
// Display variety of sizes.
$sizes = array(
32,
24,
18,
14,
12,
10,
);
foreach ($sizes as $size) {
$output = '<img src="http://www.fontsquirrel.com/utils/makeFont.php?font=' . $metadata['id'] . '/' . $metadata['font_filename'] . '&width=300&size=' . $size . '&text=' . urlencode($text) . '" />';
}
// foreach
$output .= '<div><img src="http://www.fontsquirrel.com/utils/makeSolotypeSample.php?font=' . $metadata['id'] . '/' . $metadata['font_filename'] . '&case=all" /></div>';
}
else {
// Display single size.
$output = '<img src="http://www.fontsquirrel.com/utils/makeFont.php?font=' . $metadata['id'] . '/' . $metadata['font_filename'] . '&width=150&size=' . ($size - 10) . '&text=' . urlencode($text) . '" />';
}
// else
return $output;
}