ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Font.php
Go to the documentation of this file.
1<?php
37{
38 /* Methods for resolving autosize value */
39 const AUTOSIZE_METHOD_APPROX = 'approx';
40 const AUTOSIZE_METHOD_EXACT = 'exact';
41
42 private static $_autoSizeMethods = array(
43 self::AUTOSIZE_METHOD_APPROX,
44 self::AUTOSIZE_METHOD_EXACT,
45 );
46
48 const CHARSET_ANSI_LATIN = 0x00;
50 const CHARSET_SYMBOL = 0x02;
51 const CHARSET_APPLE_ROMAN = 0x4D;
55 const CHARSET_ANSI_CHINESE_SIMIPLIFIED = 0x86; // gb2312
57 const CHARSET_ANSI_GREEK = 0xA1;
60 const CHARSET_ANSI_HEBREW = 0xB1;
61 const CHARSET_ANSI_ARABIC = 0xB2;
62 const CHARSET_ANSI_BALTIC = 0xBA;
64 const CHARSET_ANSI_THAI = 0xDD;
66 const CHARSET_OEM_LATIN_I = 0xFF;
67
68 // XXX: Constants created!
70 const ARIAL = 'arial.ttf';
71 const ARIAL_BOLD = 'arialbd.ttf';
72 const ARIAL_ITALIC = 'ariali.ttf';
73 const ARIAL_BOLD_ITALIC = 'arialbi.ttf';
74
75 const CALIBRI = 'CALIBRI.TTF';
76 const CALIBRI_BOLD = 'CALIBRIB.TTF';
77 const CALIBRI_ITALIC = 'CALIBRII.TTF';
78 const CALIBRI_BOLD_ITALIC = 'CALIBRIZ.TTF';
79
80 const COMIC_SANS_MS = 'comic.ttf';
81 const COMIC_SANS_MS_BOLD = 'comicbd.ttf';
82
83 const COURIER_NEW = 'cour.ttf';
84 const COURIER_NEW_BOLD = 'courbd.ttf';
85 const COURIER_NEW_ITALIC = 'couri.ttf';
86 const COURIER_NEW_BOLD_ITALIC = 'courbi.ttf';
87
88 const GEORGIA = 'georgia.ttf';
89 const GEORGIA_BOLD = 'georgiab.ttf';
90 const GEORGIA_ITALIC = 'georgiai.ttf';
91 const GEORGIA_BOLD_ITALIC = 'georgiaz.ttf';
92
93 const IMPACT = 'impact.ttf';
94
95 const LIBERATION_SANS = 'LiberationSans-Regular.ttf';
96 const LIBERATION_SANS_BOLD = 'LiberationSans-Bold.ttf';
97 const LIBERATION_SANS_ITALIC = 'LiberationSans-Italic.ttf';
98 const LIBERATION_SANS_BOLD_ITALIC = 'LiberationSans-BoldItalic.ttf';
99
100 const LUCIDA_CONSOLE = 'lucon.ttf';
101 const LUCIDA_SANS_UNICODE = 'l_10646.ttf';
102
103 const MICROSOFT_SANS_SERIF = 'micross.ttf';
104
105 const PALATINO_LINOTYPE = 'pala.ttf';
106 const PALATINO_LINOTYPE_BOLD = 'palab.ttf';
107 const PALATINO_LINOTYPE_ITALIC = 'palai.ttf';
108 const PALATINO_LINOTYPE_BOLD_ITALIC = 'palabi.ttf';
109
110 const SYMBOL = 'symbol.ttf';
111
112 const TAHOMA = 'tahoma.ttf';
113 const TAHOMA_BOLD = 'tahomabd.ttf';
114
115 const TIMES_NEW_ROMAN = 'times.ttf';
116 const TIMES_NEW_ROMAN_BOLD = 'timesbd.ttf';
117 const TIMES_NEW_ROMAN_ITALIC = 'timesi.ttf';
118 const TIMES_NEW_ROMAN_BOLD_ITALIC = 'timesbi.ttf';
119
120 const TREBUCHET_MS = 'trebuc.ttf';
121 const TREBUCHET_MS_BOLD = 'trebucbd.ttf';
122 const TREBUCHET_MS_ITALIC = 'trebucit.ttf';
123 const TREBUCHET_MS_BOLD_ITALIC = 'trebucbi.ttf';
124
125 const VERDANA = 'verdana.ttf';
126 const VERDANA_BOLD = 'verdanab.ttf';
127 const VERDANA_ITALIC = 'verdanai.ttf';
128 const VERDANA_BOLD_ITALIC = 'verdanaz.ttf';
129
136
142 private static $trueTypeFontPath = null;
143
151 public static $defaultColumnWidths = array(
152 'Arial' => array(
153 1 => array('px' => 24, 'width' => 12.00000000),
154 2 => array('px' => 24, 'width' => 12.00000000),
155 3 => array('px' => 32, 'width' => 10.66406250),
156 4 => array('px' => 32, 'width' => 10.66406250),
157 5 => array('px' => 40, 'width' => 10.00000000),
158 6 => array('px' => 48, 'width' => 9.59765625),
159 7 => array('px' => 48, 'width' => 9.59765625),
160 8 => array('px' => 56, 'width' => 9.33203125),
161 9 => array('px' => 64, 'width' => 9.14062500),
162 10 => array('px' => 64, 'width' => 9.14062500),
163 ),
164 'Calibri' => array(
165 1 => array('px' => 24, 'width' => 12.00000000),
166 2 => array('px' => 24, 'width' => 12.00000000),
167 3 => array('px' => 32, 'width' => 10.66406250),
168 4 => array('px' => 32, 'width' => 10.66406250),
169 5 => array('px' => 40, 'width' => 10.00000000),
170 6 => array('px' => 48, 'width' => 9.59765625),
171 7 => array('px' => 48, 'width' => 9.59765625),
172 8 => array('px' => 56, 'width' => 9.33203125),
173 9 => array('px' => 56, 'width' => 9.33203125),
174 10 => array('px' => 64, 'width' => 9.14062500),
175 11 => array('px' => 64, 'width' => 9.14062500),
176 ),
177 'Verdana' => array(
178 1 => array('px' => 24, 'width' => 12.00000000),
179 2 => array('px' => 24, 'width' => 12.00000000),
180 3 => array('px' => 32, 'width' => 10.66406250),
181 4 => array('px' => 32, 'width' => 10.66406250),
182 5 => array('px' => 40, 'width' => 10.00000000),
183 6 => array('px' => 48, 'width' => 9.59765625),
184 7 => array('px' => 48, 'width' => 9.59765625),
185 8 => array('px' => 64, 'width' => 9.14062500),
186 9 => array('px' => 72, 'width' => 9.00000000),
187 10 => array('px' => 72, 'width' => 9.00000000),
188 ),
189 );
190
197 public static function setAutoSizeMethod($pValue = self::AUTOSIZE_METHOD_APPROX)
198 {
199 if (!in_array($pValue,self::$_autoSizeMethods)) {
200 return FALSE;
201 }
202 self::$autoSizeMethod = $pValue;
203
204 return TRUE;
205 }
206
212 public static function getAutoSizeMethod()
213 {
215 }
216
228 public static function setTrueTypeFontPath($pValue = '')
229 {
230 self::$trueTypeFontPath = $pValue;
231 }
232
238 public static function getTrueTypeFontPath()
239 {
241 }
242
252 public static function calculateColumnWidth(PHPExcel_Style_Font $font, $cellText = '', $rotation = 0, PHPExcel_Style_Font $defaultFont = null) {
253 // If it is rich text, use plain text
254 if ($cellText instanceof PHPExcel_RichText) {
255 $cellText = $cellText->getPlainText();
256 }
257
258 // Special case if there are one or more newline characters ("\n")
259 if (strpos($cellText, "\n") !== false) {
260 $lineTexts = explode("\n", $cellText);
261 $lineWidths = array();
262 foreach ($lineTexts as $lineText) {
263 $lineWidths[] = self::calculateColumnWidth($font, $lineText, $rotation = 0, $defaultFont);
264 }
265 return max($lineWidths); // width of longest line in cell
266 }
267
268 // Try to get the exact text width in pixels
269 $approximate = self::$autoSizeMethod == self::AUTOSIZE_METHOD_APPROX;
270 if (!$approximate) {
271 $columnWidthAdjust = ceil(self::getTextWidthPixelsExact('n', $font, 0) * 1.07);
272 try {
273 // Width of text in pixels excl. padding
274 // and addition because Excel adds some padding, just use approx width of 'n' glyph
275 $columnWidth = self::getTextWidthPixelsExact($cellText, $font, $rotation) + $columnWidthAdjust;
276 } catch (PHPExcel_Exception $e) {
277 $approximate = true;
278 }
279 }
280
281 if ($approximate) {
282 $columnWidthAdjust = self::getTextWidthPixelsApprox('n', $font, 0);
283 // Width of text in pixels excl. padding, approximation
284 // and addition because Excel adds some padding, just use approx width of 'n' glyph
285 $columnWidth = self::getTextWidthPixelsApprox($cellText, $font, $rotation) + $columnWidthAdjust;
286 }
287
288 // Convert from pixel width to column width
289 $columnWidth = PHPExcel_Shared_Drawing::pixelsToCellDimension($columnWidth, $defaultFont);
290
291 // Return
292 return round($columnWidth, 6);
293 }
294
304 public static function getTextWidthPixelsExact($text, PHPExcel_Style_Font $font, $rotation = 0) {
305 if (!function_exists('imagettfbbox')) {
306 throw new PHPExcel_Exception('GD library needs to be enabled');
307 }
308
309 // font size should really be supplied in pixels in GD2,
310 // but since GD2 seems to assume 72dpi, pixels and points are the same
311 $fontFile = self::getTrueTypeFontFileFromFont($font);
312 $textBox = imagettfbbox($font->getSize(), $rotation, $fontFile, $text);
313
314 // Get corners positions
315 $lowerLeftCornerX = $textBox[0];
316// $lowerLeftCornerY = $textBox[1];
317 $lowerRightCornerX = $textBox[2];
318// $lowerRightCornerY = $textBox[3];
319 $upperRightCornerX = $textBox[4];
320// $upperRightCornerY = $textBox[5];
321 $upperLeftCornerX = $textBox[6];
322// $upperLeftCornerY = $textBox[7];
323
324 // Consider the rotation when calculating the width
325 $textWidth = max($lowerRightCornerX - $upperLeftCornerX, $upperRightCornerX - $lowerLeftCornerX);
326
327 return $textWidth;
328 }
329
338 public static function getTextWidthPixelsApprox($columnText, PHPExcel_Style_Font $font = null, $rotation = 0)
339 {
340 $fontName = $font->getName();
341 $fontSize = $font->getSize();
342
343 // Calculate column width in pixels. We assume fixed glyph width. Result varies with font name and size.
344 switch ($fontName) {
345 case 'Calibri':
346 // value 8.26 was found via interpolation by inspecting real Excel files with Calibri 11 font.
347 $columnWidth = (int) (8.26 * PHPExcel_Shared_String::CountCharacters($columnText));
348 $columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size
349 break;
350
351 case 'Arial':
352 // value 7 was found via interpolation by inspecting real Excel files with Arial 10 font.
353// $columnWidth = (int) (7 * PHPExcel_Shared_String::CountCharacters($columnText));
354 // value 8 was set because of experience in different exports at Arial 10 font.
355 $columnWidth = (int) (8 * PHPExcel_Shared_String::CountCharacters($columnText));
356 $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size
357 break;
358
359 case 'Verdana':
360 // value 8 was found via interpolation by inspecting real Excel files with Verdana 10 font.
361 $columnWidth = (int) (8 * PHPExcel_Shared_String::CountCharacters($columnText));
362 $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size
363 break;
364
365 default:
366 // just assume Calibri
367 $columnWidth = (int) (8.26 * PHPExcel_Shared_String::CountCharacters($columnText));
368 $columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size
369 break;
370 }
371
372 // Calculate approximate rotated column width
373 if ($rotation !== 0) {
374 if ($rotation == -165) {
375 // stacked text
376 $columnWidth = 4; // approximation
377 } else {
378 // rotated text
379 $columnWidth = $columnWidth * cos(deg2rad($rotation))
380 + $fontSize * abs(sin(deg2rad($rotation))) / 5; // approximation
381 }
382 }
383
384 // pixel width is an integer
385 return (int) $columnWidth;
386 }
387
394 public static function fontSizeToPixels($fontSizeInPoints = 11) {
395 return (int) ((4 / 3) * $fontSizeInPoints);
396 }
397
404 public static function inchSizeToPixels($sizeInInch = 1) {
405 return ($sizeInInch * 96);
406 }
407
414 public static function centimeterSizeToPixels($sizeInCm = 1) {
415 return ($sizeInCm * 37.795275591);
416 }
417
424 public static function getTrueTypeFontFileFromFont($font) {
425 if (!file_exists(self::$trueTypeFontPath) || !is_dir(self::$trueTypeFontPath)) {
426 throw new PHPExcel_Exception('Valid directory to TrueType Font files not specified');
427 }
428
429 $name = $font->getName();
430 $bold = $font->getBold();
431 $italic = $font->getItalic();
432
433 // Check if we can map font to true type font file
434 switch ($name) {
435 case 'Arial':
436 $fontFile = (
437 $bold ? ($italic ? self::ARIAL_BOLD_ITALIC : self::ARIAL_BOLD)
438 : ($italic ? self::ARIAL_ITALIC : self::ARIAL)
439 );
440 break;
441
442 case 'Calibri':
443 $fontFile = (
445 : ($italic ? self::CALIBRI_ITALIC : self::CALIBRI)
446 );
447 break;
448
449 case 'Courier New':
450 $fontFile = (
452 : ($italic ? self::COURIER_NEW_ITALIC : self::COURIER_NEW)
453 );
454 break;
455
456 case 'Comic Sans MS':
457 $fontFile = (
459 );
460 break;
461
462 case 'Georgia':
463 $fontFile = (
465 : ($italic ? self::GEORGIA_ITALIC : self::GEORGIA)
466 );
467 break;
468
469 case 'Impact':
470 $fontFile = self::IMPACT;
471 break;
472
473 case 'Liberation Sans':
474 $fontFile = (
476 : ($italic ? self::LIBERATION_SANS_ITALIC : self::LIBERATION_SANS)
477 );
478 break;
479
480 case 'Lucida Console':
481 $fontFile = self::LUCIDA_CONSOLE;
482 break;
483
484 case 'Lucida Sans Unicode':
485 $fontFile = self::LUCIDA_SANS_UNICODE;
486 break;
487
488 case 'Microsoft Sans Serif':
489 $fontFile = self::MICROSOFT_SANS_SERIF;
490 break;
491
492 case 'Palatino Linotype':
493 $fontFile = (
495 : ($italic ? self::PALATINO_LINOTYPE_ITALIC : self::PALATINO_LINOTYPE)
496 );
497 break;
498
499 case 'Symbol':
500 $fontFile = self::SYMBOL;
501 break;
502
503 case 'Tahoma':
504 $fontFile = (
506 );
507 break;
508
509 case 'Times New Roman':
510 $fontFile = (
512 : ($italic ? self::TIMES_NEW_ROMAN_ITALIC : self::TIMES_NEW_ROMAN)
513 );
514 break;
515
516 case 'Trebuchet MS':
517 $fontFile = (
519 : ($italic ? self::TREBUCHET_MS_ITALIC : self::TREBUCHET_MS)
520 );
521 break;
522
523 case 'Verdana':
524 $fontFile = (
526 : ($italic ? self::VERDANA_ITALIC : self::VERDANA)
527 );
528 break;
529
530 default:
531 throw new PHPExcel_Exception('Unknown font name "'. $name .'". Cannot map to TrueType font file');
532 break;
533 }
534
535 $fontFile = self::$trueTypeFontPath . $fontFile;
536
537 // Check if file actually exists
538 if (!file_exists($fontFile)) {
539 throw New PHPExcel_Exception('TrueType Font file not found');
540 }
541
542 return $fontFile;
543 }
544
551 public static function getCharsetFromFontName($name)
552 {
553 switch ($name) {
554 // Add more cases. Check FONT records in real Excel files.
555 case 'EucrosiaUPC': return self::CHARSET_ANSI_THAI;
556 case 'Wingdings': return self::CHARSET_SYMBOL;
557 case 'Wingdings 2': return self::CHARSET_SYMBOL;
558 case 'Wingdings 3': return self::CHARSET_SYMBOL;
559 default: return self::CHARSET_ANSI_LATIN;
560 }
561 }
562
571 public static function getDefaultColumnWidthByFont(PHPExcel_Style_Font $font, $pPixels = false)
572 {
573 if (isset(self::$defaultColumnWidths[$font->getName()][$font->getSize()])) {
574 // Exact width can be determined
575 $columnWidth = $pPixels ?
576 self::$defaultColumnWidths[$font->getName()][$font->getSize()]['px']
577 : self::$defaultColumnWidths[$font->getName()][$font->getSize()]['width'];
578
579 } else {
580 // We don't have data for this particular font and size, use approximation by
581 // extrapolating from Calibri 11
582 $columnWidth = $pPixels ?
583 self::$defaultColumnWidths['Calibri'][11]['px']
584 : self::$defaultColumnWidths['Calibri'][11]['width'];
585 $columnWidth = $columnWidth * $font->getSize() / 11;
586
587 // Round pixels to closest integer
588 if ($pPixels) {
589 $columnWidth = (int) round($columnWidth);
590 }
591 }
592
593 return $columnWidth;
594 }
595
603 public static function getDefaultRowHeightByFont(PHPExcel_Style_Font $font)
604 {
605 switch ($font->getName()) {
606 case 'Arial':
607 switch ($font->getSize()) {
608 case 10:
609 // inspection of Arial 10 workbook says 12.75pt ~17px
610 $rowHeight = 12.75;
611 break;
612
613 case 9:
614 // inspection of Arial 9 workbook says 12.00pt ~16px
615 $rowHeight = 12;
616 break;
617
618 case 8:
619 // inspection of Arial 8 workbook says 11.25pt ~15px
620 $rowHeight = 11.25;
621 break;
622
623 case 7:
624 // inspection of Arial 7 workbook says 9.00pt ~12px
625 $rowHeight = 9;
626 break;
627
628 case 6:
629 case 5:
630 // inspection of Arial 5,6 workbook says 8.25pt ~11px
631 $rowHeight = 8.25;
632 break;
633
634 case 4:
635 // inspection of Arial 4 workbook says 6.75pt ~9px
636 $rowHeight = 6.75;
637 break;
638
639 case 3:
640 // inspection of Arial 3 workbook says 6.00pt ~8px
641 $rowHeight = 6;
642 break;
643
644 case 2:
645 case 1:
646 // inspection of Arial 1,2 workbook says 5.25pt ~7px
647 $rowHeight = 5.25;
648 break;
649
650 default:
651 // use Arial 10 workbook as an approximation, extrapolation
652 $rowHeight = 12.75 * $font->getSize() / 10;
653 break;
654 }
655 break;
656
657 case 'Calibri':
658 switch ($font->getSize()) {
659 case 11:
660 // inspection of Calibri 11 workbook says 15.00pt ~20px
661 $rowHeight = 15;
662 break;
663
664 case 10:
665 // inspection of Calibri 10 workbook says 12.75pt ~17px
666 $rowHeight = 12.75;
667 break;
668
669 case 9:
670 // inspection of Calibri 9 workbook says 12.00pt ~16px
671 $rowHeight = 12;
672 break;
673
674 case 8:
675 // inspection of Calibri 8 workbook says 11.25pt ~15px
676 $rowHeight = 11.25;
677 break;
678
679 case 7:
680 // inspection of Calibri 7 workbook says 9.00pt ~12px
681 $rowHeight = 9;
682 break;
683
684 case 6:
685 case 5:
686 // inspection of Calibri 5,6 workbook says 8.25pt ~11px
687 $rowHeight = 8.25;
688 break;
689
690 case 4:
691 // inspection of Calibri 4 workbook says 6.75pt ~9px
692 $rowHeight = 6.75;
693 break;
694
695 case 3:
696 // inspection of Calibri 3 workbook says 6.00pt ~8px
697 $rowHeight = 6.00;
698 break;
699
700 case 2:
701 case 1:
702 // inspection of Calibri 1,2 workbook says 5.25pt ~7px
703 $rowHeight = 5.25;
704 break;
705
706 default:
707 // use Calibri 11 workbook as an approximation, extrapolation
708 $rowHeight = 15 * $font->getSize() / 11;
709 break;
710 }
711 break;
712
713 case 'Verdana':
714 switch ($font->getSize()) {
715 case 10:
716 // inspection of Verdana 10 workbook says 12.75pt ~17px
717 $rowHeight = 12.75;
718 break;
719
720 case 9:
721 // inspection of Verdana 9 workbook says 11.25pt ~15px
722 $rowHeight = 11.25;
723 break;
724
725 case 8:
726 // inspection of Verdana 8 workbook says 10.50pt ~14px
727 $rowHeight = 10.50;
728 break;
729
730 case 7:
731 // inspection of Verdana 7 workbook says 9.00pt ~12px
732 $rowHeight = 9.00;
733 break;
734
735 case 6:
736 case 5:
737 // inspection of Verdana 5,6 workbook says 8.25pt ~11px
738 $rowHeight = 8.25;
739 break;
740
741 case 4:
742 // inspection of Verdana 4 workbook says 6.75pt ~9px
743 $rowHeight = 6.75;
744 break;
745
746 case 3:
747 // inspection of Verdana 3 workbook says 6.00pt ~8px
748 $rowHeight = 6;
749 break;
750
751 case 2:
752 case 1:
753 // inspection of Verdana 1,2 workbook says 5.25pt ~7px
754 $rowHeight = 5.25;
755 break;
756
757 default:
758 // use Verdana 10 workbook as an approximation, extrapolation
759 $rowHeight = 12.75 * $font->getSize() / 10;
760 break;
761 }
762 break;
763
764 default:
765 // just use Calibri as an approximation
766 $rowHeight = 15 * $font->getSize() / 11;
767 break;
768 }
769
770 return $rowHeight;
771 }
772
773}
An exception for terminatinating execution or to throw for unit testing.
static pixelsToCellDimension($pValue=0, PHPExcel_Style_Font $pDefaultFont)
Convert pixels to column width.
Definition: Drawing.php:71
static setTrueTypeFontPath($pValue='')
Set the path to the folder containing .ttf files.
Definition: Font.php:228
const CHARSET_SYMBOL
Definition: Font.php:50
const COMIC_SANS_MS
Definition: Font.php:80
const CHARSET_ANSI_KOREAN_HANGUL
Definition: Font.php:53
static $autoSizeMethod
Definition: Font.php:135
static fontSizeToPixels($fontSizeInPoints=11)
Calculate an (approximate) pixel size, based on a font points size.
Definition: Font.php:394
const GEORGIA_BOLD_ITALIC
Definition: Font.php:91
const ARIAL_BOLD_ITALIC
Definition: Font.php:73
const CHARSET_ANSI_ARABIC
Definition: Font.php:61
static getAutoSizeMethod()
Get autoSize method.
Definition: Font.php:212
static $_autoSizeMethods
Definition: Font.php:42
static getTextWidthPixelsExact($text, PHPExcel_Style_Font $font, $rotation=0)
Get GD text width in pixels for a string of text in a certain font at a certain rotation angle.
Definition: Font.php:304
const PALATINO_LINOTYPE_BOLD_ITALIC
Definition: Font.php:108
const CHARSET_ANSI_JAPANESE_SHIFTJIS
Definition: Font.php:52
const AUTOSIZE_METHOD_EXACT
Definition: Font.php:40
const MICROSOFT_SANS_SERIF
Definition: Font.php:103
const CHARSET_ANSI_KOREAN_JOHAB
Definition: Font.php:54
const CALIBRI_BOLD
Definition: Font.php:76
const TIMES_NEW_ROMAN_ITALIC
Definition: Font.php:117
static calculateColumnWidth(PHPExcel_Style_Font $font, $cellText='', $rotation=0, PHPExcel_Style_Font $defaultFont=null)
Calculate an (approximate) OpenXML column width, based on font size and text contained.
Definition: Font.php:252
const COMIC_SANS_MS_BOLD
Definition: Font.php:81
static getTrueTypeFontPath()
Get the path to the folder containing .ttf files.
Definition: Font.php:238
const CHARSET_ANSI_CHINESE_TRADITIONAL
Definition: Font.php:56
const LIBERATION_SANS_BOLD_ITALIC
Definition: Font.php:98
const COURIER_NEW_BOLD
Definition: Font.php:84
const LUCIDA_SANS_UNICODE
Definition: Font.php:101
const CALIBRI_ITALIC
Definition: Font.php:77
const TREBUCHET_MS_ITALIC
Definition: Font.php:122
const LIBERATION_SANS_BOLD
Definition: Font.php:96
const CHARSET_ANSI_THAI
Definition: Font.php:64
const COURIER_NEW_BOLD_ITALIC
Definition: Font.php:86
const LIBERATION_SANS
Definition: Font.php:95
const CHARSET_ANSI_GREEK
Definition: Font.php:57
const VERDANA_BOLD
Definition: Font.php:126
static getTextWidthPixelsApprox($columnText, PHPExcel_Style_Font $font=null, $rotation=0)
Get approximate width in pixels for a string of text in a certain font at a certain rotation angle.
Definition: Font.php:338
const ARIAL
Font filenames.
Definition: Font.php:70
static centimeterSizeToPixels($sizeInCm=1)
Calculate an (approximate) pixel size, based on centimeter size.
Definition: Font.php:414
const VERDANA_ITALIC
Definition: Font.php:127
const PALATINO_LINOTYPE
Definition: Font.php:105
static $trueTypeFontPath
Definition: Font.php:142
static getDefaultColumnWidthByFont(PHPExcel_Style_Font $font, $pPixels=false)
Get the effective column width for columns without a column dimension or column with width -1 For exa...
Definition: Font.php:571
const AUTOSIZE_METHOD_APPROX
Definition: Font.php:39
const CHARSET_ANSI_CHINESE_SIMIPLIFIED
Definition: Font.php:55
const PALATINO_LINOTYPE_BOLD
Definition: Font.php:106
static getCharsetFromFontName($name)
Returns the associated charset for the font name.
Definition: Font.php:551
const ARIAL_BOLD
Definition: Font.php:71
const CHARSET_ANSI_HEBREW
Definition: Font.php:60
static getTrueTypeFontFileFromFont($font)
Returns the font path given the font.
Definition: Font.php:424
const LUCIDA_CONSOLE
Definition: Font.php:100
const LIBERATION_SANS_ITALIC
Definition: Font.php:97
const VERDANA_BOLD_ITALIC
Definition: Font.php:128
const PALATINO_LINOTYPE_ITALIC
Definition: Font.php:107
const TREBUCHET_MS_BOLD_ITALIC
Definition: Font.php:123
const COURIER_NEW_ITALIC
Definition: Font.php:85
const GEORGIA_ITALIC
Definition: Font.php:90
static inchSizeToPixels($sizeInInch=1)
Calculate an (approximate) pixel size, based on inch size.
Definition: Font.php:404
const CHARSET_SYSTEM_DEFAULT
Definition: Font.php:49
const GEORGIA_BOLD
Definition: Font.php:89
static setAutoSizeMethod($pValue=self::AUTOSIZE_METHOD_APPROX)
Set autoSize method.
Definition: Font.php:197
static getDefaultRowHeightByFont(PHPExcel_Style_Font $font)
Get the effective row height for rows without a row dimension or rows with height -1 For example,...
Definition: Font.php:603
const TIMES_NEW_ROMAN
Definition: Font.php:115
const CHARSET_ANSI_LATIN
Character set codes used by BIFF5-8 in Font records.
Definition: Font.php:48
const ARIAL_ITALIC
Definition: Font.php:72
const CHARSET_ANSI_CYRILLIC
Definition: Font.php:63
const COURIER_NEW
Definition: Font.php:83
const CHARSET_OEM_LATIN_I
Definition: Font.php:66
const CALIBRI_BOLD_ITALIC
Definition: Font.php:78
const TREBUCHET_MS_BOLD
Definition: Font.php:121
const TIMES_NEW_ROMAN_BOLD
Definition: Font.php:116
const CHARSET_APPLE_ROMAN
Definition: Font.php:51
const CHARSET_ANSI_TURKISH
Definition: Font.php:58
const CHARSET_ANSI_VIETNAMESE
Definition: Font.php:59
const TREBUCHET_MS
Definition: Font.php:120
const CHARSET_ANSI_BALTIC
Definition: Font.php:62
const TIMES_NEW_ROMAN_BOLD_ITALIC
Definition: Font.php:118
static $defaultColumnWidths
Definition: Font.php:151
const CHARSET_ANSI_LATIN_II
Definition: Font.php:65
static CountCharacters($value, $enc='UTF-8')
Get character count.
Definition: String.php:550
getSize()
Get Size.
Definition: Font.php:262
getName()
Get Name.
Definition: Font.php:231
$text