Example #1
0
 /**
  * Compile font options from different sources.
  *
  * @since  1.0.0.
  *
  * @return array    All available fonts.
  */
 function ttfmake_get_all_fonts()
 {
     $heading1 = array(1 => array('label' => sprintf('--- %s ---', __('Standard Fonts', 'make'))));
     $standard_fonts = ttfmake_get_standard_fonts();
     $heading2 = array(2 => array('label' => sprintf('--- %s ---', __('Google Fonts', 'make'))));
     $google_fonts = ttfmake_get_google_fonts();
     /**
      * Allow for developers to modify the full list of fonts.
      *
      * @since 1.2.3.
      *
      * @param array    $fonts    The list of all fonts.
      */
     return apply_filters('make_all_fonts', array_merge($heading1, $standard_fonts, $heading2, $google_fonts));
 }
Example #2
0
 function layers_get_google_font_variants($font, $variants = array())
 {
     $chosen_variants = array();
     if (empty($variants)) {
         $layers_custom_fonts = ttfmake_get_google_fonts();
         if (array_key_exists($font, $layers_custom_fonts)) {
             $variants = $layers_custom_fonts[$font]['variants'];
         }
     }
     // If a "regular" variant is not found, get the first variant
     if (!in_array('regular', $variants)) {
         $chosen_variants[] = $variants[0];
     } else {
         $chosen_variants[] = 'regular';
     }
     // Only add "italic" if it exists
     if (in_array('italic', $variants)) {
         $chosen_variants[] = 'italic';
     }
     // Only add "700" if it exists
     if (in_array('700', $variants)) {
         $chosen_variants[] = '700';
     }
     return apply_filters('layers_font_variants', array_unique($chosen_variants), $font, $variants);
 }