function google_fonts_api_fontyourface_preview in @font-your-face 7.2
Same name and namespace in other branches
- 6.2 modules/google_fonts_api/google_fonts_api.module \google_fonts_api_fontyourface_preview()
- 6 modules/google_fonts_api/google_fonts_api.module \google_fonts_api_fontyourface_preview()
- 7 modules/google_fonts_api/google_fonts_api.module \google_fonts_api_fontyourface_preview()
Implements hook_fontyourface_preview().
File
- modules/
google_fonts_api/ google_fonts_api.module, line 21
Code
function google_fonts_api_fontyourface_preview($font, $text = NULL, $size = 18) {
$output = '';
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 .= '<div style="' . fontyourface_font_css($font) . ' font-size: ' . $size . 'px; line-height: ' . $size . 'px;">' . $text . '</div>';
}
// foreach
}
else {
// Display single size.
$output = '<span style="' . fontyourface_font_css($font) . ' font-size: ' . $size . 'px; line-height: ' . $size . 'px;">' . $text . '</span>';
}
// else
return $output;
}