1 | <?php |
||
10 | class WidthCollection |
||
11 | { |
||
12 | /** |
||
13 | * Array containing character widths for each font & size. |
||
14 | * |
||
15 | * @var array |
||
16 | */ |
||
17 | private static $widths = array(); |
||
18 | |||
19 | /** |
||
20 | * Create character width map for each font. |
||
21 | */ |
||
22 | 18 | public function __construct() |
|
26 | |||
27 | /** |
||
28 | * Dirty way to allow developers to load character widths that |
||
29 | * are not yet included. |
||
30 | * |
||
31 | * @param string $csvPath |
||
32 | */ |
||
33 | 18 | public static function loadWidthsFromCsv($csvPath) |
|
44 | |||
45 | /** |
||
46 | * Return character widths for given font name. |
||
47 | * |
||
48 | * @param string $fontName |
||
49 | * @param int $fontSize |
||
50 | * @return array |
||
51 | */ |
||
52 | 8 | public function get($fontName, $fontSize) |
|
60 | |||
61 | /** |
||
62 | * Calculate character widths based on font name and size. |
||
63 | * |
||
64 | * @param string $fontName |
||
65 | * @param int $fontSize |
||
66 | * @return array |
||
67 | */ |
||
68 | 5 | private static function calculate($fontName, $fontSize) |
|
82 | } |
||
83 |