From 607203652e13ab87e6b94c28aea4ee3c43d39fd1 Mon Sep 17 00:00:00 2001 From: Drave Robber Date: Fri, 5 Oct 2012 18:03:06 +0300 Subject: [PATCH] Fix preview for local fonts. --- modules/local_fonts/local_fonts.module | 37 +++++++++++++------------------ 1 files changed, 16 insertions(+), 21 deletions(-) diff --git a/modules/local_fonts/local_fonts.module b/modules/local_fonts/local_fonts.module index 9237bd9..5e4d9c5 100644 --- a/modules/local_fonts/local_fonts.module +++ b/modules/local_fonts/local_fonts.module @@ -455,29 +455,24 @@ function local_fonts_delete_font($font) { /** * Implements hook_fontyourface_preview(). */ -function local_fonts_fontyourface_preview($font) { - - return '' . $font->name . ''; - -} // local_fonts_fontyourface_preview - -/** - * Implements hook_fontyourface_view(). - */ -function local_fonts_fontyourface_view($font, $text) { - +function local_fonts_fontyourface_preview($font, $text = NULL, $size = 18) { $output = ''; - $sizes = array(32, 24, 18, 14, 12, 10); - - foreach ($sizes as $size) { - - $output .= '
' . $text . '
'; - - } // foreach - + if ($text == NULL) { + $text = $font->name; + } + if ($size == 'all') { + // Display variety of sizes. + $sizes = array(32, 24, 18, 14, 12, 10); + foreach ($sizes as $size) { + $output .= '
' . $text . '
'; + } + } + else { + // Display single size. + $output = '' . $text . ''; + } return $output; - -} // local_fonts_fontyourface_view +} /** * Implements template_preprocess_html(). -- 1.7.4.1