You are here

public function TextimageFontsHandlerTextimage::getList in Textimage 7.3

Return an array of fonts.

Scans through files available in the directory specified through configuration.

Parameters

array $options: an array of additional options.

Return value

array Array of font names.

Overrides TextimageFontsHandlerInterface::getList

File

classes/font_handlers/textimage.inc, line 27
Textimage - Fonts handler class for Textimage.

Class

TextimageFontsHandlerTextimage
Fonts handler for Textimage.

Code

public function getList($options) {
  $fonts_path = isset($options['fonts_path']) ? $options['fonts_path'] : _textimage_get_variable('fonts_path');
  $filelist = array();
  if (is_dir($fonts_path) && ($handle = opendir($fonts_path))) {
    while ($file_name = readdir($handle)) {
      if (preg_match("/\\.[ot]tf\$/i", $file_name) == 1) {
        $font = self::getData($fonts_path . '/' . $file_name);
        if (empty($font['name'])) {
          $filelist[$file_name] = $file_name;
        }
        else {
          $filelist[$file_name] = $font['name'];
        }
      }
    }
    closedir($handle);
  }
  asort($filelist);
  return $filelist;
}