PHPExcel_Shared

# Class: PHPExcel_Shared_Font Source Location: /PHPExcel/Shared/Font.php
### Class Overview
PHPExcel_Shared_Font #### Author(s): #### Copyright: Copyright (c) 2006 - 2011 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 - 2011 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 146] 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 241]
`static int calculateColumnWidth( $font, [string $cellText = ''], [int $rotation = 0], [ $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 404]
`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 384]
`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 201]
`static string getAutoSizeMethod( )`
Get autoSize method #### Tags:
access: | public
[ Top ] ### static method getCharsetFromFontName [line 541]
`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 561]
`static mixed getDefaultColumnWidthByFont( $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 593]
`static float getDefaultRowHeightByFont( $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 329]
`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 #### 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 295]
`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 #### Tags:
throws: | Exception
access: | public
#### Parameters:
string | $text |
int | $rotation |
PHPExcel_Style_Font | $font |
[ Top ] ### static method getTrueTypeFontFileFromFont [line 414]
`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 227]
`static string getTrueTypeFontPath( )`
Get the path to the folder containing .ttf files. #### Tags:
access: | public
[ Top ] ### static method inchSizeToPixels [line 394]
`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 191]
`static void setAutoSizeMethod( [string $pValue = 'approx'])`
Set autoSize method #### Tags:
access: | public
#### Parameters:
string | $pValue |
[ Top ] ### static method setTrueTypeFontPath [line 217]
`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 65] Font filenames [ Top ] #### ARIAL_BOLD = 'arialbd.ttf' [line 66] [ Top ] #### ARIAL_BOLD_ITALIC = 'arialbi.ttf' [line 68] [ Top ] #### ARIAL_ITALIC = 'ariali.ttf' [line 67] [ Top ] #### AUTOSIZE_METHOD_APPROX = 'approx' [line 39] [ Top ] #### AUTOSIZE_METHOD_EXACT = 'exact' [line 40] [ Top ] #### CALIBRI = 'CALIBRI.TTF' [line 70] [ Top ] #### CALIBRI_BOLD = 'CALIBRIB.TTF' [line 71] [ Top ] #### CALIBRI_BOLD_ITALIC = 'CALIBRIZ.TTF' [line 73] [ Top ] #### CALIBRI_ITALIC = 'CALIBRII.TTF' [line 72] [ Top ] #### CHARSET_ANSI_ARABIC = 0xB2 [line 56] [ Top ] #### CHARSET_ANSI_BALTIC = 0xBA [line 57] [ Top ] #### CHARSET_ANSI_CHINESE_SIMIPLIFIED = 0x86 [line 50] [ Top ] #### CHARSET_ANSI_CHINESE_TRADITIONAL = 0x88 [line 51] [ Top ] #### CHARSET_ANSI_CYRILLIC = 0xCC [line 58] [ Top ] #### CHARSET_ANSI_GREEK = 0xA1 [line 52] [ Top ] #### CHARSET_ANSI_HEBREW = 0xB1 [line 55] [ Top ] #### CHARSET_ANSI_JAPANESE_SHIFTJIS = 0x80 [line 47] [ Top ] #### CHARSET_ANSI_KOREAN_HANGUL = 0x81 [line 48] [ Top ] #### CHARSET_ANSI_KOREAN_JOHAB = 0x82 [line 49] [ Top ] #### CHARSET_ANSI_LATIN = 0x00 [line 43] Character set codes used by BIFF5-8 in Font records [ Top ] #### CHARSET_ANSI_LATIN_II = 0xEE [line 60] [ Top ] #### CHARSET_ANSI_THAI = 0xDE [line 59] [ Top ] #### CHARSET_ANSI_TURKISH = 0xA2 [line 53] [ Top ] #### CHARSET_ANSI_VIETNAMESE = 0xA3 [line 54] [ Top ] #### CHARSET_APPLE_ROMAN = 0x4D [line 46] [ Top ] #### CHARSET_OEM_LATIN_I = 0xFF [line 61] [ Top ] #### CHARSET_SYMBOL = 0x02 [line 45] [ Top ] #### CHARSET_SYSTEM_DEFAULT = 0x01 [line 44] [ Top ] #### COMIC_SANS_MS = 'comic.ttf' [line 75] [ Top ] #### COMIC_SANS_MS_BOLD = 'comicbd.ttf' [line 76] [ Top ] #### COURIER_NEW = 'cour.ttf' [line 78] [ Top ] #### COURIER_NEW_BOLD = 'courbd.ttf' [line 79] [ Top ] #### COURIER_NEW_BOLD_ITALIC = 'courbi.ttf' [line 81] [ Top ] #### COURIER_NEW_ITALIC = 'couri.ttf' [line 80] [ Top ] #### GEORGIA = 'georgia.ttf' [line 83] [ Top ] #### GEORGIA_BOLD = 'georgiab.ttf' [line 84] [ Top ] #### GEORGIA_BOLD_ITALIC = 'georgiaz.ttf' [line 86] [ Top ] #### GEORGIA_ITALIC = 'georgiai.ttf' [line 85] [ Top ] #### IMPACT = 'impact.ttf' [line 88] [ Top ] #### LIBERATION_SANS = 'LiberationSans-Regular.ttf' [line 90] [ Top ] #### LIBERATION_SANS_BOLD = 'LiberationSans-Bold.ttf' [line 91] [ Top ] #### LIBERATION_SANS_BOLD_ITALIC = 'LiberationSans-BoldItalic.ttf' [line 93] [ Top ] #### LIBERATION_SANS_ITALIC = 'LiberationSans-Italic.ttf' [line 92] [ Top ] #### LUCIDA_CONSOLE = 'lucon.ttf' [line 95] [ Top ] #### LUCIDA_SANS_UNICODE = 'l_10646.ttf' [line 96] [ Top ] #### MICROSOFT_SANS_SERIF = 'micross.ttf' [line 98] [ Top ] #### PALATINO_LINOTYPE = 'pala.ttf' [line 100] [ Top ] #### PALATINO_LINOTYPE_BOLD = 'palab.ttf' [line 101] [ Top ] #### PALATINO_LINOTYPE_BOLD_ITALIC = 'palabi.ttf' [line 103] [ Top ] #### PALATINO_LINOTYPE_ITALIC = 'palai.ttf' [line 102] [ Top ] #### SYMBOL = 'symbol.ttf' [line 105] [ Top ] #### TAHOMA = 'tahoma.ttf' [line 107] [ Top ] #### TAHOMA_BOLD = 'tahomabd.ttf' [line 108] [ Top ] #### TIMES_NEW_ROMAN = 'times.ttf' [line 110] [ Top ] #### TIMES_NEW_ROMAN_BOLD = 'timesbd.ttf' [line 111] [ Top ] #### TIMES_NEW_ROMAN_BOLD_ITALIC = 'timesbi.ttf' [line 113] [ Top ] #### TIMES_NEW_ROMAN_ITALIC = 'timesi.ttf' [line 112] [ Top ] #### TREBUCHET_MS = 'trebuc.ttf' [line 115] [ Top ] #### TREBUCHET_MS_BOLD = 'trebucbd.ttf' [line 116] [ Top ] #### TREBUCHET_MS_BOLD_ITALIC = 'trebucbi.ttf' [line 118] [ Top ] #### TREBUCHET_MS_ITALIC = 'trebucit.ttf' [line 117] [ Top ] #### VERDANA = 'verdana.ttf' [line 120] [ Top ] #### VERDANA_BOLD = 'verdanab.ttf' [line 121] [ Top ] #### VERDANA_BOLD_ITALIC = 'verdanaz.ttf' [line 123] [ Top ] #### VERDANA_ITALIC = 'verdanai.ttf' [line 122] [ Top ] Documentation generated on Sun, 27 Feb 2011 16:31:43 -0800 by phpDocumentor 1.4.3