If you have added fonts to a previous version of mDPF and want to create the extra files needed for embedded subsets - and you still have the [fontname].ufm and [fontname].t1a files: copy the .ufm and .t1a files to this directory and go directly to execute Step 7
'; echo 'Otherwise:
'; echo 'Copy the [fontname].ttf files to this current directory
'; echo 'Rename the .ttf files if necessary:
'; echo 'Only characters a-z (lowercase only), 0-9 and _ (underscore)
'; echo 'Style variants should be fontname.ttf fontnameb.ttf fontnamei.ttf fontnamebi.ttf
'; echo 'If you only want Unicode TrueType font files, go directly to execute Step 5
'; echo 'Otherwise go to Step 1 - Unibyte (codepage) font files - A
'; } // STEP 1 - else if ($step==1) { echo 'The next step will create and execute a file "makefonts.bat" in the current directory
'; echo 'Execute and go to Step 2
'; } // STEP 2 - else if ($step==2) { makebatlist('C'); exec('makefonts.bat'); echo 'Check that you have the following files in the current directory (for each of your original .ttf files):
'; echo 'If these files are not present:
'; echo 'Ensure that the file "ttf2pt1.exe" is in the current directory
'; echo 'Execute/Run the batch file "makefonts.bat" - (double click on the file in Windows)
'; echo 'When the files are there go to step 3.
'; echo 'The next step will generate the files for mPDF in the current directory
'; echo 'Execute Step 3
'; } // STEP 3 - else if ($step==3) { $ff = scandir('./'); foreach($ff AS $f) { if (substr($f,-4,4)=='.ttf') { $file = substr($f,0,(strlen($f)-4)); foreach($cpages AS $cpage) { $success = false; if ($cpage =='win-1252') { $success = MakeFont($file .'.pfb', $file .'.afm', 'win-1252'); if ($success) { @unlink($file .'.pfb'); @unlink($file .'.afm'); } } else { $success = MakeFont($file .'-'.$cpage.'.pfb', $file .'-'.$cpage.'.afm', $cpage); if ($success) { @unlink($file .'-'.$cpage.'.pfb'); @unlink($file .'-'.$cpage.'.afm'); } } } } } echo 'When you have done that, check you have the following files (for each of your original .ttf files):
'; echo 'Go to Step 4
'; } // STEP 4 - else if ($step==4) { echo 'Copy all of the .php and .z files to the folder [path to mpdf]/mpdf/fonts/
'; echo '(This link may do the job for you. Note: This will not overwrite files, so you may need to delete files first from the [path to mpdf]/mpdf/fonts/ folder)
'; echo 'Add the font names to config_fonts.php (and if appropriate to config_cp.php)
'; echo 'You have now completed font file generation for the codepage Type 1 font files.
'; echo 'If you do not want to create the Unicode TrueType font files you can stop here, or '; echo 'optionally you can tidy up which will delete all the font files except your .ttf files from the current directory.
'; echo 'Now we will create the Unicode TrueType font files.
'; echo 'NB This will also delete any remaining .php and .z files from the current directory.
'; echo 'To continue with Unicode TrueType font files, execute Step 5
'; } // STEP 5 - else if ($step==5) { // First get rid of any .php and .z files left $ff = scandir('./'); foreach($ff AS $f) { if (substr($f,-4,4)=='.ttf') { $file = substr($f,0,(strlen($f)-4)); foreach($cpages AS $cpage) { if ($cpage =='win-1252') { @unlink($file .'.z'); @unlink($file .'.php'); } else { @unlink($file .'-'.$cpage.'.z'); @unlink($file .'-'.$cpage.'.php'); } } } } makebatlist('U'); exec('makefonts.bat'); echo 'Check that the following files have been created in the current directory (for each of your original .ttf files):
'; echo 'If these files are not present:
'; echo 'Ensure that the file "ttf2ufm.exe" is in the current directory
'; echo 'Execute/Run the batch file "makefonts.bat" - (double click on the file in Windows)
'; echo 'When the files are there, go on to step 6.
'; echo 'The next step will generate the core files for mPDF in the current directory
'; echo 'Execute Step 6
'; } // STEP 6 - else if ($step==6) { $ff = scandir('./'); foreach($ff AS $f) { if (substr($f,-4,4)=='.ttf') { $file = substr($f,0,(strlen($f)-4)); MakeFontTTF($file .'.ttf', $file.'.ufm'); @unlink($file .'.afm'); } } echo 'When you have done that, check you have the following files (for each of your original .ttf files):
'; echo 'NB The .afm files have been deleted (but .t1a and .ufm should remain).
'; echo 'The next step will generate the additional files for embedded subsets
'; echo 'Execute Step 7 (NB This may take several minutes for large font files; you may need to increase the time-limit or memory-limits - see the top of the /makefont/makefonts.php file)
'; } // STEP 7 - Create .uni2gn.php files, and .dat / .dat.php else if ($step==7) { $cs_commands = array( 'abs' => array(12, 9 ), 'add' => array(12, 10 ), 'and' => array(12, 3 ), 'blend' => array(16, -1 ), 'callgsubr' => array(29, -1 ), 'callothersubr' => array(12, 16 ), 'callsubr' => array(10, -1 ), 'closepath' => array(9, -1 ), 'cntrmask' => array(20, -1 ), 'div' => array(12, 12 ), 'dotsection' => array(12, 0 ), 'drop' => array(12, 18 ), 'dup' => array(12, 27 ), 'endchar' => array(14, -1 ), 'eq' => array(12, 15 ), 'error' => array(0, -1 ), 'escape' => array(12, -1 ), 'exch' => array(12, 28 ), 'flex' => array(12, 35 ), 'flex1' => array(12, 37 ), 'get' => array(12, 21 ), 'hflex' => array(12, 34 ), 'hflex1' => array(12, 36 ), 'hhcurveto' => array(27, -1 ), 'hintmask' => array(19, -1 ), 'hlineto' => array(6, -1 ), 'hmoveto' => array(22, -1 ), 'hsbw' => array(13, -1 ), 'hstem' => array(1, -1 ), 'hstem3' => array(12, 2 ), 'hstemhm' => array(18, -1 ), 'hvcurveto' => array(31, -1 ), 'ifelse' => array(12, 22 ), 'index' => array(12, 29 ), 'load' => array(12, 13 ), 'mul' => array(12, 24 ), 'neg' => array(12, 14 ), 'not' => array(12, 5 ), 'or' => array(12, 4 ), 'pop' => array(12, 17 ), 'put' => array(12, 20 ), 'random' => array(12, 23 ), 'rcurveline' => array(24, -1 ), 'return' => array(11, -1 ), 'rlinecurve' => array(25, -1 ), 'rlineto' => array(5, -1 ), 'rmoveto' => array(21, -1 ), 'roll' => array(12, 30 ), 'rrcurveto' => array(8, -1 ), 'sbw' => array(12, 7 ), 'seac' => array(12, 6 ), 'setcurrentpoint' => array(12, 33 ), 'sqrt' => array(12, 26 ), 'store' => array(12, 8 ), 'sub' => array(12, 11 ), 'vhcurveto' => array(30, -1 ), 'vlineto' => array(7, -1 ), 'vmoveto' => array(4, -1 ), 'vstem' => array(3, -1 ), 'vstem3' => array(12, 1 ), 'vstemhm' => array(23, -1 ), 'vvcurveto' => array(26, -1 ) ); $lenIV = 4; $cs_start = 'RD'; // Read uni2gn [code-point to glyph-name] from .ufm file if exists $ff = scandir('./'); foreach($ff AS $f) { if (substr($f,-4,4)=='.ufm') { $file = substr($f,0,(strpos($f,'.'))); if (!file_exists($file.'.t1a')) { die("You must have both .ufm and .t1a files in the current directory ('.$f.')"); } $uni2gn = array(); $a=file($file.'.ufm'); if(empty($a)) { die('ufm file found but with error'); } foreach($a as $l) { $e=explode(' ',chop($l)); if(count($e)<2) { continue; } if($e[0]=='U') { $cc=(int)$e[1]; if ($cc != -1) { $uni2gn[$cc] = $e[7]; } } } $s = 'uni2gn = '.var_export($uni2gn, true).'; ?>'; file_put_contents($file.'.uni2gn.php', $s); // echo "File created: ".$file.'.uni2gn.php'."When you have done that, check you have the following files (for each of your original .ttf files):
'; echo 'If you have only run Step 7 to update previously added fonts, now just copy these files to your /unifont/ folder
'; echo 'Go to Step 8
'; } // STEP 8 - else if ($step==8) { echo 'Copy all of the following files to the folder [path to mpdf]/mpdf/unifont/
'; echo '(6 for each font/style)
'; echo '(This link should do the job for you. Note: This will not overwrite files, so you may need to delete files first from the [path to mpdf]/mpdf/unifont/ folder).
'; echo 'Add the font names to config_fonts.php (and if appropriate to config_cp.php)
'; echo 'Otherwise you\'re all done!
'; echo 'Optionally you can tidy up which will delete all the font files except your .ttf files from the current directory.
'; } // STEP 9 - else if ($step==9) { $ff = scandir('./'); foreach($ff AS $f) { if (substr($f,-4,4)=='.ttf') { $file = substr($f,0,(strlen($f)-4)); @unlink($file .'.afm'); @unlink($file .'.ufm'); @unlink($file .'.t1a'); @unlink($file .'.php'); @unlink($file .'.z'); @unlink($file .'.ctg.z'); @unlink($file .'.dat'); @unlink($file .'.dat.php'); @unlink($file .'.uni2gn.php'); @unlink('makefonts.bat'); foreach($cpages AS $cpage) { if ($cpage =='win-1252') { @unlink($file .'.z'); @unlink($file .'.php'); } else { @unlink($file .'-'.$cpage.'.z'); @unlink($file .'-'.$cpage.'.php'); } } } } echo 'All done!
'; } echo '