Font dump

This script shows how to print all the characters of a font in a column layout

Informations

Author: Olivier
License: FPDF

Description

This script shows how to print all the characters of a font in a column layout. It displays the Arial, Symbol and ZapfDingbats fonts. This can be useful, because they contain a lot of interesting characters, such as bullets, arrows, stars, phones... For instance, chr(41) of ZapfDingbats is a mail envelope.

Note: Firefox's built-in PDF viewer fails to display the ZapfDingbats font correctly.

Source

<?php require('fpdf.php'); class PDF extends FPDF { var $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(); ?>
View the result here.

Download

ZIP | TGZ

Quelle

http://www.fpdf.org/en/script/script4.php, zuletzt abgerufen 02.10.2016 15:01