class Font (View source)

Class with Font related methods.

Methods

array
getCharLists()

Get list with characters and the corresponding width modifiers.

int
getStringWidth(string $text, string $font, int $fontSize, array|null $charLists = null)

Get width of string/text

Details

array getCharLists()

Get list with characters and the corresponding width modifiers.

Return Value

array

with characters and corresponding width modifier

int getStringWidth(string $text, string $font, int $fontSize, array|null $charLists = null)

Get width of string/text

The text element width is calculated depending on font name and font size.

Parameters

string $text

string of which the width will be calculated

string $font

name of the font like Arial,sans-serif etc

int $fontSize

size of font

array|null $charLists

list of characters and their width modifiers

Return Value

int

width of the text