You are here

function _textimage_font_list in Textimage 7.2

Same name and namespace in other branches
  1. 5.2 textimage_admin.inc \_textimage_font_list()
  2. 5 textimage.module \_textimage_font_list()
  3. 6.2 textimage_admin.inc \_textimage_font_list()

Returns an array of files with .otf/.ttf extensions in a directory.

Parameters

string $fontdir: Full path of the font directory.

Return value

array Array of font files.

2 calls to _textimage_font_list()
textimage_preset_edit in ./textimage.admin.inc
Todo.
textimage_settings_form in ./textimage.admin.inc
Todo.

File

./textimage.admin.inc, line 726
Textimage admin page callback

Code

function _textimage_font_list($fontdir) {
  $filelist = array();
  if (is_dir($fontdir) && ($handle = opendir($fontdir))) {
    while ($file = readdir($handle)) {
      if (preg_match("/\\.[ot]tf\$/i", $file) == 1) {
        $font = _textimage_font_name($fontdir . '/' . $file);
        if (empty($font['name'])) {
          $filelist[$file] = $file;
        }
        else {
          $filelist[$file] = $font['name'];
        }
      }
    }
    closedir($handle);
  }
  asort($filelist);
  return $filelist;
}