PHPExcel_Shared

# Class: PHPExcel_Shared_Font Source Location: /PHPExcel/Shared/Font.php
### Class Overview
PHPExcel_Shared_Font #### Author(s): #### Copyright: Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) | ### Variables $autoSizeMethod $defaultColumnWidths $trueTypeFontPath | ### 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 48] PHPExcel_Shared_Font PHPExcel_Shared_Font #### Tags:
copyright: | Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
[ Top ] ### Class Variables #### static $autoSizeMethod = self::AUTOSIZE_METHOD_APPROX [line 142] AutoSize method AutoSize method #### Tags:
access: | private
Type: | string
[ Top ] #### 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 158] 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. 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 ] #### static $trueTypeFontPath = null [line 149] Path to folder containing TrueType font . Path to folder containing TrueType font .ttf files #### Tags:
access: | private
Type: | string
[ Top ] ### Class Methods ### static method calculateColumnWidth [line 253]
`static int calculateColumnWidth( $font, [string $columnText = ''], [int $rotation = 0], [ $defaultFont = null], int $fontSize, bool $fontSizeInPixels)`
Calculate an (approximate) OpenXML column width, based on font size and text contained 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 | $columnText | Text to calculate width
int | $rotation | Rotation angle
PHPExcel_Style_Font | $font |
PHPExcel_Style_Font | $defaultFont |
[ Top ] ### static method centimeterSizeToPixels [line 411]
`static int centimeterSizeToPixels( [int $sizeInCm = 1])`
Calculate an (approximate) pixel size, based on centimeter size 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 391]
`static int fontSizeToPixels( [int $fontSizeInPoints = 11])`
Calculate an (approximate) pixel size, based on a font points size 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 Get autoSize method #### Tags:
access: | public
[ Top ] ### static method getCharsetFromFontName [line 548]
`static int getCharsetFromFontName( string $name)`
Returns the associated charset for the font 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 568]
`static mixed getDefaultColumnWidthByFont( $font, [boolean $pPixels = false])`
Get the effective column width for columns without a column dimension or column with width -1 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 600]
`static float getDefaultRowHeightByFont( $font)`
Get the effective row height for rows without a row dimension or rows with height -1 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 336]
`static int getTextWidthPixelsApprox( string $columnText, [ $font = null], [int $rotation = 0])`
Get approximate width in pixels for a string of text in a certain font at a certain rotation angle 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 302]
`static int getTextWidthPixelsExact( string $text, $font, [int $rotation = 0])`
Get GD text width in pixels for a string of text in a certain font at a certain rotation angle 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 421]
`static string getTrueTypeFontFileFromFont( PHPExcel_Style_Font $font)`
Returns the font path given the 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 . Get the path to the folder containing .ttf files. #### Tags:
access: | public
[ Top ] ### static method inchSizeToPixels [line 401]
`static int inchSizeToPixels( [int $sizeInInch = 1])`
Calculate an (approximate) pixel size, based on inch size 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 203]
`static void setAutoSizeMethod( [string $pValue = 'approx'])`
Set autoSize method Set autoSize method #### Tags:
access: | public
#### Parameters:
string | $pValue |
[ Top ] ### static method setTrueTypeFontPath [line 229]
`static void setTrueTypeFontPath( [string $pValue = ''])`
Set the path to the folder containing . 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 77] Font filenames Font filenames [ Top ] #### ARIAL_BOLD = 'arialbd.ttf' [line 78] [ Top ] #### ARIAL_BOLD_ITALIC = 'arialbi.ttf' [line 80] [ Top ] #### ARIAL_ITALIC = 'ariali.ttf' [line 79] [ Top ] #### AUTOSIZE_METHOD_APPROX = 'approx' [line 51] [ Top ] #### AUTOSIZE_METHOD_EXACT = 'exact' [line 52] [ Top ] #### CALIBRI = 'CALIBRI.TTF' [line 82] [ Top ] #### CALIBRI_BOLD = 'CALIBRIB.TTF' [line 83] [ Top ] #### CALIBRI_BOLD_ITALIC = 'CALIBRIZ.TTF' [line 85] [ Top ] #### CALIBRI_ITALIC = 'CALIBRII.TTF' [line 84] [ Top ] #### CHARSET_ANSI_ARABIC = 0xB2 [line 68] [ Top ] #### CHARSET_ANSI_BALTIC = 0xBA [line 69] [ Top ] #### CHARSET_ANSI_CHINESE_SIMIPLIFIED = 0x86 [line 62] [ Top ] #### CHARSET_ANSI_CHINESE_TRADITIONAL = 0x88 [line 63] [ Top ] #### CHARSET_ANSI_CYRILLIC = 0xCC [line 70] [ Top ] #### CHARSET_ANSI_GREEK = 0xA1 [line 64] [ Top ] #### CHARSET_ANSI_HEBREW = 0xB1 [line 67] [ Top ] #### CHARSET_ANSI_JAPANESE_SHIFTJIS = 0x80 [line 59] [ Top ] #### CHARSET_ANSI_KOREAN_HANGUL = 0x81 [line 60] [ Top ] #### CHARSET_ANSI_KOREAN_JOHAB = 0x82 [line 61] [ Top ] #### CHARSET_ANSI_LATIN = 0x00 [line 55] Character set codes used by BIFF5-8 in Font records Character set codes used by BIFF5-8 in Font records [ Top ] #### CHARSET_ANSI_LATIN_II = 0xEE [line 72] [ Top ] #### CHARSET_ANSI_THAI = 0xDE [line 71] [ Top ] #### CHARSET_ANSI_TURKISH = 0xA2 [line 65] [ Top ] #### CHARSET_ANSI_VIETNAMESE = 0xA3 [line 66] [ Top ] #### CHARSET_APPLE_ROMAN = 0x4D [line 58] [ Top ] #### CHARSET_OEM_LATIN_I = 0xFF [line 73] [ Top ] #### CHARSET_SYMBOL = 0x02 [line 57] [ Top ] #### CHARSET_SYSTEM_DEFAULT = 0x01 [line 56] [ Top ] #### COMIC_SANS_MS = 'comic.ttf' [line 87] [ Top ] #### COMIC_SANS_MS_BOLD = 'comicbd.ttf' [line 88] [ Top ] #### COURIER_NEW = 'cour.ttf' [line 90] [ Top ] #### COURIER_NEW_BOLD = 'courbd.ttf' [line 91] [ Top ] #### COURIER_NEW_BOLD_ITALIC = 'courbi.ttf' [line 93] [ Top ] #### COURIER_NEW_ITALIC = 'couri.ttf' [line 92] [ Top ] #### GEORGIA = 'georgia.ttf' [line 95] [ Top ] #### GEORGIA_BOLD = 'georgiab.ttf' [line 96] [ Top ] #### GEORGIA_BOLD_ITALIC = 'georgiaz.ttf' [line 98] [ Top ] #### GEORGIA_ITALIC = 'georgiai.ttf' [line 97] [ Top ] #### IMPACT = 'impact.ttf' [line 100] [ Top ] #### LIBERATION_SANS = 'LiberationSans-Regular.ttf' [line 102] [ Top ] #### LIBERATION_SANS_BOLD = 'LiberationSans-Bold.ttf' [line 103] [ Top ] #### LIBERATION_SANS_BOLD_ITALIC = 'LiberationSans-BoldItalic.ttf' [line 105] [ Top ] #### LIBERATION_SANS_ITALIC = 'LiberationSans-Italic.ttf' [line 104] [ Top ] #### LUCIDA_CONSOLE = 'lucon.ttf' [line 107] [ Top ] #### LUCIDA_SANS_UNICODE = 'l_10646.ttf' [line 108] [ Top ] #### MICROSOFT_SANS_SERIF = 'micross.ttf' [line 110] [ Top ] #### PALATINO_LINOTYPE = 'pala.ttf' [line 112] [ Top ] #### PALATINO_LINOTYPE_BOLD = 'palab.ttf' [line 113] [ Top ] #### PALATINO_LINOTYPE_BOLD_ITALIC = 'palabi.ttf' [line 115] [ Top ] #### PALATINO_LINOTYPE_ITALIC = 'palai.ttf' [line 114] [ Top ] #### SYMBOL = 'symbol.ttf' [line 117] [ Top ] #### TAHOMA = 'tahoma.ttf' [line 119] [ Top ] #### TAHOMA_BOLD = 'tahomabd.ttf' [line 120] [ Top ] #### TIMES_NEW_ROMAN = 'times.ttf' [line 122] [ Top ] #### TIMES_NEW_ROMAN_BOLD = 'timesbd.ttf' [line 123] [ Top ] #### TIMES_NEW_ROMAN_BOLD_ITALIC = 'timesbi.ttf' [line 125] [ Top ] #### TIMES_NEW_ROMAN_ITALIC = 'timesi.ttf' [line 124] [ Top ] #### TREBUCHET_MS = 'trebuc.ttf' [line 127] [ Top ] #### TREBUCHET_MS_BOLD = 'trebucbd.ttf' [line 128] [ Top ] #### TREBUCHET_MS_BOLD_ITALIC = 'trebucbi.ttf' [line 130] [ Top ] #### TREBUCHET_MS_ITALIC = 'trebucit.ttf' [line 129] [ Top ] #### VERDANA = 'verdana.ttf' [line 132] [ Top ] #### VERDANA_BOLD = 'verdanab.ttf' [line 133] [ Top ] #### VERDANA_BOLD_ITALIC = 'verdanaz.ttf' [line 135] [ Top ] #### VERDANA_ITALIC = 'verdanai.ttf' [line 134] [ Top ] Documentation generated on Mon, 11 Jan 2010 08:09:30 +0100 by phpDocumentor 1.4.1