You are here

public function TextimageFontsHandlerFontyourface::getUri in Textimage 7.3

Return the URI of a font file, given its name.

Parameters

string $font_name: the name of the font.

array $options: an array of additional options.

Return value

string the URI of the font file.

Overrides TextimageFontsHandlerInterface::getUri

File

classes/font_handlers/fontyourface.inc, line 46
Textimage - Fonts handler class for @font-your-face.

Class

TextimageFontsHandlerFontyourface
Fonts handler for @font-your-face.

Code

public function getUri($font_name, $options) {
  $font = fontyourface_get_fonts("enabled = 1 and provider = 'local_fonts' and name = '{$font_name}'");
  if (!empty($font)) {
    $font = array_shift($font);
    $metadata = unserialize($font->metadata);
    if (isset($metadata['font_uri']['truetype'])) {
      return $metadata['font_uri']['truetype'];
    }
  }
  return NULL;
}