\src\Utils\Graphics2D\Shapes\Styles\TextStyle.inc

Show: inherited
Table of Contents

\Utils\Graphics2D\Shapes\Styles\TextStyle

Package: Default

This class implements a style for texts.

Implements
\Utils\Graphics2D\Shapes\Styles\IStyle

Constants

Constant  LINE_PADDING = 3

constant additional padding for calculating the line height with a given font size (always plus 3)

Properties

Propertyprivate\Utils\Color\Color  $color= 'null'

the font color

Default valuenullDetails
Type
\Utils\Color\Color
Propertyprivatestring  $family= ''Times''

the name of the font family

Default value'Times'Details
Type
string
Propertyprivateint  $size= ''12''

the font size in pixel

Default value'12'Details
Type
int

Methods

methodpublic__construct( string $family = 'Times', int $size = 12, \Utils\Color\Color $color = null ) : void

This acts as the constructor of the class.

Parameters
Name Type Description
$family string

the name of the font family

$size int

the font size in pixel

$color \Utils\Color\Color

the font color

methodpublic__get( string $memberName ) : mixed

This method is a magic getter method for the class.

Parameters
Name Type Description
$memberName string

the name of the member to get

Returns
Type Description
mixed the value of the member
Details
Todo
replace this with Trait in PHP 5.4  
methodpublic__set( string $memberName, mixed $value ) : void

This method is a magic setter method for the class.

Parameters
Name Type Description
$memberName string

the name of the member to get

$value mixed

the new value of the member

Details
Todo
replace this with Trait in PHP 5.4  
methodpublic__toString( ) : string

This method returns a string representation of the text style.

Returns
Type Description
string
methodpublicgetHash( ) : string

This method returns a "hash" of this TextStyle.

Returns
Type Description
string a "hash" of this TextStyle, consisting of the concatination of the fontFamily and size members of this TextStyle
methodpublicgetLineHeight( ) : int

This method returns the line height for this TextStyle.

Returns
Type Description
int the line height for this TextStyle in pixels
methodpublicpixelToPoint( int $pixel ) : float
static

This method converts from pixel to points unit.

Parameters
Name Type Description
$pixel int

the value in pixels

Returns
Type Description
float the value in points
methodpublictoCssClass( string $className ) : string

This method converts this TextStyle into a CSS class definition, with the given class name.

Parameters
Name Type Description
$className string

the class name of the CSS class definition

Returns
Type Description
string a CSS class definition with the given class name of this TextStlye
Documentation was generated by DocBlox 0.15.1.