PHPExcel_Shared_Font

category PHPExcel
package PHPExcel_Shared
copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)

 Methods

Calculate an (approximate) OpenXML column width, based on font size and text contained

calculateColumnWidth(\PHPExcel_Style_Font $font, \PHPExcel_RichText | string $cellText, integer $rotation, \PHPExcel_Style_Font $defaultFont) : integer
Static

Parameters

$font

\PHPExcel_Style_Font

Font object

$cellText

\PHPExcel_RichTextstring

Text to calculate width

$rotation

integer

Rotation angle

$defaultFont

\PHPExcel_Style_FontNULL

Font object

Returns

integerColumn width

Calculate an (approximate) pixel size, based on centimeter size

centimeterSizeToPixels(int $sizeInCm) : int
Static

Parameters

$sizeInCm

int

Font size (in centimeters)

Returns

intSize (in pixels)

Calculate an (approximate) pixel size, based on a font points size

fontSizeToPixels(int $fontSizeInPoints) : int
Static

Parameters

$fontSizeInPoints

int

Font size (in points)

Returns

intFont size (in pixels)

Get autoSize method

getAutoSizeMethod() : string
Static

Returns

string

Returns the associated charset for the font name.

getCharsetFromFontName(string $name) : int
Static

Parameters

$name

string

Font name

Returns

intCharacter set code

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)

getDefaultColumnWidthByFont(\PHPExcel_Style_Font $font, boolean $pPixels) : mixed
Static

Parameters

$font

\PHPExcel_Style_Font

The workbooks default font

$pPixels

boolean

true = return column width in pixels, false = return in OOXML units

Returns

mixedColumn width

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

getDefaultRowHeightByFont(\PHPExcel_Style_Font $font) : float
Static

Parameters

$font

\PHPExcel_Style_Font

The workbooks default font

Returns

floatRow height in points

Get approximate width in pixels for a string of text in a certain font at a certain rotation angle

getTextWidthPixelsApprox(string $columnText, \PHPExcel_Style_Font $font, int $rotation) : int
Static

Parameters

$columnText

string

$rotation

int

Returns

intText width in pixels (no padding added)

Get GD text width in pixels for a string of text in a certain font at a certain rotation angle

getTextWidthPixelsExact(string $text, \PHPExcel_Style_Font $font, int $rotation) : int
Static

Parameters

$text

string

$rotation

int

Exceptions

\PHPExcel_Exception

Returns

int

Returns the font path given the font

getTrueTypeFontFileFromFont(\PHPExcel_Style_Font $font) : string
Static

Parameters

Returns

stringPath to TrueType font file

Get the path to the folder containing .ttf files.

getTrueTypeFontPath() : string
Static

Returns

string

Calculate an (approximate) pixel size, based on inch size

inchSizeToPixels(int $sizeInInch) : int
Static

Parameters

$sizeInInch

int

Font size (in inch)

Returns

intSize (in pixels)

Set autoSize method

setAutoSizeMethod(string $pValue) : boolean
Static

Parameters

$pValue

string

Returns

booleanSuccess or failure

Set the path to the folder containing .ttf files.

setTrueTypeFontPath(string $pValue) 
Static

There should be a trailing slash. Typical locations on variout some platforms:

  • C:/Windows/Fonts/
  • /usr/share/fonts/truetype/
  • ~/.fonts/

Parameters

$pValue

string

 Properties

 

$defaultColumnWidths : array
 

$_autoSizeMethods 
 

$autoSizeMethod : string
 

$trueTypeFontPath : string

 Constants

 

Font filenames

ARIAL 
 

ARIAL_BOLD

ARIAL_BOLD 
 

ARIAL_BOLD_ITALIC

ARIAL_BOLD_ITALIC 
 

ARIAL_ITALIC

ARIAL_ITALIC 
 

AUTOSIZE_METHOD_APPROX

AUTOSIZE_METHOD_APPROX 
 

AUTOSIZE_METHOD_EXACT

AUTOSIZE_METHOD_EXACT 
 

CALIBRI

CALIBRI 
 

CALIBRI_BOLD

CALIBRI_BOLD 
 

CALIBRI_BOLD_ITALIC

CALIBRI_BOLD_ITALIC 
 

CALIBRI_ITALIC

CALIBRI_ITALIC 
 

CHARSET_ANSI_ARABIC

CHARSET_ANSI_ARABIC 
 

CHARSET_ANSI_BALTIC

CHARSET_ANSI_BALTIC 
 

CHARSET_ANSI_CHINESE_SIMIPLIFIED

CHARSET_ANSI_CHINESE_SIMIPLIFIED 
 

CHARSET_ANSI_CHINESE_TRADITIONAL

CHARSET_ANSI_CHINESE_TRADITIONAL 
 

CHARSET_ANSI_CYRILLIC

CHARSET_ANSI_CYRILLIC 
 

CHARSET_ANSI_GREEK

CHARSET_ANSI_GREEK 
 

CHARSET_ANSI_HEBREW

CHARSET_ANSI_HEBREW 
 

CHARSET_ANSI_JAPANESE_SHIFTJIS

CHARSET_ANSI_JAPANESE_SHIFTJIS 
 

CHARSET_ANSI_KOREAN_HANGUL

CHARSET_ANSI_KOREAN_HANGUL 
 

CHARSET_ANSI_KOREAN_JOHAB

CHARSET_ANSI_KOREAN_JOHAB 
 

Character set codes used by BIFF5-8 in Font records

CHARSET_ANSI_LATIN 
 

CHARSET_ANSI_LATIN_II

CHARSET_ANSI_LATIN_II 
 

CHARSET_ANSI_THAI

CHARSET_ANSI_THAI 
 

CHARSET_ANSI_TURKISH

CHARSET_ANSI_TURKISH 
 

CHARSET_ANSI_VIETNAMESE

CHARSET_ANSI_VIETNAMESE 
 

CHARSET_APPLE_ROMAN

CHARSET_APPLE_ROMAN 
 

CHARSET_OEM_LATIN_I

CHARSET_OEM_LATIN_I 
 

CHARSET_SYMBOL

CHARSET_SYMBOL 
 

CHARSET_SYSTEM_DEFAULT

CHARSET_SYSTEM_DEFAULT 
 

COMIC_SANS_MS

COMIC_SANS_MS 
 

COMIC_SANS_MS_BOLD

COMIC_SANS_MS_BOLD 
 

COURIER_NEW

COURIER_NEW 
 

COURIER_NEW_BOLD

COURIER_NEW_BOLD 
 

COURIER_NEW_BOLD_ITALIC

COURIER_NEW_BOLD_ITALIC 
 

COURIER_NEW_ITALIC

COURIER_NEW_ITALIC 
 

GEORGIA

GEORGIA 
 

GEORGIA_BOLD

GEORGIA_BOLD 
 

GEORGIA_BOLD_ITALIC

GEORGIA_BOLD_ITALIC 
 

GEORGIA_ITALIC

GEORGIA_ITALIC 
 

IMPACT

IMPACT 
 

LIBERATION_SANS

LIBERATION_SANS 
 

LIBERATION_SANS_BOLD

LIBERATION_SANS_BOLD 
 

LIBERATION_SANS_BOLD_ITALIC

LIBERATION_SANS_BOLD_ITALIC 
 

LIBERATION_SANS_ITALIC

LIBERATION_SANS_ITALIC 
 

LUCIDA_CONSOLE

LUCIDA_CONSOLE 
 

LUCIDA_SANS_UNICODE

LUCIDA_SANS_UNICODE 
 

MICROSOFT_SANS_SERIF

MICROSOFT_SANS_SERIF 
 

PALATINO_LINOTYPE

PALATINO_LINOTYPE 
 

PALATINO_LINOTYPE_BOLD

PALATINO_LINOTYPE_BOLD 
 

PALATINO_LINOTYPE_BOLD_ITALIC

PALATINO_LINOTYPE_BOLD_ITALIC 
 

PALATINO_LINOTYPE_ITALIC

PALATINO_LINOTYPE_ITALIC 
 

SYMBOL

SYMBOL 
 

TAHOMA

TAHOMA 
 

TAHOMA_BOLD

TAHOMA_BOLD 
 

TIMES_NEW_ROMAN

TIMES_NEW_ROMAN 
 

TIMES_NEW_ROMAN_BOLD

TIMES_NEW_ROMAN_BOLD 
 

TIMES_NEW_ROMAN_BOLD_ITALIC

TIMES_NEW_ROMAN_BOLD_ITALIC 
 

TIMES_NEW_ROMAN_ITALIC

TIMES_NEW_ROMAN_ITALIC 
 

TREBUCHET_MS

TREBUCHET_MS 
 

TREBUCHET_MS_BOLD

TREBUCHET_MS_BOLD 
 

TREBUCHET_MS_BOLD_ITALIC

TREBUCHET_MS_BOLD_ITALIC 
 

TREBUCHET_MS_ITALIC

TREBUCHET_MS_ITALIC 
 

VERDANA

VERDANA 
 

VERDANA_BOLD

VERDANA_BOLD 
 

VERDANA_BOLD_ITALIC

VERDANA_BOLD_ITALIC 
 

VERDANA_ITALIC

VERDANA_ITALIC