1 | <?php |
||
22 | class Font |
||
23 | { |
||
24 | /** |
||
25 | * Calculate an (approximate) pixel size, based on a font points size |
||
26 | * |
||
27 | * @param int $fontSizeInPoints Font size (in points) |
||
28 | * @return int Font size (in pixels) |
||
29 | */ |
||
30 | 1 | public static function fontSizeToPixels($fontSizeInPoints = 12) |
|
34 | |||
35 | /** |
||
36 | * Calculate an (approximate) pixel size, based on inch size |
||
37 | * |
||
38 | * @param int $sizeInInch Font size (in inch) |
||
39 | * @return int Size (in pixels) |
||
40 | */ |
||
41 | 1 | public static function inchSizeToPixels($sizeInInch = 1) |
|
45 | |||
46 | /** |
||
47 | * Calculate an (approximate) pixel size, based on centimeter size |
||
48 | * |
||
49 | * @param int $sizeInCm Font size (in centimeters) |
||
50 | * @return int Size (in pixels) |
||
51 | */ |
||
52 | 1 | public static function centimeterSizeToPixels($sizeInCm = 1) |
|
56 | |||
57 | /** |
||
58 | * Convert centimeter to twip |
||
59 | * |
||
60 | * @param int $sizeInCm |
||
61 | * @return double |
||
62 | */ |
||
63 | 1 | public static function centimeterSizeToTwips($sizeInCm = 1) |
|
67 | |||
68 | /** |
||
69 | * Convert inch to twip |
||
70 | * |
||
71 | * @param int $sizeInInch |
||
72 | * @return double |
||
73 | */ |
||
74 | 1 | public static function inchSizeToTwips($sizeInInch = 1) |
|
78 | |||
79 | /** |
||
80 | * Convert pixel to twip |
||
81 | * |
||
82 | * @param int $sizeInPixel |
||
83 | * @return double |
||
84 | */ |
||
85 | 1 | public static function pixelSizeToTwips($sizeInPixel = 1) |
|
89 | |||
90 | /** |
||
91 | * Calculate twip based on point size, used mainly for paragraph spacing |
||
92 | * |
||
93 | * @param integer $sizeInPoint Size in point |
||
94 | * @return integer Size (in twips) |
||
95 | */ |
||
96 | 1 | public static function pointSizeToTwips($sizeInPoint = 1) |
|
100 | } |
||
101 |