imagefontheight
PHP function
Edit on GitHub ✎
(PHP 4, PHP 5, PHP 7, PHP 8)
Get font height
Description
imagefontheight(GdFont|int $font): int
Returns the pixel height of a character in the specified font.
Parameters
Return Values
Returns the pixel height of the font.
Changelog
| Version | Description |
|---|
Examples
Using imagefontheight() on built-in fonts
php
<?php
echo 'Font height: ' . imagefontheight(4);
?>The above example will output something similar to:
output
Font height: 16Using imagefontheight() together with imageloadfont()
php
<?php
// Load a .gdf font
$font = imageloadfont('anonymous.gdf');
echo 'Font height: ' . imagefontheight($font);
?>The above example will output something similar to:
output
Font height: 43