| 1 |
<?php |
| 2 |
|
| 3 |
/* This script prints out details of any TrueType collection font files |
| 4 |
in your font directory. Files ending wih .otc are examined. |
| 5 |
Point your browser to |
| 6 |
http://your.domain/your_path_to _mpdf/utils/font_collections.php |
| 7 |
By default this will examine the folder /ttfonts/ (or the default font |
| 8 |
directory defined by _MPDF_TTFONTPATH. |
| 9 |
You can optionally define an alternative folder to examine by setting |
| 10 |
the variable below (must be a relative path, or filesystem path): |
| 11 |
*/ |
| 12 |
|
| 13 |
|
| 14 |
$checkdir = ''; |
| 15 |
|
| 16 |
|
| 17 |
////////////////////////////////// |
| 18 |
////////////////////////////////// |
| 19 |
////////////////////////////////// |
| 20 |
|
| 21 |
ini_set("memory_limit","256M"); |
| 22 |
|
| 23 |
|
| 24 |
define('_MPDF_PATH','../'); |
| 25 |
|
| 26 |
include("../mpdf.php"); |
| 27 |
$mpdf=new mPDF(''); |
| 28 |
if ($checkdir) { |
| 29 |
$ttfdir = $checkdir; |
| 30 |
} else { |
| 31 |
$ttfdir = _MPDF_TTFONTPATH; |
| 32 |
} |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
$mqr=ini_get("magic_quotes_runtime"); |
| 37 |
if ($mqr) { set_magic_quotes_runtime(0); } |
| 38 |
if (!class_exists('TTFontFile_Analysis', false)) { include(_MPDF_PATH .'classes/ttfontsuni_analysis.php'); } |
| 39 |
$ttf = new TTFontFile_Analysis(); |
| 40 |
|
| 41 |
$ff = scandir($ttfdir); |
| 42 |
|
| 43 |
echo '<h3>Font collection files found in '.$ttfdir.' directory</h3>'; |
| 44 |
foreach($ff AS $f) { |
| 45 |
$ret = array(); |
| 46 |
if (strtolower(substr($f,-4,4))=='.ttc' || strtolower(substr($f,-4,4))=='.ttcf') { // Mac ttcf |
| 47 |
$ttf->getTTCFonts($ttfdir.$f); |
| 48 |
$nf = $ttf->numTTCFonts; |
| 49 |
echo '<p>Font collection file ('.$f.') contains the following fonts:</p>'; |
| 50 |
for ($i=1; $i<=$nf; $i++) { |
| 51 |
$ret = $ttf->extractCoreInfo($ttfdir.$f, $i); |
| 52 |
$tfname = $ret[0]; |
| 53 |
$bold = $ret[1]; |
| 54 |
$italic = $ret[2]; |
| 55 |
$fname = strtolower($tfname ); |
| 56 |
$fname = preg_replace('/[ ()]/','',$fname ); |
| 57 |
$style = ''; |
| 58 |
if ($bold) { $style .= 'Bold'; } |
| 59 |
if ($italic) { $style .= 'Italic'; } |
| 60 |
if (!$style) { $style = 'Regular'; } |
| 61 |
|
| 62 |
|
| 63 |
echo '<div>['.$i.'] '.$tfname.' ('.$fname.') '.$style.'</div>'; |
| 64 |
|
| 65 |
} |
| 66 |
echo '<hr />'; |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
exit; |
| 72 |
|