File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 2121 "php" : " >=8.1.0" ,
2222 "ext-ffi" : " *"
2323 },
24+ "suggest" : {
25+ "ext-imagick" : " For get font real height and width"
26+ },
2427 "autoload" : {
2528 "psr-4" : {
2629 "UI\\ " : " src/"
Original file line number Diff line number Diff line change @@ -84,9 +84,21 @@ public function queryFontMetrics()
8484 $ imgClass = '\Gmagick ' ;
8585 $ imgDrawClass = '\GmagickDraw ' ;
8686 $ gmagick = true ;
87- } else {
87+ } elseif ( class_exists ( ' \Imagick ' )) {
8888 $ imgClass = '\Imagick ' ;
8989 $ imgDrawClass = '\ImagickDraw ' ;
90+ } else {
91+ $ mt = [
92+ 'characterWidth ' => $ size ,
93+ 'characterHeight ' => $ size ,
94+ 'ascender ' => $ size ,
95+ 'descender ' => -4 ,
96+ 'textWidth ' => 87 ,
97+ 'textHeight ' => $ size + 4 ,
98+ 'maxHorizontalAdvance ' => ceil (($ size + 4 ) / 2 ),
99+ ];
100+ $ mcache [$ cacheKey ] = $ mt ;
101+ return $ mt ;
90102 }
91103
92104 $ im = new $ imgClass ();
You can’t perform that action at this time.
0 commit comments