PHP 4, PHP 5, PHP 7, PHP 8
imagefontwidth - Get font width
Code Examples

imagefontwidth( GdFont|int$font ): int

Returns the pixel width of a character in font.



Can be 1, 2, 3, 4, 5 for built-in fonts in latin2 encoding (where higher numbers corresponding to larger fonts) or GdFont instance, returned by imageloadfont.

Return Values

Returns the pixel width of the font.


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

Related Functions

Example of imagefontwidth

Show all examples for imagefontwidth

PHP Version:

Function imagefontwidth:

Image Processing and GD Functions

Most used PHP functions