コード例 #1
0
ファイル: svg-font.php プロジェクト: Pesulap/php-utils
 public static function folder($folder, $width = null, $height = null, $descent = null)
 {
     if (substr($folder, -1) == '/') {
         $folder = substr($folder, 0, -1);
     }
     $files = scandir($folder);
     if (empty($files)) {
         return;
     }
     $font = new SVGFont(basename($folder));
     if (isset($width)) {
         $font->glyph_width = $width;
     }
     if (isset($height)) {
         $font->glyph_height = $height;
     }
     if (isset($descent)) {
         $font->glyph_descent = $descent;
     }
     $folder .= '/';
     foreach ($files as $file) {
         if (stripos($file, '.svg') === false) {
             continue;
         }
         $char = reset(explode('.', $file));
         if (strlen($char) > 1) {
             if (!preg_match('/^x?[0-9a-f]+$/i', $char)) {
                 continue;
             }
             $char = '&#' . $char . ';';
         }
         $font->add($char, $folder . $file);
     }
     $font->save();
 }
コード例 #2
0
ファイル: fonttosvg.php プロジェクト: rasmusrosengren/CAS
<?php

include "SVGFont.php";
$svgFont = new SVGFont();
$svgFont->load("font.svg");
$result = $svgFont->textToPaths("Simple text", 20);
コード例 #3
0
 /**
  * @return string
  */
 public function key()
 {
     return $this->currentFont->getFaceBasedId();
 }