PHPExcel_Shared

# Class: PHPExcel_Shared_Font Source Location: /PHPExcel/Shared/Font.php
### Class Overview
PHPExcel_Shared_Font #### Author(s): #### Copyright: Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) | ### Variables $defaultColumnWidths | ### Constants ARIAL ARIAL_BOLD ARIAL_BOLD_ITALIC ARIAL_ITALIC AUTOSIZE_METHOD_APPROX AUTOSIZE_METHOD_EXACT CALIBRI CALIBRI_BOLD CALIBRI_BOLD_ITALIC CALIBRI_ITALIC CHARSET_ANSI_ARABIC CHARSET_ANSI_BALTIC CHARSET_ANSI_CHINESE_SIMIPLIFIED CHARSET_ANSI_CHINESE_TRADITIONAL CHARSET_ANSI_CYRILLIC CHARSET_ANSI_GREEK CHARSET_ANSI_HEBREW CHARSET_ANSI_JAPANESE_SHIFTJIS CHARSET_ANSI_KOREAN_HANGUL CHARSET_ANSI_KOREAN_JOHAB CHARSET_ANSI_LATIN CHARSET_ANSI_LATIN_II CHARSET_ANSI_THAI CHARSET_ANSI_TURKISH CHARSET_ANSI_VIETNAMESE CHARSET_APPLE_ROMAN CHARSET_OEM_LATIN_I CHARSET_SYMBOL CHARSET_SYSTEM_DEFAULT COMIC_SANS_MS COMIC_SANS_MS_BOLD COURIER_NEW COURIER_NEW_BOLD COURIER_NEW_BOLD_ITALIC COURIER_NEW_ITALIC GEORGIA GEORGIA_BOLD GEORGIA_BOLD_ITALIC GEORGIA_ITALIC IMPACT LIBERATION_SANS LIBERATION_SANS_BOLD LIBERATION_SANS_BOLD_ITALIC LIBERATION_SANS_ITALIC LUCIDA_CONSOLE LUCIDA_SANS_UNICODE MICROSOFT_SANS_SERIF PALATINO_LINOTYPE PALATINO_LINOTYPE_BOLD PALATINO_LINOTYPE_BOLD_ITALIC PALATINO_LINOTYPE_ITALIC SYMBOL TAHOMA TAHOMA_BOLD TIMES_NEW_ROMAN TIMES_NEW_ROMAN_BOLD TIMES_NEW_ROMAN_BOLD_ITALIC TIMES_NEW_ROMAN_ITALIC TREBUCHET_MS TREBUCHET_MS_BOLD TREBUCHET_MS_BOLD_ITALIC TREBUCHET_MS_ITALIC VERDANA VERDANA_BOLD VERDANA_BOLD_ITALIC VERDANA_ITALIC | ### Methods calculateColumnWidth centimeterSizeToPixels fontSizeToPixels getAutoSizeMethod getCharsetFromFontName getDefaultColumnWidthByFont getDefaultRowHeightByFont getTextWidthPixelsApprox getTextWidthPixelsExact getTrueTypeFontFileFromFont getTrueTypeFontPath inchSizeToPixels setAutoSizeMethod setTrueTypeFontPath
### Class Details [line 36] PHPExcel_Shared_Font #### Tags:
copyright: | Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
[ Top ] ### Class Variables #### static $defaultColumnWidths = array( 'Arial' => array( 1 => array('px' => 24, 'width' => 12.00000000),2=>array('px'=>24,'width'=>12.00000000),3=>array('px'=>32,'width'=>10.66406250),4=>array('px'=>32,'width'=>10.66406250),5=>array('px'=>40,'width'=>10.00000000),6=>array('px'=>48,'width'=>9.59765625),7=>array('px'=>48,'width'=>9.59765625),8=>array('px'=>56,'width'=>9.33203125),9=>array('px'=>64,'width'=>9.14062500),10=>array('px'=>64,'width'=>9.14062500),),'Calibri'=>array(1=>array('px'=>24,'width'=>12.00000000),2=>array('px'=>24,'width'=>12.00000000),3=>array('px'=>32,'width'=>10.66406250),4=>array('px'=>32,'width'=>10.66406250),5=>array('px'=>40,'width'=>10.00000000),6=>array('px'=>48,'width'=>9.59765625),7=>array('px'=>48,'width'=>9.59765625),8=>array('px'=>56,'width'=>9.33203125),9=>array('px'=>56,'width'=>9.33203125),10=>array('px'=>64,'width'=>9.14062500),11=>array('px'=>64,'width'=>9.14062500),),'Verdana'=>array(1=>array('px'=>24,'width'=>12.00000000),2=>array('px'=>24,'width'=>12.00000000),3=>array('px'=>32,'width'=>10.66406250),4=>array('px'=>32,'width'=>10.66406250),5=>array('px'=>40,'width'=>10.00000000),6=>array('px'=>48,'width'=>9.59765625),7=>array('px'=>48,'width'=>9.59765625),8=>array('px'=>64,'width'=>9.14062500),9=>array('px'=>72,'width'=>9.00000000),10=>array('px'=>72,'width'=>9.00000000),),) [line 151] How wide is a default column for a given default font and size? Empirical data found by inspecting real Excel files and reading off the pixel width in Microsoft Office Excel 2007. #### Tags:
access: | public
Type: | array
[ Top ] ### Class Methods ### static method calculateColumnWidth [line 253]
`static int calculateColumnWidth( PHPExcel_Style_Font $font, [string $cellText = ''], [int $rotation = 0], [PHPExcel_Style_Font $defaultFont = null], int $fontSize, bool $fontSizeInPixels)`
Calculate an (approximate) OpenXML column width, based on font size and text contained #### Tags:
return: | Column width
access: | public
#### Parameters:
int | $fontSize | Font size (in pixels or points)
bool | $fontSizeInPixels | Is the font size specified in pixels (true) or in points (false) ?
string | $cellText | Text to calculate width
int | $rotation | Rotation angle
PHPExcel_Style_Font | $font |
PHPExcel_Style_Font | $defaultFont |
[ Top ] ### static method centimeterSizeToPixels [line 416]
`static int centimeterSizeToPixels( [int $sizeInCm = 1])`
Calculate an (approximate) pixel size, based on centimeter size #### Tags:
return: | Size (in pixels)
access: | public
#### Parameters:
int | $sizeInCm | Font size (in centimeters)
[ Top ] ### static method fontSizeToPixels [line 396]
`static int fontSizeToPixels( [int $fontSizeInPoints = 11])`
Calculate an (approximate) pixel size, based on a font points size #### Tags:
return: | Font size (in pixels)
access: | public
#### Parameters:
int | $fontSizeInPoints | Font size (in points)
[ Top ] ### static method getAutoSizeMethod [line 213]
`static string getAutoSizeMethod( )`
Get autoSize method #### Tags:
access: | public
[ Top ] ### static method getCharsetFromFontName [line 553]
`static int getCharsetFromFontName( string $name)`
Returns the associated charset for the font name. #### Tags:
return: | Character set code
access: | public
#### Parameters:
string | $name | Font name
[ Top ] ### static method getDefaultColumnWidthByFont [line 573]
`static mixed getDefaultColumnWidthByFont( PHPExcel_Style_Font $font, [boolean $pPixels = false])`
Get the effective column width for columns without a column dimension or column with width -1 For example, for Calibri 11 this is 9.140625 (64 px) #### Tags:
return: | Column width
access: | public
#### Parameters:
PHPExcel_Style_Font | $font | The workbooks default font
boolean | $pPixels | true = return column width in pixels, false = return in OOXML units
[ Top ] ### static method getDefaultRowHeightByFont [line 605]
`static float getDefaultRowHeightByFont( PHPExcel_Style_Font $font)`
Get the effective row height for rows without a row dimension or rows with height -1 For example, for Calibri 11 this is 15 points #### Tags:
return: | Row height in points
access: | public
#### Parameters:
PHPExcel_Style_Font | $font | The workbooks default font
[ Top ] ### static method getTextWidthPixelsApprox [line 341]
`static int getTextWidthPixelsApprox( string $columnText, [PHPExcel_Style_Font $font = null], [int $rotation = 0])`
Get approximate width in pixels for a string of text in a certain font at a certain rotation angle #### Tags:
return: | Text width in pixels (no padding added)
access: | public
#### Parameters:
string | $columnText |
PHPExcel_Style_Font | $font |
int | $rotation |
[ Top ] ### static method getTextWidthPixelsExact [line 307]
`static int getTextWidthPixelsExact( string $text, PHPExcel_Style_Font $font, [int $rotation = 0])`
Get GD text width in pixels for a string of text in a certain font at a certain rotation angle #### Tags:
throws: | Exception
access: | public
#### Parameters:
string | $text |
int | $rotation |
PHPExcel_Style_Font | $font |
[ Top ] ### static method getTrueTypeFontFileFromFont [line 426]
`static string getTrueTypeFontFileFromFont( PHPExcel_Style_Font $font)`
Returns the font path given the font #### Tags:
return: | Path to TrueType font file
access: | public
#### Parameters:
PHPExcel_Style_Font | $font |
[ Top ] ### static method getTrueTypeFontPath [line 239]
`static string getTrueTypeFontPath( )`
Get the path to the folder containing .ttf files. #### Tags:
access: | public
[ Top ] ### static method inchSizeToPixels [line 406]
`static int inchSizeToPixels( [int $sizeInInch = 1])`
Calculate an (approximate) pixel size, based on inch size #### Tags:
return: | Size (in pixels)
access: | public
#### Parameters:
int | $sizeInInch | Font size (in inch)
[ Top ] ### static method setAutoSizeMethod [line 197]
`static boolean setAutoSizeMethod( [string $pValue = self::AUTOSIZE_METHOD_APPROX])`
Set autoSize method #### Tags:
return: | Success or failure
access: | public
#### Parameters:
string | $pValue |
[ Top ] ### static method setTrueTypeFontPath [line 229]
`static void setTrueTypeFontPath( [string $pValue = ''])`
Set the path to the folder containing .ttf files. There should be a trailing slash. Typical locations on variout some platforms: C:/Windows/Fonts/ /usr/share/fonts/truetype/ ~/.fonts/ #### Tags:
access: | public
#### Parameters:
string | $pValue |
[ Top ] ### Class Constants #### ARIAL = 'arial.ttf' [line 70] Font filenames [ Top ] #### ARIAL_BOLD = 'arialbd.ttf' [line 71] [ Top ] #### ARIAL_BOLD_ITALIC = 'arialbi.ttf' [line 73] [ Top ] #### ARIAL_ITALIC = 'ariali.ttf' [line 72] [ Top ] #### AUTOSIZE_METHOD_APPROX = 'approx' [line 39] [ Top ] #### AUTOSIZE_METHOD_EXACT = 'exact' [line 40] [ Top ] #### CALIBRI = 'CALIBRI.TTF' [line 75] [ Top ] #### CALIBRI_BOLD = 'CALIBRIB.TTF' [line 76] [ Top ] #### CALIBRI_BOLD_ITALIC = 'CALIBRIZ.TTF' [line 78] [ Top ] #### CALIBRI_ITALIC = 'CALIBRII.TTF' [line 77] [ Top ] #### CHARSET_ANSI_ARABIC = 0xB2 [line 61] [ Top ] #### CHARSET_ANSI_BALTIC = 0xBA [line 62] [ Top ] #### CHARSET_ANSI_CHINESE_SIMIPLIFIED = 0x86 [line 55] [ Top ] #### CHARSET_ANSI_CHINESE_TRADITIONAL = 0x88 [line 56] [ Top ] #### CHARSET_ANSI_CYRILLIC = 0xCC [line 63] [ Top ] #### CHARSET_ANSI_GREEK = 0xA1 [line 57] [ Top ] #### CHARSET_ANSI_HEBREW = 0xB1 [line 60] [ Top ] #### CHARSET_ANSI_JAPANESE_SHIFTJIS = 0x80 [line 52] [ Top ] #### CHARSET_ANSI_KOREAN_HANGUL = 0x81 [line 53] [ Top ] #### CHARSET_ANSI_KOREAN_JOHAB = 0x82 [line 54] [ Top ] #### CHARSET_ANSI_LATIN = 0x00 [line 48] Character set codes used by BIFF5-8 in Font records [ Top ] #### CHARSET_ANSI_LATIN_II = 0xEE [line 65] [ Top ] #### CHARSET_ANSI_THAI = 0xDD [line 64] [ Top ] #### CHARSET_ANSI_TURKISH = 0xA2 [line 58] [ Top ] #### CHARSET_ANSI_VIETNAMESE = 0xA3 [line 59] [ Top ] #### CHARSET_APPLE_ROMAN = 0x4D [line 51] [ Top ] #### CHARSET_OEM_LATIN_I = 0xFF [line 66] [ Top ] #### CHARSET_SYMBOL = 0x02 [line 50] [ Top ] #### CHARSET_SYSTEM_DEFAULT = 0x01 [line 49] [ Top ] #### COMIC_SANS_MS = 'comic.ttf' [line 80] [ Top ] #### COMIC_SANS_MS_BOLD = 'comicbd.ttf' [line 81] [ Top ] #### COURIER_NEW = 'cour.ttf' [line 83] [ Top ] #### COURIER_NEW_BOLD = 'courbd.ttf' [line 84] [ Top ] #### COURIER_NEW_BOLD_ITALIC = 'courbi.ttf' [line 86] [ Top ] #### COURIER_NEW_ITALIC = 'couri.ttf' [line 85] [ Top ] #### GEORGIA = 'georgia.ttf' [line 88] [ Top ] #### GEORGIA_BOLD = 'georgiab.ttf' [line 89] [ Top ] #### GEORGIA_BOLD_ITALIC = 'georgiaz.ttf' [line 91] [ Top ] #### GEORGIA_ITALIC = 'georgiai.ttf' [line 90] [ Top ] #### IMPACT = 'impact.ttf' [line 93] [ Top ] #### LIBERATION_SANS = 'LiberationSans-Regular.ttf' [line 95] [ Top ] #### LIBERATION_SANS_BOLD = 'LiberationSans-Bold.ttf' [line 96] [ Top ] #### LIBERATION_SANS_BOLD_ITALIC = 'LiberationSans-BoldItalic.ttf' [line 98] [ Top ] #### LIBERATION_SANS_ITALIC = 'LiberationSans-Italic.ttf' [line 97] [ Top ] #### LUCIDA_CONSOLE = 'lucon.ttf' [line 100] [ Top ] #### LUCIDA_SANS_UNICODE = 'l_10646.ttf' [line 101] [ Top ] #### MICROSOFT_SANS_SERIF = 'micross.ttf' [line 103] [ Top ] #### PALATINO_LINOTYPE = 'pala.ttf' [line 105] [ Top ] #### PALATINO_LINOTYPE_BOLD = 'palab.ttf' [line 106] [ Top ] #### PALATINO_LINOTYPE_BOLD_ITALIC = 'palabi.ttf' [line 108] [ Top ] #### PALATINO_LINOTYPE_ITALIC = 'palai.ttf' [line 107] [ Top ] #### SYMBOL = 'symbol.ttf' [line 110] [ Top ] #### TAHOMA = 'tahoma.ttf' [line 112] [ Top ] #### TAHOMA_BOLD = 'tahomabd.ttf' [line 113] [ Top ] #### TIMES_NEW_ROMAN = 'times.ttf' [line 115] [ Top ] #### TIMES_NEW_ROMAN_BOLD = 'timesbd.ttf' [line 116] [ Top ] #### TIMES_NEW_ROMAN_BOLD_ITALIC = 'timesbi.ttf' [line 118] [ Top ] #### TIMES_NEW_ROMAN_ITALIC = 'timesi.ttf' [line 117] [ Top ] #### TREBUCHET_MS = 'trebuc.ttf' [line 120] [ Top ] #### TREBUCHET_MS_BOLD = 'trebucbd.ttf' [line 121] [ Top ] #### TREBUCHET_MS_BOLD_ITALIC = 'trebucbi.ttf' [line 123] [ Top ] #### TREBUCHET_MS_ITALIC = 'trebucit.ttf' [line 122] [ Top ] #### VERDANA = 'verdana.ttf' [line 125] [ Top ] #### VERDANA_BOLD = 'verdanab.ttf' [line 126] [ Top ] #### VERDANA_BOLD_ITALIC = 'verdanaz.ttf' [line 128] [ Top ] #### VERDANA_ITALIC = 'verdanai.ttf' [line 127] [ Top ] Documentation generated on Fri, 12 Oct 2012 00:16:19 +0200 by phpDocumentor 1.4.4