当前位置: 首页>>代码示例>>PHP>>正文


PHP MakeFont函数代码示例

本文整理汇总了PHP中MakeFont函数的典型用法代码示例。如果您正苦于以下问题:PHP MakeFont函数的具体用法?PHP MakeFont怎么用?PHP MakeFont使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了MakeFont函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addptext

 private function addptext($styleconf, $text, $posx = null, $posy = null, $width = 0, $height = 0)
 {
     static $cfonts = array();
     $font = $this->conf[$styleconf . '_font'];
     $size = isset($this->conf[$styleconf . '_size']) ? $this->conf[$styleconf . '_size'] : 10;
     $style = isset($this->conf[$styleconf . '_style']) ? $this->conf[$styleconf . '_style'] : '';
     $color = isset($this->conf[$styleconf . '_color']) ? $this->conf[$styleconf . '_color'] : '#000000';
     $height = isset($this->conf[$styleconf . '_height']) ? $this->conf[$styleconf . '_height'] : $height;
     $text = utf8_decode($text);
     if (!is_file(FPDF_FONTPATH . $font . '.php')) {
         ob_start();
         MakeFont(FPDF_FONTPATH . $font . '.ttf');
         file_put_contents(FPDF_FONTPATH . $font . '.log', ob_get_contents());
         ob_end_clean();
     }
     if (!isset($cfonts[$font])) {
         $cfonts[$font] = $this->AddFont($font, $style, $font . '.php');
     }
     $this->SetFont($font, $style, $size);
     $this->colordecode($color, $comp);
     $this->SetTextColor($comp[0], $comp[1], $comp[2]);
     if ($posx !== null && $posy !== null) {
         $this->SetXY($posx, $posy);
         $this->Cell($width, $height, $text, $this->border);
     } else {
         $this->Write($height, $text);
     }
 }
开发者ID:bontiv,项目名称:intrateb,代码行数:28,代码来源:genserie.php

示例2: getFile

function getFile()
{
    if (isset($_FILES['ttf'])) {
        // get font file
        $tmp = $_FILES['ttf']['tmp_name'];
        $RESULT[] = '$tmp_name: ' . $tmp;
        $ttf = $_FILES['ttf']['name'];
        $RESULT[] = '$ttf: ' . $ttf;
        $a = explode('.', $ttf);
        if (strtolower($a[1]) != 'ttf') {
            $RESULT[] = 'NOT TTF FILE';
        }
        //die('File is not a .ttf');}
        if (!move_uploaded_file($tmp, $ttf)) {
            $RESULT[] = 'ERROR IN UPLOAD';
        }
        //die('Error in upload');
        $fontname = $_REQUEST['fontname'];
        if (empty($fontname)) {
            $fontname = $a[0];
        }
        $RESULT[] = 'FONT NAME: ' . $fontname;
        // AFM generation
        $RESULT[] = "ttf2pt1.exe -a " . $ttf . " " . $fontname;
        system("ttf2pt1.exe -a " . $ttf . " " . $fontname);
        // MakeFont call
        //$RESULT[] = 'MAKE FONT CALL ';
        //return $RESULT;
        MakeFont($ttf, "{$fontname}.afm", $_REQUEST['enc']);
        copy("{$fontname}.php", "../{$fontname}.php");
        unlink("{$fontname}.php");
        if (file_exists("{$fontname}.z")) {
            copy("{$fontname}.z", "../{$fontname}.z");
            unlink("{$fontname}.z");
        } else {
            copy($ttf, "../{$ttf}");
        }
        unlink("{$fontname}.afm");
        unlink("{$fontname}.t1a");
        unlink($ttf);
        echo "<script language='javascript'>alert('Font processed');\n";
        echo "window.location.href='addfont.php';</script>";
        //exit;
    }
    return $RESULT;
}
开发者ID:sigmadesarrollo,项目名称:logisoft,代码行数:46,代码来源:addfontttf.php

示例3: MakeFont

<?php

include 'makefont.php';
MakeFont('calibrib.ttf', 'calibrib.afm');
开发者ID:ArlingtonHouse,项目名称:fpdf-symfony2,代码行数:4,代码来源:call_makefont.php

示例4: MakeFont

<?php

require 'makefont/makefont.php';
MakeFont('FRADMCN.TTF', 'franklin_gothic.afm');
开发者ID:rckarchitects,项目名称:cornerstone-rcka,代码行数:4,代码来源:makefont.php

示例5: exit

#!/usr/bin/env php
<?php 
if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
    require 'make-fpdf-fonts/makefont.php';
    $usage = <<<EOD
  Usage:    
  makefont /path/to/fonts/root
EOD;
    if ($argc < 2) {
        exit($usage);
    }
    $fonts_path = realpath($argv[1]);
    if (!is_dir($fonts_path)) {
        exit($fonts_path . ' does not appear to be a directory');
    }
    $save_path = $fonts_path . '/metrics';
    if (!is_dir($save_path)) {
        mkdir($save_path);
    }
    foreach (glob($fonts_path . '/*/*ttf') as $font) {
        system(implode(' ', array('ttf2pt1 -a', escapeshellarg($font), escapeshellarg(pathinfo($font, PATHINFO_FILENAME)))));
        // no control over output directories is provided by these files by default, so we
        // get to do a rename dance!
        rename(pathinfo($font, PATHINFO_FILENAME) . '.afm', pathinfo($font, PATHINFO_DIRNAME) . '/' . pathinfo($font, PATHINFO_FILENAME) . '.afm');
        rename(pathinfo($font, PATHINFO_FILENAME) . '.t1a', pathinfo($font, PATHINFO_DIRNAME) . '/' . pathinfo($font, PATHINFO_FILENAME) . '.t1a');
        MakeFont($font, str_replace('ttf', 'afm', $font), 'ISO-8859-1');
        rename(pathinfo($font, PATHINFO_FILENAME) . '.php', $save_path . '/' . pathinfo($font, PATHINFO_FILENAME) . '.php');
        rename(pathinfo($font, PATHINFO_FILENAME) . '.z', $save_path . '/' . pathinfo($font, PATHINFO_FILENAME) . '.z');
    }
}
开发者ID:jdodds,项目名称:fonts-to-metrics,代码行数:30,代码来源:make-fpdf-fonts.php

示例6: addFont

 /**
  * This method add a font to SugarCRM from a font file and a metric file using MakeFont()
  * @param $font_file string
  * @param $metric_file string
  * @param $embedded boolean
  * @param $encoding_table string
  * @param $patch array
  * @param $cid_info string
  * @param $style string
  * @return boolean true on success
  * @see MakeFont() in K_PATH_FONTS/utils
  */
 public function addFont($font_file, $metric_file, $embedded = true, $encoding_table = 'cp1252', $patch = array(), $cid_info = "", $style = "regular")
 {
     global $current_user;
     if (!is_admin($current_user)) {
         sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
     }
     $error = false;
     $oldStr = ob_get_contents();
     ob_clean();
     require_once "include/tcpdf/fonts/utils/makefont.php";
     $filename = MakeFont($font_file, $metric_file, $embedded, $encoding_table, $patch, $cid_info);
     unlink($font_file);
     unlink($metric_file);
     $this->log = ob_get_contents();
     ob_clean();
     echo $oldStr;
     if (empty($filename)) {
         array_push($this->errors, translate("ERR_FONT_MAKEFONT", "Configurator"));
         $error = true;
     } else {
         require_once "include/utils/file_utils.php";
         $this->filename = basename($filename . ".php");
         if (!$this->loadFontFile()) {
             if (!mkdir_recursive(K_PATH_CUSTOM_FONTS)) {
                 array_push($this->errors, "Error : Impossible to create the custom font directory.");
                 $error = true;
             } else {
                 $styleLetter = "";
                 switch ($style) {
                     case "italic":
                         $styleLetter = "i";
                         break;
                     case "bold":
                         $styleLetter = "b";
                         break;
                     case "boldItalic":
                         $styleLetter = "bi";
                         break;
                     default:
                         $styleLetter = "";
                 }
                 sugar_rename($filename . ".php", K_PATH_CUSTOM_FONTS . basename($filename . $styleLetter . ".php"));
                 $this->log .= "\n" . translate("LBL_FONT_MOVE_DEFFILE", "Configurator") . K_PATH_CUSTOM_FONTS . basename($filename . $styleLetter . ".php");
                 if (file_exists($filename . ".z")) {
                     sugar_rename($filename . ".z", K_PATH_CUSTOM_FONTS . basename($filename . $styleLetter . ".z"));
                     $this->log .= "\n" . translate("LBL_FONT_MOVE_FILE", "Configurator") . K_PATH_CUSTOM_FONTS . basename($filename . $styleLetter . ".z");
                 }
                 if (file_exists($filename . ".ctg.z")) {
                     sugar_rename($filename . ".ctg.z", K_PATH_CUSTOM_FONTS . basename($filename . $styleLetter . ".ctg.z"));
                     $this->log .= "\n" . translate("LBL_FONT_MOVE_FILE", "Configurator") . K_PATH_CUSTOM_FONTS . basename($filename . $styleLetter . ".ctg.z");
                 }
             }
         } else {
             array_push($this->errors, "\n" . translate("ERR_FONT_ALREADY_EXIST", "Configurator"));
             $error = true;
         }
         if ($error) {
             if (file_exists($filename . ".php")) {
                 unlink($filename . ".php");
             }
             if (file_exists($filename . ".ctg.z")) {
                 unlink($filename . ".ctg.z");
             }
             if (file_exists($filename . ".z")) {
                 unlink($filename . ".z");
             }
         }
     }
     $this->clearCachedFile();
     return $error;
 }
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:83,代码来源:FontManager.php

示例7: MakeFont

<?php

//Generation of font definition file for tutorial 7
require 'font/makefont/makefont.php';
MakeFont('verdana.ttf', 'verdana.afm');
开发者ID:hardikk,项目名称:HNH,代码行数:5,代码来源:makefont.php

示例8: unlink

    if (is_file($name . $type . '.php')) {
        unlink($name . $type . '.php');
    }
}
// conversion au format afm
echo ' Generate AFM file' . "\n";
foreach ($types as $type) {
    echo '  ' . $name . ' ' . $type . "\n";
    exec('ttf2pt1.exe -a ' . $name . $type . '.ttf ' . $name . $type, $output);
}
// generation du fichier de definition
echo ' Generate PHP file in ' . $enc . ' with patch : ' . print_r($enc, true) . "\n";
foreach ($types as $type) {
    echo '  ' . $name . ' ' . $type . "\n";
    echo '<div style="border: solid 1px black; margin-left: 15px; width: 600px;">';
    MakeFont($name . $type . '.ttf', $name . $type . '.afm', $enc, $patch);
    echo '</div>';
}
// nettoyage des fichiers inutiles
echo ' Delete and move files' . "\n";
foreach ($types as $type) {
    echo '  ' . $name . ' ' . $type . "\n";
    if (is_file($name . $type . '.afm')) {
        unlink($name . $type . '.afm');
    }
    if (is_file($name . $type . '.t1a')) {
        unlink($name . $type . '.t1a');
    }
    if (is_file('../_fpdf/font/' . $name . $type . '.z')) {
        unlink('../_fpdf/font/' . $name . $type . '.z');
    }
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:31,代码来源:index.php

示例9: SaveToFile

        if (function_exists('gzcompress')) {
            $file = $basename . '.z';
            SaveToFile($file, gzcompress($info['Data']), 'b');
            $info['File'] = $file;
            Message('Font file compressed: ' . $file);
        } else {
            $info['File'] = basename($fontfile);
            Notice('Font file could not be compressed (zlib extension not available)');
        }
    }
    MakeDefinitionFile($basename . '.php', $type, $enc, $embed, $map, $info);
    Message('Font definition file generated: ' . $basename . '.php');
}
if (PHP_SAPI == 'cli') {
    // Command-line interface
    if ($argc == 1) {
        die("Usage: php makefont.php fontfile [enc] [embed]\n");
    }
    $fontfile = $argv[1];
    if ($argc >= 3) {
        $enc = $argv[2];
    } else {
        $enc = 'cp1252';
    }
    if ($argc >= 4) {
        $embed = $argv[3] == 'true' || $argv[3] == '1';
    } else {
        $embed = true;
    }
    MakeFont($fontfile, $enc, $embed);
}
开发者ID:Grasia,项目名称:bolotweet,代码行数:31,代码来源:makefont.php

示例10: MakeFont

<?php

include 'makefont/makefont.php';
MakeFont('uhvb8v.pfb', 'uhvb8v.afm', 'viscii');
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:4,代码来源:make_uhvb8v.php

示例11: _LoadFont

 function _LoadFont($fontkey, $family, $encoding)
 {
     if (!isset($this->fonts[$fontkey])) {
         global $g_font_resolver_pdf;
         $file = $g_font_resolver_pdf->ttf_mappings[$family];
         $embed = $g_font_resolver_pdf->embed[$family];
         // Remove the '.ttf' suffix
         $file = substr($file, 0, strlen($file) - 4);
         // Generate (if required) PHP font description files
         if (!file_exists($this->_getfontpath() . $fontkey . '.php') || ManagerEncoding::is_custom_encoding($encoding)) {
             // As MakeFont squeaks a lot, we'll need to capture and discard its output
             MakeFont(TTF_FONTS_REPOSITORY . $file . '.ttf', TTF_FONTS_REPOSITORY . $file . '.afm', $this->_getfontpath(), $fontkey . '.php', $encoding);
         }
         $this->AddFont($fontkey, $family, $encoding, $fontkey . '.php', $embed);
     }
 }
开发者ID:aedvalson,项目名称:Nexus,代码行数:16,代码来源:pdf.fpdf.php

示例12: die

            if (!$pos) {
                die('<b>Error:</b> font file does not seem to be valid Type1');
            }
            $size2 = $pos - $size1;
            $file = substr($file, 0, $size1 + $size2);
        }
        if (function_exists('gzcompress')) {
            $cmp = $basename . '.z';
            SaveToFile($cmp, gzcompress($file), 'b');
            $s .= '$file=\'' . $cmp . "';\n";
            echo 'Font file compressed (' . $cmp . ')<br>';
        } else {
            $s .= '$file=\'' . basename($fontfile) . "';\n";
            echo '<b>Notice:</b> font file could not be compressed (zlib extension not available)<br>';
        }
        if ($type == 'Type1') {
            $s .= '$size1=' . $size1 . ";\n";
            $s .= '$size2=' . $size2 . ";\n";
        } else {
            $s .= '$originalsize=' . filesize($fontfile) . ";\n";
        }
    } else {
        //Not embedded font
        $s .= '$file=' . "'';\n";
    }
    $s .= "?>\n";
    SaveToFile($basename . '.php', $s, 't');
    echo 'Font definition file generated (' . $basename . '.php' . ')<br>';
}
MakeFont('Delicious-Heavy.pfb', 'Delicious-Heavy.afm', 'ISO-8859-1', array(164 => 'Euro'), 'Type1');
开发者ID:Jako,项目名称:ModX-Evo-dbEdit,代码行数:30,代码来源:makefont.php

示例13: MakeFont

<?php

include_once "makefont.php";
MakeFont('verdana.ttf', 'verdana.afm', 'cp1252');
开发者ID:XolotSoft,项目名称:controlobra,代码行数:4,代码来源:createfont.php

示例14: MakeFont

<?php

include_once "makefont.php";
MakeFont('CMUNRM.OTF', 'cp1252', TRUE);
开发者ID:rckarchitects,项目名称:cornerstone-rcka,代码行数:4,代码来源:index.php

示例15: compressed

      $s.='$file=\''.basename($fontfile)."';\n";
      echo '<B>Notice:</B> font file could not be compressed (gzcompress not available)<BR>';
      
      $cmp=$basename.'.ctg';
      $f = fopen($cmp, 'wb');
      fwrite($f, $cidtogidmap);
      fclose($f);
      echo 'CIDToGIDMap created ('.$cmp.')<BR>';
      $s.='$ctg=\''.$cmp."';\n";
    }
    if($type=='Type1')
    {
      $s.='$size1='.$size1.";\n";
      $s.='$size2='.$size2.";\n";
    }
    else
      $s.='$originalsize='.filesize($fontfile).";\n";
  }
  else
  {
    //Not embedded font
    $s.='$file='."'';\n";
  }
  $s.="?>\n";
  SaveToFile($basename.'.php',$s);
  echo 'Font definition file generated ('.$basename.'.php'.')<BR>';
}

MakeFont('font.ttf','font.ufm');

?>
开发者ID:nosheenali,项目名称:Zamana,代码行数:31,代码来源:makefontuni.php


注:本文中的MakeFont函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。