ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
PHPExcel_Writer_Excel5_Font Class Reference
+ Collaboration diagram for PHPExcel_Writer_Excel5_Font:

Public Member Functions

 __construct (PHPExcel_Style_Font $font=null)
 Constructor. More...
 
 setColorIndex ($colorIndex)
 Set the color index. More...
 
 writeFont ()
 Get font record data. More...
 

Static Private Member Functions

static _mapBold ($bold)
 Map to BIFF5-BIFF8 codes for bold. More...
 
static _mapUnderline ($underline)
 Map underline. More...
 

Private Attributes

 $_colorIndex
 
 $_font
 

Static Private Attributes

static $_mapUnderline
 Map of BIFF2-BIFF8 codes for underline styles array of int. More...
 

Detailed Description

Definition at line 36 of file Font.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_Writer_Excel5_Font::__construct ( PHPExcel_Style_Font  $font = null)

Constructor.

Parameters
PHPExcel_Style_Font$font

Definition at line 57 of file Font.php.

58 {
59 $this->_colorIndex = 0x7FFF;
60 $this->_font = $font;
61 }

Member Function Documentation

◆ _mapBold()

static PHPExcel_Writer_Excel5_Font::_mapBold (   $bold)
staticprivate

Map to BIFF5-BIFF8 codes for bold.

Parameters
boolean$bold
Returns
int

Definition at line 135 of file Font.php.

135 {
136 if ($bold) {
137 return 0x2BC; // 700 = Bold font weight
138 }
139 return 0x190; // 400 = Normal font weight
140 }

◆ _mapUnderline()

static PHPExcel_Writer_Excel5_Font::_mapUnderline (   $underline)
staticprivate

Map underline.

Parameters
string
Returns
int

Definition at line 159 of file Font.php.

159 {
160 if (isset(self::$_mapUnderline[$underline]))
161 return self::$_mapUnderline[$underline];
162 return 0x00;
163 }

◆ setColorIndex()

PHPExcel_Writer_Excel5_Font::setColorIndex (   $colorIndex)

Set the color index.

Parameters
int$colorIndex

Definition at line 68 of file Font.php.

69 {
70 $this->_colorIndex = $colorIndex;
71 }

◆ writeFont()

PHPExcel_Writer_Excel5_Font::writeFont ( )

Get font record data.

Returns
string

Definition at line 78 of file Font.php.

79 {
80 $font_outline = 0;
81 $font_shadow = 0;
82
83 $icv = $this->_colorIndex; // Index to color palette
84 if ($this->_font->getSuperScript()) {
85 $sss = 1;
86 } else if ($this->_font->getSubScript()) {
87 $sss = 2;
88 } else {
89 $sss = 0;
90 }
91 $bFamily = 0; // Font family
92 $bCharSet = PHPExcel_Shared_Font::getCharsetFromFontName($this->_font->getName()); // Character set
93
94 $record = 0x31; // Record identifier
95 $reserved = 0x00; // Reserved
96 $grbit = 0x00; // Font attributes
97 if ($this->_font->getItalic()) {
98 $grbit |= 0x02;
99 }
100 if ($this->_font->getStrikethrough()) {
101 $grbit |= 0x08;
102 }
103 if ($font_outline) {
104 $grbit |= 0x10;
105 }
106 if ($font_shadow) {
107 $grbit |= 0x20;
108 }
109
110 $data = pack("vvvvvCCCC",
111 $this->_font->getSize() * 20, // Fontsize (in twips)
112 $grbit,
113 $icv, // Colour
114 self::_mapBold($this->_font->getBold()), // Font weight
115 $sss, // Superscript/Subscript
116 self::_mapUnderline($this->_font->getUnderline()),
117 $bFamily,
118 $bCharSet,
119 $reserved
120 );
121 $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($this->_font->getName());
122
123 $length = strlen($data);
124 $header = pack("vv", $record, $length);
125
126 return($header . $data);
127 }
static getCharsetFromFontName($name)
Returns the associated charset for the font name.
Definition: Font.php:551
static UTF8toBIFF8UnicodeShort($value, $arrcRuns=array())
Converts a UTF-8 string into BIFF8 Unicode string data (8-bit string length) Writes the string using ...
Definition: String.php:434

References $_colorIndex, $data, $header, PHPExcel_Shared_Font\getCharsetFromFontName(), and PHPExcel_Shared_String\UTF8toBIFF8UnicodeShort().

+ Here is the call graph for this function:

Field Documentation

◆ $_colorIndex

PHPExcel_Writer_Excel5_Font::$_colorIndex
private

Definition at line 43 of file Font.php.

Referenced by writeFont().

◆ $_font

PHPExcel_Writer_Excel5_Font::$_font
private

Definition at line 50 of file Font.php.

◆ $_mapUnderline

PHPExcel_Writer_Excel5_Font::$_mapUnderline
staticprivate
Initial value:

Map of BIFF2-BIFF8 codes for underline styles array of int.

Definition at line 147 of file Font.php.


The documentation for this class was generated from the following file: