makefont - <?php /* * Utility to generate font...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
<?php /******************************************************************************* * Utility to generate font definition files * * Version: 1.12 * * Date: 2003-12-30 * *******************************************************************************/ * function ReadMap($enc) { //Read a map file $file=dirname(__FILE__).'/'.strtolower($enc).'.map'; $a=file($file); if(empty($a)) die('<B>Error:</B> encoding not found: '.$enc); $cc2gn=array(); foreach($a as $l) { if($l{0}=='!') { $e=preg_split('/[ \\t]+/',chop($l)); $cc=hexdec(substr($e[0],1)); $gn=$e[2]; $cc2gn[$cc]=$gn; } } for($i=0;$i<=255;$i++) if(!isset($cc2gn[$i])) $cc2gn[$i]='.notdef'; return $cc2gn; } { //Read a font metric file $a=file($file); if(empty($a)) die('File not found'); $widths=array(); $fm=array(); $fix=array('Edot'=>'Edotaccent','edot'=>'edotaccent','Idot'=>'Idotaccent','Zdot'=>' Zdotaccent','zdot'=>'zdotaccent', 'Odblacute'=>'Ohungarumlaut','odblacute'=>'ohungarumlaut','Udblacute'=> 'Uhungarumlaut','udblacute'=>'uhungarumlaut', 'Gcedilla'=>'Gcommaaccent','gcedilla'=>'gcommaaccent','Kcedilla'=>'Kcom maaccent','kcedilla'=>'kcommaaccent', 'Lcedilla'=>'Lcommaaccent','lcedilla'=>'lcommaaccent','Ncedilla'=>'Ncom maaccent','ncedilla'=>'ncommaaccent', 'Rcedilla'=>'Rcommaaccent','rcedilla'=>'rcommaaccent','Scedilla'=>'Scom maaccent','scedilla'=>'scommaaccent', 'Tcedilla'=>'Tcommaaccent','tcedilla'=>'tcommaaccent','Dslash'=>'Dcroat ','dslash'=>'dcroat','Dmacron'=>'Dcroat','dmacron'=>'dcroat', 'combininggraveaccent'=>'gravecomb','combininghookabove'=>'hookabovecom b','combiningtildeaccent'=>'tildecomb', 'combiningacuteaccent'=>'acutecomb','combiningdotbelow'=>'dotbelowcomb' ,'dongsign'=>'dong'); foreach($a as $l) { $e=explode(' ',chop($l));
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
if(count($e)<2) continue; $code=$e[0]; $param=$e[1]; if($code=='C') { //Character metrics $cc=(int)$e[1]; $w=$e[4]; $gn=$e[7]; if(substr($gn,-4)=='20AC') $gn='Euro'; if(isset($fix[$gn])) { //Fix incorrect glyph name foreach($map as $c=>$n) if($n==$fix[$gn]) $map[$c]=$gn; } if(empty($map)) { //Symbolic font: use built-in encoding $widths[$cc]=$w; } else { $widths[$gn]=$w; if($gn=='X') $fm['CapXHeight']=$e[13]; } if($gn=='.notdef') $fm['MissingWidth']=$w; } elseif($code=='FontName')
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/14/2009 for the course ITP 204X taught by Professor Dent during the Spring '08 term at USC.

Page1 / 7

makefont - &lt;?php /* * Utility to generate font...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online