You are here

function _google_fonts_get_font_info in Google Fonts 7.2

Same name and namespace in other branches
  1. 6.2 google_fonts.module \_google_fonts_get_font_info()
  2. 7 google_fonts.module \_google_fonts_get_font_info()

Return the path of this font If it is a child font of a larger family, scan the array to determine its path

File

./google_fonts.module, line 167
This module enables Google Fonts on your website.

Code

function _google_fonts_get_font_info($font, $full_font = '') {
  $available_fonts = _google_fonts_available_fonts();
  if (empty($full_font)) {
    $full_font = $font;
  }
  if (isset($available_fonts[$font]['fonts'])) {
    if (isset($available_fonts[$font]['fonts'][$full_font])) {
      return $available_fonts[$font]['fonts'][$full_font];
    }
    else {
      return $available_fonts[$font];
    }
  }
  else {

    // Try the string without the last word to determine the parent
    $font = substr($font, 0, strrpos($font, " "));
    return _google_fonts_get_font_info($font, $full_font);
  }
}