mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-23 12:33:31 +00:00
590e4c7af1
* Allow More Fonts/Fontnames for Exact Width Calculation Fix #3190. A limited set of explicitly-named font files can be used when an exact width calculation is required. User noted that font files are named differently on Mac than on Windows (if the fonts are installed on Linux, the font names probably match Windows). Since the algorithm for generating the Mac file name from the font name seems easy, that algorithm is invoked when the Windows-named file is not found. Moving on from there, it seems odd that only a small set of fonts are supported. It is, of course, impossible to support all possible fonts out of the box. However, it is possible to allow the user to supply additional mappings from font name to file name (or override existing mappings if neither the Windows nor Mac name matches the user's system), and doing so is permitted with this change: ```php \PhpOffice\PhpSpreadsheet\Shared\Font::setExtraFontArray([ 'fontname' => [ /* More than 1 can be specified */ 'x' => 'fontfilenamefornormal.ttf', 'xb' => 'fontfilenameforbold.ttf', 'xi' => 'fontfilenameforitalic.ttf', 'xbi' => 'fontfilenameforbolditalic.ttf', ], ]); ``` * Unexpected Test Difference ... between Windows and Linux.