Beispiel #1
0
 /**
  * Compile the font choices for better handling as a JSON object
  *
  * @since 1.3.0.
  *
  * @return array
  */
 function ttfmake_all_font_choices_js()
 {
     $fonts = ttfmake_get_all_fonts();
     $choices = array();
     // Repackage the fonts into value/label pairs
     foreach ($fonts as $key => $font) {
         $choices[] = array('k' => $key, 'l' => $font['label']);
     }
     return $choices;
 }
Beispiel #2
0
 /**
  * Validate the font choice and get a font stack for it.
  *
  * @since  1.0.0.
  *
  * @param  string    $font    The 1st font in the stack.
  * @return string             The full font stack.
  */
 function ttfmake_get_font_stack($font)
 {
     $all_fonts = ttfmake_get_all_fonts();
     // Sanitize font choice
     $font = ttfmake_sanitize_font_choice($font);
     // Standard font
     if (isset($all_fonts[$font]['stack']) && !empty($all_fonts[$font]['stack'])) {
         $stack = $all_fonts[$font]['stack'];
     } elseif (in_array($font, ttfmake_all_font_choices())) {
         $stack = '"' . $font . '","Helvetica Neue",Helvetica,Arial,sans-serif';
     } else {
         $stack = '"Helvetica Neue",Helvetica,Arial,sans-serif';
     }
     /**
      * Allow developers to filter the full font stack.
      *
      * @since 1.2.3.
      *
      * @param string    $stack    The font stack.
      * @param string    $font     The font.
      */
     return apply_filters('make_font_stack', $stack, $font);
 }