array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'function.imagefontheight.php', 1 => 'imagefontheight', ), 'up' => array ( 0 => 'ref.image.php', 1 => 'Funções de GD e Image', ), 'prev' => array ( 0 => 'function.imageflip.php', 1 => 'imageflip', ), 'next' => array ( 0 => 'function.imagefontwidth.php', 1 => 'imagefontwidth', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'pt_BR', 'path' => 'reference/image/functions/imagefontheight.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
imagefontheight — Obtém a altura da fonte
Retorna a altura da fonte, em pixels, de um caractere em determinada fonte.
font
Pode ser 1, 2, 3, 4, 5 para as fontes nativas na codificação latin2 (onde números maiores correspondem a fontes maiores) ou uma instância de GdFont, retornada por imageloadfont().
Retorna a altura da fonte em pixels.
Versão | Descrição |
---|---|
8.1.0 |
O parâmetro font agora aceita uma instância de GdFont
ou um int; anteriormente, apenas int era aceito.
|
Exemplo #1 Usando imagefontheight() em fontes internas
<?php
echo 'Altura da fonte: ' . imagefontheight(4);
?>
O exemplo acima produzirá algo semelhante a:
Altura da fonte: 16
Exemplo #2 Usando imagefontheight() junto com imageloadfont()
<?php
// Carrega uma fonte .gdf
$font = imageloadfont('anonymous.gdf');
echo 'Altura da fonte: ' . imagefontheight($font);
?>
O exemplo acima produzirá algo semelhante a:
Altura da fonte: 43