Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

imagefontwidth

Description

The imagefontwidth of Image for PHP get font width.

Syntax

imagefontwidth(
    GdFont|int $font
): int

Parameters

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

Returns the pixel width of the font.

Examples

1 · font · 1

<?

$font = 1;

$return = imagefontwidth($font);
    
var_export($return);

?>
5

2 · font · 2

<?

$font = 2;

$return = imagefontwidth($font);
    
var_export($return);

?>
6

3 · font · 3

<?

$font = 3;

$return = imagefontwidth($font);
    
var_export($return);

?>
7

4 · font · 4

<?

$font = 4;

$return = imagefontwidth($font);
    
var_export($return);

?>
8

5 · font · 5

<?

$font = 5;

$return = imagefontwidth($font);
    
var_export($return);

?>
9

6 · font · imageloadfont

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/gdf/1.gdf';
$font = imageloadfont($filename);

$return = imagefontwidth($font);
    
var_export($return);

?>
8
HomeMenu