1 | <?php |
||
10 | class SizeCollection |
||
11 | { |
||
12 | /** |
||
13 | * Constant for default character size. |
||
14 | */ |
||
15 | const BASE_SIZE = 12; |
||
16 | |||
17 | /** |
||
18 | * Array containing character widths for each font & size. |
||
19 | * |
||
20 | * @var array |
||
21 | */ |
||
22 | private static $widths = array(); |
||
23 | |||
24 | /** |
||
25 | * Create character width map for each font. |
||
26 | */ |
||
27 | 18 | public function __construct() |
|
31 | |||
32 | /** |
||
33 | * Dirty way to allow developers to load character widths that |
||
34 | * are not yet included. |
||
35 | * |
||
36 | * @param string $csvPath |
||
37 | */ |
||
38 | 18 | public static function loadWidthsFromCsv($csvPath) |
|
49 | |||
50 | /** |
||
51 | * Return character widths for given font name. |
||
52 | * |
||
53 | * @param string $fontName |
||
54 | * @param int $fontSize |
||
55 | * @return array |
||
56 | */ |
||
57 | 8 | public function get($fontName, $fontSize) |
|
65 | |||
66 | /** |
||
67 | * Calculate character widths based on font name and size. |
||
68 | * |
||
69 | * @param string $fontName |
||
70 | * @param int $fontSize |
||
71 | * @return array |
||
72 | */ |
||
73 | 6 | private static function calculate($fontName, $fontSize) |
|
87 | } |
||
88 |