103 |
- |
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 |
}
|
|
|
31 |
else { $ttfdir = _MPDF_TTFONTPATH; }
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
$mqr=ini_get("magic_quotes_runtime");
|
|
|
36 |
if ($mqr) { set_magic_quotes_runtime(0); }
|
|
|
37 |
if (!class_exists('TTFontFile_Analysis', false)) { include(_MPDF_PATH .'classes/ttfontsuni_analysis.php'); }
|
|
|
38 |
$ttf = new TTFontFile_Analysis();
|
|
|
39 |
|
|
|
40 |
$ff = scandir($ttfdir);
|
|
|
41 |
|
|
|
42 |
echo '<h3>Font collection files found in '.$ttfdir.' directory</h3>';
|
|
|
43 |
foreach($ff AS $f) {
|
|
|
44 |
$ret = array();
|
|
|
45 |
if (strtolower(substr($f,-4,4))=='.ttc' || strtolower(substr($f,-4,4))=='.ttcf') { // Mac ttcf
|
|
|
46 |
$ttf->getTTCFonts($ttfdir.$f);
|
|
|
47 |
$nf = $ttf->numTTCFonts;
|
|
|
48 |
echo '<p>Font collection file ('.$f.') contains the following fonts:</p>';
|
|
|
49 |
for ($i=1; $i<=$nf; $i++) {
|
|
|
50 |
$ret = $ttf->extractCoreInfo($ttfdir.$f, $i);
|
|
|
51 |
$tfname = $ret[0];
|
|
|
52 |
$bold = $ret[1];
|
|
|
53 |
$italic = $ret[2];
|
|
|
54 |
$fname = strtolower($tfname );
|
|
|
55 |
$fname = preg_replace('/[ ()]/','',$fname );
|
|
|
56 |
$style = '';
|
|
|
57 |
if ($bold) { $style .= 'Bold'; }
|
|
|
58 |
if ($italic) { $style .= 'Italic'; }
|
|
|
59 |
if (!$style) { $style = 'Regular'; }
|
|
|
60 |
|
|
|
61 |
|
|
|
62 |
echo '<div>['.$i.'] '.$tfname.' ('.$fname.') '.$style.'</div>';
|
|
|
63 |
|
|
|
64 |
}
|
|
|
65 |
echo '<hr />';
|
|
|
66 |
}
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
|
|
|
70 |
exit;
|
|
|
71 |
|
|
|
72 |
?>
|