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


PHP Font_Metrics::get_font_families方法代码示例

本文整理汇总了PHP中Font_Metrics::get_font_families方法的典型用法代码示例。如果您正苦于以下问题:PHP Font_Metrics::get_font_families方法的具体用法?PHP Font_Metrics::get_font_families怎么用?PHP Font_Metrics::get_font_families使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Font_Metrics的用法示例。


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

示例1: intval

    return intval($value);
}
?>

<a name="setup"> </a>
<h2>Font manager</h2>

<ul>
  <li style="list-style-image: url('images/star_02.gif');"><a href="#installed-fonts">Installed fonts</a></li>
  <li style="list-style-image: url('images/star_02.gif');"><a href="#install-fonts">Install new fonts</a></li>
</ul>

<h3 id="installed-fonts">Installed fonts</h3>

<?php 
$fonts = Font_Metrics::get_font_families();
$extensions = array("ttf", "afm", "afm.php", "ufm", "ufm.php");
?>

<button onclick="$('#clear-font-cache-message').load('controller.php?cmd=clear-font-cache', function(){ location.reload(); })">Clear font cache</button>
<span id="clear-font-cache-message"></span>

<table class="setup">
  <tr>
    <th rowspan="2">Font family</th>
    <th rowspan="2">Variants</th>
    <th colspan="6">File versions</th>
  </tr>
  <tr>
    <th>TTF</th>
    <th>AFM</th>
开发者ID:practo,项目名称:dompdf,代码行数:31,代码来源:fonts.php

示例2: register_font

 static function register_font($style, $remote_file)
 {
     $fontname = mb_strtolower($style["family"]);
     $families = Font_Metrics::get_font_families();
     $entry = array();
     if (isset($families[$fontname])) {
         $entry = $families[$fontname];
     }
     $local_file = DOMPDF_FONT_DIR . md5($remote_file);
     $cache_entry = $local_file;
     $local_file .= ".ttf";
     $style_string = Font_Metrics::get_type("{$style['weight']} {$style['style']}");
     if (!isset($entry[$style_string])) {
         $entry[$style_string] = $cache_entry;
         Font_Metrics::set_font_family($fontname, $entry);
         // Download the remote file
         if (!is_file($local_file)) {
             file_put_contents($local_file, file_get_contents($remote_file));
         }
         $font = Font::load($local_file);
         if (!$font) {
             return false;
         }
         $font->parse();
         $font->saveAdobeFontMetrics("{$cache_entry}.ufm");
         // Save the changes
         Font_Metrics::save_font_families();
     }
     return true;
 }
开发者ID:skyosev,项目名称:OpenCart-Overclocked,代码行数:30,代码来源:font_metrics.cls.php

示例3: __construct

 /**
  * Class constructor
  *
  * @param mixed $paper The size of paper to use either a string (see {@link CPDF_Adapter::$PAPER_SIZES}) or
  *                     an array(xmin,ymin,xmax,ymax)
  * @param string $orientation The orientation of the document (either 'landscape' or 'portrait')
  */
 function __construct($paper = "letter", $orientation = "portrait")
 {
     if (is_array($paper)) {
         $size = $paper;
     } else {
         if (isset(self::$PAPER_SIZES[mb_strtolower($paper)])) {
             $size = self::$PAPER_SIZES[$paper];
         } else {
             $size = self::$PAPER_SIZES["letter"];
         }
     }
     if (mb_strtolower($orientation) == "landscape") {
         $a = $size[3];
         $size[3] = $size[2];
         $size[2] = $a;
     }
     $this->_width = $size[2] - $size[0];
     $this->_height = $size[3] - $size[1];
     $this->_pdf = new PDFLib();
     if (defined("DOMPDF_PDFLIB_LICENSE")) {
         $this->_pdf->set_parameter("license", DOMPDF_PDFLIB_LICENSE);
     }
     $this->_pdf->set_parameter("textformat", "utf8");
     $this->_pdf->set_parameter("fontwarning", "false");
     $this->_pdf->set_info("Creator", "DOMPDF Converter");
     // Silence pedantic warnings about missing TZ settings
     if (function_exists("date_default_timezone_get")) {
         $tz = @date_default_timezone_get();
         date_default_timezone_set("UTC");
         $this->_pdf->set_info("Date", date("Y-m-d"));
         date_default_timezone_set($tz);
     } else {
         $this->_pdf->set_info("Date", date("Y-m-d"));
     }
     if (self::$IN_MEMORY) {
         $this->_pdf->begin_document("", "");
     } else {
         $this->_file = tempnam(DOMPDF_TEMP_DIR, "dompdf_tmp_");
         $this->_pdf->begin_document($this->_file, "");
     }
     $this->_pdf->begin_page_ext($this->_width, $this->_height, "");
     $this->_page_number = $this->_page_count = 1;
     $this->_page_text = array();
     $this->_imgs = array();
     $this->_fonts = array();
     $this->_objs = array();
     // Set up font paths
     $families = Font_Metrics::get_font_families();
     foreach ($families as $family => $files) {
         foreach ($files as $style => $file) {
             $face = basename($file);
             // Prefer ttfs to afms
             if (file_exists($file . ".ttf")) {
                 $file .= ".ttf";
             } else {
                 if (file_exists($file . ".TTF")) {
                     $file .= ".TTF";
                 } else {
                     if (file_exists($file . ".pfb")) {
                         $file .= ".pfb";
                     } else {
                         if (file_exists($file . ".PFB")) {
                             $file .= ".PFB";
                         } else {
                             continue;
                         }
                     }
                 }
             }
             $this->_pdf->set_parameter("FontOutline", "\\{{$face}\\}=\\{{$file}\\}");
         }
     }
 }
开发者ID:artre,项目名称:study,代码行数:80,代码来源:pdflib_adapter.cls.php

示例4: __construct

 /**
  * Class constructor
  *
  * @param string $paper The size of paper to use ({@link PDFLib_Adapter::$PAPER_SIZES})
  * @param string $orientation The orientation of the document (either 'landscape' or 'portrait')
  */
 function __construct($paper = "letter", $orientation = "portrait")
 {
     if (is_array($paper)) {
         $size = $paper;
     } else {
         if (array_key_exists(strtolower($paper), self::$PAPER_SIZES)) {
             $size = self::$PAPER_SIZES[$paper];
         } else {
             $size = self::$PAPER_SIZES["letter"];
         }
     }
     if (strtolower($orientation) == "landscape") {
         $a = $size[3];
         $size[3] = $size[2];
         $size[2] = $a;
     }
     $this->_width = $size[2];
     $this->_height = $size[3];
     $this->_pdf = new PDFLib();
     $this->_pdf->set_info("Creator", "DOMPDF Converter");
     $this->_pdf->set_info("Date", date("Y-m-d"));
     if (self::$IN_MEMORY) {
         $this->_pdf->begin_document("", "");
     } else {
         $this->_file = tempnam(DOMPDF_TEMP_DIR, "dompdf_tmp_");
         $this->_pdf->begin_document($this->_file, "");
     }
     $this->_pdf->set_parameter("topdown", "true");
     $this->_pdf->begin_page_ext($this->_width, $this->_height, "");
     $this->_page_number = $this->_page_count = 1;
     $this->_page_text = null;
     $this->_imgs = array();
     $this->_fonts = array();
     $this->_objs = array();
     // Set up font paths
     $families = Font_Metrics::get_font_families();
     foreach ($families as $family => $files) {
         foreach ($files as $style => $file) {
             $face = basename($file);
             // Prefer ttfs to afms
             if (file_exists($file . ".ttf")) {
                 $file .= ".ttf";
             } else {
                 if (file_exists($file . ".TTF")) {
                     $file .= ".TTF";
                 } else {
                     if (file_exists($file . ".pfb")) {
                         $file .= ".pfb";
                     } else {
                         if (file_exists($file . ".PFB")) {
                             $file .= ".PFB";
                         } else {
                             continue;
                         }
                     }
                 }
             }
             $this->_pdf->set_parameter("FontOutline", "\\{{$face}\\}=\\{{$file}\\}");
         }
     }
 }
开发者ID:andrewroth,项目名称:c4c_intranet,代码行数:67,代码来源:pdflib_adapter.cls.php

示例5: __construct

  /**
   * Class constructor
   *
   * @param mixed  $paper       The size of paper to use either a string (see {@link CPDF_Adapter::$PAPER_SIZES}) or
   *                            an array(xmin,ymin,xmax,ymax)
   * @param string $orientation The orientation of the document (either 'landscape' or 'portrait')
   * @param DOMPDF $dompdf
   */
  function __construct($paper = "letter", $orientation = "portrait", DOMPDF $dompdf) {
    if ( is_array($paper) ) {
      $size = $paper;
    }
    else if ( isset(self::$PAPER_SIZES[mb_strtolower($paper)]) ) {
      $size = self::$PAPER_SIZES[mb_strtolower($paper)];
    }
    else {
      $size = self::$PAPER_SIZES["letter"];
    }

    if ( mb_strtolower($orientation) === "landscape" ) {
      list($size[2], $size[3]) = array($size[3], $size[2]);
    }

    $this->_width = $size[2] - $size[0];
    $this->_height= $size[3] - $size[1];

    $this->_dompdf = $dompdf;

    $this->_pdf = new PDFLib();

    if ( defined("DOMPDF_PDFLIB_LICENSE") )
      $this->_pdf->set_parameter( "license", DOMPDF_PDFLIB_LICENSE);

    $this->_pdf->set_parameter("textformat", "utf8");
    $this->_pdf->set_parameter("fontwarning", "false");

    $this->_pdf->set_info("Creator", "DOMPDF");

    // Silence pedantic warnings about missing TZ settings
    $tz = @date_default_timezone_get();
    date_default_timezone_set("UTC");
    $this->_pdf->set_info("Date", date("Y-m-d"));
    date_default_timezone_set($tz);

    if ( self::$IN_MEMORY )
      $this->_pdf->begin_document("","");
    else {
      $tmp_dir = $this->_dompdf->get_options("temp_dir");
      $tmp_name = tempnam($tmp_dir, "libdompdf_pdf_");
      @unlink($tmp_name);
      $this->_file = "$tmp_name.pdf";
      $this->_pdf->begin_document($this->_file,"");
    }

    $this->_pdf->begin_page_ext($this->_width, $this->_height, "");

    $this->_page_number = $this->_page_count = 1;
    $this->_page_text = array();

    $this->_imgs = array();
    $this->_fonts = array();
    $this->_objs = array();

    // Set up font paths
    $families = Font_Metrics::get_font_families();
    foreach ($families as $files) {
      foreach ($files as $file) {
        $face = basename($file);
        $afm = null;

        // Prefer ttfs to afms
        if ( file_exists("$file.ttf") ) {
          $outline = "$file.ttf";

        } else if ( file_exists("$file.TTF") ) {
          $outline = "$file.TTF";

        } else if ( file_exists("$file.pfb") ) {
          $outline = "$file.pfb";

          if ( file_exists("$file.afm") ) {
            $afm = "$file.afm";
          }

        } else if ( file_exists("$file.PFB") ) {
          $outline = "$file.PFB";
          if ( file_exists("$file.AFM") ) {
            $afm = "$file.AFM";
          }
        } else {
          continue;
        }

        $this->_pdf->set_parameter("FontOutline", "\{$face\}=\{$outline\}");

        if ( !is_null($afm) ) {
          $this->_pdf->set_parameter("FontAFM", "\{$face\}=\{$afm\}");
        }
      }
    }
//.........这里部分代码省略.........
开发者ID:hendrosteven,项目名称:f3-template,代码行数:101,代码来源:pdflib_adapter.cls.php

示例6: __construct

 function __construct($paper = "letter", $orientation = "portrait")
 {
     if (is_array($paper)) {
         $size = $paper;
     } else {
         if (isset(self::$PAPER_SIZES[mb_strtolower($paper)])) {
             $size = self::$PAPER_SIZES[mb_strtolower($paper)];
         } else {
             $size = self::$PAPER_SIZES["letter"];
         }
     }
     if (mb_strtolower($orientation) === "landscape") {
         list($size[2], $size[3]) = array($size[3], $size[2]);
     }
     $this->_width = $size[2] - $size[0];
     $this->_height = $size[3] - $size[1];
     $this->_pdf = new PDFLib();
     if (defined("DOMPDF_PDFLIB_LICENSE")) {
         $this->_pdf->set_parameter("license", DOMPDF_PDFLIB_LICENSE);
     }
     $this->_pdf->set_parameter("textformat", "utf8");
     $this->_pdf->set_parameter("fontwarning", "false");
     $this->_pdf->set_info("Creator", "DOMPDF");
     $tz = @date_default_timezone_get();
     date_default_timezone_set("UTC");
     $this->_pdf->set_info("Date", date("Y-m-d"));
     date_default_timezone_set($tz);
     if (self::$IN_MEMORY) {
         $this->_pdf->begin_document("", "");
     } else {
         $tempname = tempnam(DOMPDF_TEMP_DIR, "libdompdf_pdf_");
         @unlink($tempname);
         $this->_file = "{$tempname}.pdf";
         $this->_pdf->begin_document($this->_file, "");
     }
     $this->_pdf->begin_page_ext($this->_width, $this->_height, "");
     $this->_page_number = $this->_page_count = 1;
     $this->_page_text = array();
     $this->_imgs = array();
     $this->_fonts = array();
     $this->_objs = array();
     $families = Font_Metrics::get_font_families();
     foreach ($families as $family => $files) {
         foreach ($files as $style => $file) {
             $face = basename($file);
             if (file_exists("{$file}.ttf")) {
                 $outline = "{$file}.ttf";
                 $afm = null;
             } else {
                 if (file_exists("{$file}.TTF")) {
                     $outline = "{$file}.TTF";
                     $afm = null;
                 } else {
                     if (file_exists("{$file}.pfb")) {
                         $outline = "{$file}.pfb";
                         if (file_exists("{$file}.afm")) {
                             $afm = "{$file}.afm";
                         }
                     } else {
                         if (file_exists("{$file}.PFB")) {
                             $outline = "{$file}.PFB";
                             if (file_exists("{$file}.AFM")) {
                                 $afm = "{$file}.AFM";
                             }
                         } else {
                             continue;
                         }
                     }
                 }
             }
             $this->_pdf->set_parameter("FontOutline", "\\{{$face}\\}=\\{{$outline}\\}");
             if (!is_null($afm)) {
                 $this->_pdf->set_parameter("FontAFM", "\\{{$face}\\}=\\{{$afm}\\}");
             }
         }
     }
 }
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:77,代码来源:pdflib_adapter.cls.php


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