| Methods |
public
|
__construct(Canvas $canvas, Options $options)
Class initialization
|
#
|
public
|
save_font_families()
|
#
|
public
|
saveFontFamilies()
Saves the stored font family cache
Saves the stored font family cache
The name and location of the cache file are determined by {@link
FontMetrics::USER_FONTS_FILE}. This file should be writable by the
webserver process.
|
#
|
public
|
load_font_families()
|
#
|
public
|
loadFontFamilies()
Loads the stored font family cache
Loads the stored font family cache
|
#
|
private
|
loadFontFamiliesLegacy()
|
#
|
public
|
register_font(array $style, string $remote_file, resource $context = null): bool
|
#
|
public
|
registerFont(array $style, string $remoteFile, resource $context = null): bool
|
#
|
public
|
get_text_width($text, $font, $size, float $word_spacing = 0.0, float $char_spacing = 0.0): float
|
#
|
public
|
getTextWidth(string $text, string $font, float $size, float $wordSpacing = 0.0, float $charSpacing = 0.0): float
Calculates text size, in points
Calculates text size, in points
Parameters
| $text |
The text to be sized
|
| $font |
The font file to use
|
| $size |
The font size, in points
|
| $wordSpacing |
Word spacing, if any
|
| $charSpacing |
Char spacing, if any
|
|
#
|
public
|
get_font_height($font, $size): float
|
#
|
public
|
getFontHeight(string $font, float $size): float
Calculates font height, in points
Calculates font height, in points
Parameters
| $font |
The font file to use
|
| $size |
The font size, in points
|
|
#
|
public
|
getFontBaseline(string $font, float $size): float
Calculates font baseline, in points
Calculates font baseline, in points
Parameters
| $font |
The font file to use
|
| $size |
The font size, in points
|
|
#
|
public
|
get_font($family_raw, string $subtype_raw = "normal"): string
|
#
|
public
|
getFont(string|null $familyRaw, string $subtypeRaw = "normal"): string|null
Resolves a font family & subtype into an actual font file
Subtype can be one of 'normal', 'bold', 'italic' or 'bold…
Resolves a font family & subtype into an actual font file
Subtype can be one of 'normal', 'bold', 'italic' or 'bold_italic'. If
the particular font family has no suitable font file, the default font
({@link Options::defaultFont}) is used. The font file returned
is the absolute pathname to the font file on the system.
|
#
|
public
|
get_family($family): null|string
|
#
|
public
|
getFamily(string $family): null|string
|
#
|
public
|
get_type($type): string
|
#
|
public
|
getType(string $type): string
|
#
|
public
|
get_font_families(): array
|
#
|
public
|
getFontFamilies(): array
Returns the current font lookup table
Returns the current font lookup table
|
#
|
public
|
setFontFamilies(): array
Convert loaded fonts to font lookup table
Convert loaded fonts to font lookup table
|
#
|
public
|
set_font_family(string $fontname, mixed $entry)
|
#
|
public
|
setFontFamily(string $fontname, mixed $entry)
|
#
|
public
|
getUserFontsFilePath(): string
|
#
|
public
|
setOptions(Options $options): $this
|
#
|
public
|
getOptions(): Options
|
#
|
public
|
setCanvas(Canvas $canvas): $this
|
#
|
public
|
getCanvas(): Canvas
|
#
|