Add-On Font dump
Informations
Author:OlivierLicense: FPDF
Description
This script shows how to print all the characters from a font in a column layout. It displays Arial, Symbol and ZapfDingbats. Symbolic fonts can be useful because they contain a lot of interesting characters, such as bullets, arrows, stars, phones... For instance, chr(41) from ZapfDingbats is a mail envelope.Source
<?php
require('fpdf.php');
class PDF extends FPDF
{
protected $col = 0;
function SetCol($col)
{
// Set position on top of a column
$this->col = $col;
$this->SetLeftMargin(10+$col*40);
$this->SetY(25);
}
function AcceptPageBreak()
{
// Go to the next column
$this->SetCol($this->col+1);
return false;
}
function DumpFont($FontName)
{
$this->AddPage();
// Title
$this->SetFont('Arial', '', 16);
$this->Cell(0, 6, $FontName, 0, 1, 'C');
// Print all characters in columns
$this->SetCol(0);
for($i=32;$i<=255;$i++)
{
$this->SetFont('Arial', '', 14);
$this->Cell(12, 5.5, "$i : ");
$this->SetFont($FontName);
$this->Cell(0, 5.5, chr($i), 0, 1);
}
$this->SetCol(0);
}
}
$pdf = new PDF();
$pdf->DumpFont('Arial');
$pdf->DumpFont('Symbol');
$pdf->DumpFont('ZapfDingbats');
$pdf->Output();
?>