@@ 335-339 (lines=5) @@ | ||
332 | ||
333 | // Calculate column width in pixels. We assume fixed glyph width. Result varies with font name and size. |
|
334 | switch ($fontName) { |
|
335 | case 'Calibri': |
|
336 | // value 8.26 was found via interpolation by inspecting real Excel files with Calibri 11 font. |
|
337 | $columnWidth = (int) (8.26 * StringHelper::countCharacters($columnText)); |
|
338 | $columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size |
|
339 | break; |
|
340 | ||
341 | case 'Arial': |
|
342 | // value 8 was set because of experience in different exports at Arial 10 font. |
|
@@ 341-347 (lines=7) @@ | ||
338 | $columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size |
|
339 | break; |
|
340 | ||
341 | case 'Arial': |
|
342 | // value 8 was set because of experience in different exports at Arial 10 font. |
|
343 | $columnWidth = (int) (8 * StringHelper::countCharacters($columnText)); |
|
344 | $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size |
|
345 | break; |
|
346 | ||
347 | case 'Verdana': |
|
348 | // value 8 was found via interpolation by inspecting real Excel files with Verdana 10 font. |
|
349 | $columnWidth = (int) (8 * StringHelper::countCharacters($columnText)); |
|
350 | $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size |
|
@@ 347-351 (lines=5) @@ | ||
344 | $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size |
|
345 | break; |
|
346 | ||
347 | case 'Verdana': |
|
348 | // value 8 was found via interpolation by inspecting real Excel files with Verdana 10 font. |
|
349 | $columnWidth = (int) (8 * StringHelper::countCharacters($columnText)); |
|
350 | $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size |
|
351 | break; |
|
352 | ||
353 | default: |
|
354 | // just assume Calibri |
|
@@ 353-357 (lines=5) @@ | ||
350 | $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size |
|
351 | break; |
|
352 | ||
353 | default: |
|
354 | // just assume Calibri |
|
355 | $columnWidth = (int) (8.26 * StringHelper::countCharacters($columnText)); |
|
356 | $columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size |
|
357 | break; |
|
358 | } |
|
359 | ||
360 | // Calculate approximate rotated column width |