{
$f = $this->wdir . '/' . $fontFile;
$e = explode('.', $f);
- $ext = array_pop($f);
+ $ext = array_pop($e);
$hash = 'fb_' . substr(md5($fontFile), 0, 10);
if (!isset($this->cssfont[$hash])) {
$final = $hash . '.woff';
$dest = $this->wdir . '/' . $final;
if (!file_exists($dest) || filemtime($dest) < filemtime($f)) {
- $fontforge = new cubeCommandLine('convertrn.pe');
- $fontforge->setPath(CONVERTER_PATH);
+ $script = resource_path('tools/fonts/convertrn.pe');
+ if (!is_executable($script)) {
+ chmod($script, 755);
+ }
+ $fontforge = new CommandLine('fontforge');
+ $fontforge->setArg('-script', $script);
$fontforge->setArg(null, $f);
$fontforge->setArg(null, $dest);
$fontforge->execute();
+ $fontforge->debug();
}
$this->vdir->copy($dest, 'data/fonts/' . $hash . '.woff');
- $cmd = "font-line report $f";
- $fontline = `$cmd`;
- $report = explode("\n", $fontline);
+ $fontline = new CommandLine('font-line');
+ $fontline->setArg(null, 'report');
+ $fontline->setArg(null, $f);
+ $fontline->execute();
+ $fontline->debug();
+ $report = explode("\n", $fontline->getOutput());
foreach ($report as $item) {
$item = trim($item);
+ if (!stristr($item, ':')) {
+ continue;
+ }
list($k, $v) = explode(':', $item, 2);
+ $v = trim($v);
if ($k == '[head] Units per Em') {
- $fontHeight = trim($v);
+ $fontHeight = $v;
}
if ($k == '[OS/2] CapHeight') {
- $fontCapHeight = trim($v);
+ $fontCapHeight = $v;
}
if ($k == '[OS/2] TypoAscender') {
- $ascender = abs(trim($v));
+ $ascender = abs($v);
}
if ($k == '[OS/2] TypoDescender') {
- $descender = abs(trim($v));
+ $descender = abs($v);
}
}
$capHeight = 1;
--- /dev/null
+#!/usr/bin/fontforge -script
+Open($1)
+Print("Open font ",$1)
+SetOS2Value("FSType",0);
+if($argc>3)
+ Print("Change name to ",$3)
+ SetFontNames($3,$3,$3,'Regular','','1.0')
+ SetTTFName(0x409,0,"-")
+ SetTTFName(0x409,1,$3)
+ SetTTFName(0x409,3,$3)
+ SetTTFName(0x409,4,$3)
+ SetTTFName(0x409,5,"1.0")
+ SetTTFName(0x409,6,$3)
+ SetTTFName(0x409,7,"-")
+ SetTTFName(0x409,8,"-")
+ SetTTFName(0x409,9,"-")
+ SetTTFName(0x409,10,"-")
+ SetTTFName(0x409,11,"-")
+ SetTTFName(0x409,12,"-")
+ SetTTFName(0x409,13,"-")
+ SetTTFName(0x409,14,"-")
+ SetTTFName(0x409,16,$3)
+ SetTTFName(0x409,17,$3)
+ SetTTFName(0x409,18,$3)
+ SetTTFName(0x409,19,"-")
+endif
+Generate($2)