imageloadfont 


gd apg

LOAD a user-defined bitmap font.





Letter fonts used in this tutorial:

   * GDF fonts  !    Vera ttf fonts  !


* To be used in this exercise.

* Don't forget to save the fonts in folders visible to the proposed exercises.
   Like example, this tutorial uses gdf and ttf, respectively.


* If you have other fonts, you can use them as long as they are usable.

* Solve, therefore, the exercises proposed.





The font identifier which is always bigger than 5 to avoid conflicts with built-in fonts or FALSE on errors.



<?php

GdImage
|false imageloadfont string $filename )

where,

$filename The font binary file

?>

  $filename   


The font file format is currently binary and architecture dependent.



  1 EXERCISE   

<?php

echo 'PHP VERSION: ' PHP_VERSION '<br><br>';

define('P2GDF''gdf/');

$gdf_font_name01 "04b.gdf";

$gdf_fnt01 imageloadfont(P2GDF $gdf_font_name01);
   
echo 
"Font identifier:<br>";
var_dump($gdf_fnt01);

?>

  2 EXERCISE   

<?php 

echo 'PHP VERSION: ' PHP_VERSION '<br><br>';

$gdf_font_name02 "gdf/andale12.gdf"

$gdf_fnt02 imageloadfont($gdf_font_name02); 
       
echo 
"Font identifier:<br>";
var_dump($gdf_fnt02);

?>

  3 EXERCISE   

<?php

echo 'PHP VERSION: ' PHP_VERSION '<br><br>';

error_reporting(0);

$var getcwd();

echo 
$var '<br><br>';

$ttf_font_name03 $var "/ttf/Vera.ttf";
// TrueType font 

echo $ttf_font_name03 '<br><br>';

$ttf_fnt03 imageloadfont($ttf_font_name03); 
      
var_dump($ttf_fnt03); 

/* - - - - - - - - - - - - - - - - - - - - - - - 
   Errors like this one occur whenever trying 
   to load TrueType font

   The Warning verified when running this 
   exercise proves that this function 
   should only be used for user-defined 
   bitmap fonts, never for ttf fonts
   - - - - - - - - - - - - - - - - - - - - - - - - */

?>

  4 EXERCISE   

<?php

echo 'PHP VERSION: ' PHP_VERSION '<br><br>';

error_reporting(0);

var_dumpimageloadfont('\src\invalidfile.font') );

?>