imagefontheight

(PHP 4, PHP 5, PHP 7, PHP 8)

imagefontheightGet font height

Descrizione

imagefontheight(GdFont|int $font): int

Returns the pixel height of a character in the specified font.

Elenco dei parametri

font

Può essere 1, 2, 3, 4, 5 per i font interni con codifica latin2 (dove numeri più alti corrispondono a font più grandi) o qualsiasi identificatore di font registrato con imageloadfont().

Valori restituiti

Returns the pixel height of the font.

Log delle modifiche

Versione Descrizione
8.1.0 The font parameter now accepts both an GdFont instance and an int; previously only int was accepted.

Esempi

Example #1 Using imagefontheight() on built-in fonts

<?php
echo 'Font height: ' . imagefontheight(4);
?>

Il precedente esempio visualizzerà qualcosa simile a:

Font height: 16

Example #2 Using imagefontheight() together with imageloadfont()

<?php
// Load a .gdf font
$font = imageloadfont('anonymous.gdf');

echo
'Font height: ' . imagefontheight($font);
?>

Il precedente esempio visualizzerà qualcosa simile a:

Font height: 43

Vedere anche: