Overview

Packages

  • JAMA
  • None
  • PHP
  • PHPExcel
    • CachedObjectStorage
    • Calculation
    • Cell
    • Chart
      • Renderer
    • Reader
      • Excel2007
      • Excel5
    • RichText
    • Settings
    • Shared
      • Escher
      • OLE
      • Trend
      • ZipArchive
    • Style
    • Worksheet
      • Drawing
    • Writer
      • 2007
      • CSV
      • Excel2007
      • Excel5
      • HTML
      • PDF

Classes

  • PHPExcel_Shared_CodePage
  • PHPExcel_Shared_Date
  • PHPExcel_Shared_Drawing
  • PHPExcel_Shared_Excel5
  • PHPExcel_Shared_File
  • PHPExcel_Shared_Font
  • PHPExcel_Shared_OLERead
  • PHPExcel_Shared_PasswordHasher
  • PHPExcel_Shared_String
  • PHPExcel_Shared_TimeZone
  • PHPExcel_Shared_XMLWriter
  • PHPExcel_Shared_ZipStreamWrapper
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download

Class PHPExcel_Shared_Font

PHPExcel_Shared_Font

Package: PHPExcel\Shared
Category: PHPExcel
Copyright: Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
License: LGPL
Located at controlador/include/phpexcel/PHPExcel/Shared/Font.php
Methods summary
public static boolean
# setAutoSizeMethod( string $pValue = PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX )

Set autoSize method

Set autoSize method

Parameters

$pValue

Returns

boolean
Success or failure
public static string
# getAutoSizeMethod( )

Get autoSize method

Get autoSize method

Returns

string
public static
# 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/

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/

Parameters

$pValue
public static string
# getTrueTypeFontPath( )

Get the path to the folder containing .ttf files.

Get the path to the folder containing .ttf files.

Returns

string
public static integer
# calculateColumnWidth( PHPExcel_Style_Font $font, PHPExcel_RichText|string $cellText = '', integer $rotation = 0, PHPExcel_Style_Font $defaultFont = null )

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

Parameters

$font
Font object
$cellText
Text to calculate width
$rotation
Rotation angle
$defaultFont
Font object

Returns

integer
Column width
public static integer
# getTextWidthPixelsExact( string $text, PHPExcel_Style_Font $font, integer $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

Parameters

$text
$font
$rotation

Returns

integer

Throws

PHPExcel_Exception
public static integer
# getTextWidthPixelsApprox( string $columnText, PHPExcel_Style_Font $font = null, integer $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

Parameters

$columnText
$font
$rotation

Returns

integer
Text width in pixels (no padding added)
public static integer
# fontSizeToPixels( integer $fontSizeInPoints = 11 )

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

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

Parameters

$fontSizeInPoints
Font size (in points)

Returns

integer
Font size (in pixels)
public static integer
# inchSizeToPixels( integer $sizeInInch = 1 )

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

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

Parameters

$sizeInInch
Font size (in inch)

Returns

integer
Size (in pixels)
public static integer
# centimeterSizeToPixels( integer $sizeInCm = 1 )

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

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

Parameters

$sizeInCm
Font size (in centimeters)

Returns

integer
Size (in pixels)
public static string
# getTrueTypeFontFileFromFont( PHPExcel_Style_Font $font )

Returns the font path given the font

Returns the font path given the font

Parameters

$font

Returns

string
Path to TrueType font file
public static integer
# getCharsetFromFontName( string $name )

Returns the associated charset for the font name.

Returns the associated charset for the font name.

Parameters

$name
Font name

Returns

integer
Character set code
public 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)

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)

Parameters

$font
The workbooks default font
$pPixels
true = return column width in pixels, false = return in OOXML units

Returns

mixed
Column width
public 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

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

Parameters

$font
The workbooks default font

Returns

float
Row height in points
Constants summary
string AUTOSIZE_METHOD_APPROX
# 'approx'
string AUTOSIZE_METHOD_EXACT
# 'exact'
integer CHARSET_ANSI_LATIN

Character set codes used by BIFF5-8 in Font records

Character set codes used by BIFF5-8 in Font records

# 0x00
integer CHARSET_SYSTEM_DEFAULT
# 0x01
integer CHARSET_SYMBOL
# 0x02
integer CHARSET_APPLE_ROMAN
# 0x4D
integer CHARSET_ANSI_JAPANESE_SHIFTJIS
# 0x80
integer CHARSET_ANSI_KOREAN_HANGUL
# 0x81
integer CHARSET_ANSI_KOREAN_JOHAB
# 0x82
integer CHARSET_ANSI_CHINESE_SIMIPLIFIED
# 0x86
integer CHARSET_ANSI_CHINESE_TRADITIONAL
# 0x88
integer CHARSET_ANSI_GREEK
# 0xA1
integer CHARSET_ANSI_TURKISH
# 0xA2
integer CHARSET_ANSI_VIETNAMESE
# 0xA3
integer CHARSET_ANSI_HEBREW
# 0xB1
integer CHARSET_ANSI_ARABIC
# 0xB2
integer CHARSET_ANSI_BALTIC
# 0xBA
integer CHARSET_ANSI_CYRILLIC
# 0xCC
integer CHARSET_ANSI_THAI
# 0xDD
integer CHARSET_ANSI_LATIN_II
# 0xEE
integer CHARSET_OEM_LATIN_I
# 0xFF
string ARIAL

Font filenames

Font filenames

# 'arial.ttf'
string ARIAL_BOLD
# 'arialbd.ttf'
string ARIAL_ITALIC
# 'ariali.ttf'
string ARIAL_BOLD_ITALIC
# 'arialbi.ttf'
string CALIBRI
# 'CALIBRI.TTF'
string CALIBRI_BOLD
# 'CALIBRIB.TTF'
string CALIBRI_ITALIC
# 'CALIBRII.TTF'
string CALIBRI_BOLD_ITALIC
# 'CALIBRIZ.TTF'
string COMIC_SANS_MS
# 'comic.ttf'
string COMIC_SANS_MS_BOLD
# 'comicbd.ttf'
string COURIER_NEW
# 'cour.ttf'
string COURIER_NEW_BOLD
# 'courbd.ttf'
string COURIER_NEW_ITALIC
# 'couri.ttf'
string COURIER_NEW_BOLD_ITALIC
# 'courbi.ttf'
string GEORGIA
# 'georgia.ttf'
string GEORGIA_BOLD
# 'georgiab.ttf'
string GEORGIA_ITALIC
# 'georgiai.ttf'
string GEORGIA_BOLD_ITALIC
# 'georgiaz.ttf'
string IMPACT
# 'impact.ttf'
string LIBERATION_SANS
# 'LiberationSans-Regular.ttf'
string LIBERATION_SANS_BOLD
# 'LiberationSans-Bold.ttf'
string LIBERATION_SANS_ITALIC
# 'LiberationSans-Italic.ttf'
string LIBERATION_SANS_BOLD_ITALIC
# 'LiberationSans-BoldItalic.ttf'
string LUCIDA_CONSOLE
# 'lucon.ttf'
string LUCIDA_SANS_UNICODE
# 'l_10646.ttf'
string MICROSOFT_SANS_SERIF
# 'micross.ttf'
string PALATINO_LINOTYPE
# 'pala.ttf'
string PALATINO_LINOTYPE_BOLD
# 'palab.ttf'
string PALATINO_LINOTYPE_ITALIC
# 'palai.ttf'
string PALATINO_LINOTYPE_BOLD_ITALIC
# 'palabi.ttf'
string SYMBOL
# 'symbol.ttf'
string TAHOMA
# 'tahoma.ttf'
string TAHOMA_BOLD
# 'tahomabd.ttf'
string TIMES_NEW_ROMAN
# 'times.ttf'
string TIMES_NEW_ROMAN_BOLD
# 'timesbd.ttf'
string TIMES_NEW_ROMAN_ITALIC
# 'timesi.ttf'
string TIMES_NEW_ROMAN_BOLD_ITALIC
# 'timesbi.ttf'
string TREBUCHET_MS
# 'trebuc.ttf'
string TREBUCHET_MS_BOLD
# 'trebucbd.ttf'
string TREBUCHET_MS_ITALIC
# 'trebucit.ttf'
string TREBUCHET_MS_BOLD_ITALIC
# 'trebucbi.ttf'
string VERDANA
# 'verdana.ttf'
string VERDANA_BOLD
# 'verdanab.ttf'
string VERDANA_ITALIC
# 'verdanai.ttf'
string VERDANA_BOLD_ITALIC
# 'verdanaz.ttf'
Properties summary
private static array $_autoSizeMethods
# array( self::AUTOSIZE_METHOD_APPROX, self::AUTOSIZE_METHOD_EXACT, )
private static string $autoSizeMethod

AutoSize method

AutoSize method

# PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX
private static string $trueTypeFontPath

Path to folder containing TrueType font .ttf files

Path to folder containing TrueType font .ttf files

# null
public static array $defaultColumnWidths

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.

# 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), ), )
Autene API documentation generated by ApiGen