#!/usr/local/bin/fontforge
-Open($1,1)
+Open($1)
Print("Open font ",$1)
Print("Em size : ",$em);
i=2
while ( i<=$argc-3 )
Print ("Merge with font ",$argv[i]);
- MergeFonts($argv[i],1)
+ MergeFonts($argv[i])
++i
endloop
#!/usr/local/bin/fontforge
-Open($1,1)
+Open($1)
Print("Open font ",$1)
+
+
if($2!="-")
// Italic
- Print("Set italic angle to ",$2)
+ Print("Set italic angle from ",$italicangle," to ",$2)
SetItalicAngle(Strtol($2))
endif
+
+if($5!="-" && $6!="-")
+ // Select first char
+ c=Strtol($5)
+ Select(c)
+ w=Real(GlyphInfo("Width"))
+ if(c==0 && Round(w)==1000)
+ Print("Maybe an error, no scaling will occur")
+ else
+ rw=Real(Strtol($6))
+ Print("First char width is ",w," and should be ",rw)
+ if(w!=rw)
+ ratio=(rw/w)*100.0
+ Print("Scaling the whole font to ",ratio,"%")
+ SelectAll()
+ Transform(Round(ratio),0,0,Round(ratio),0,0)
+ endif
+ endif
+endif
+
+
if($3!="-" && $4!="-" && $3!="0")
Print("Set Ascent & Descent to ",$3," and ",$4)
// Ascent & Descent
endif
SetMacStyle(-1);
+SetGasp(65535,3)
Generate($1)
-config=Infos\r
+config=Extract_Layout\r
do.jar=true\r
javac.debug=true\r
javadoc.preview=true\r
-user.properties.file=C:\\Users\\Vincent\\.netbeans\\7.0\\build.properties\r
+user.properties.file=C:\\Users\\Cube\\.netbeans\\7.0\\build.properties\r
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.fontbox.afm.FontMetric;
import org.apache.pdfbox.cos.COSArray;
import org.apache.pdfbox.cos.COSDictionary;
import org.apache.pdfbox.cos.COSName;
protected $descent = 200;
protected $xheight = 600;
protected $capheight = 700;
+ protected $firstWidth;
+ protected $firstChar;
protected static $ligatures = array('AE' => '00C6', 'ae' => '00E6',
'OE' => '0152', 'oe' => '0152',
'IJ' => '0132', 'ij' => '0133',
public function setDescriptorsToFile($file) {
$fontforge = new cubeCommandLine('descriptors.pe');
$fontforge->setPath(CONVERTER_PATH);
-
- $font=$this;
- if(!is_null($this->descendant)){
- $font=$this->decendant;
+
+ $font = $this;
+ if (!is_null($this->descendant)) {
+ $font = $this->decendant;
}
-
+
$fontforge->setArg(null, $file);
$fontforge->setArg(null, $font->italicAngle);
$fontforge->setArg(null, $font->ascent);
$fontforge->setArg(null, $font->descent);
+ if ($font->firstChar == 0 && $font->firstWidth == 500) {
+ $fontforge->setArg(null, '-');
+ $fontforge->setArg(null, '-');
+ } else {
+ $fontforge->setArg(null, $font->firstChar);
+ $fontforge->setArg(null, $font->firstWidth);
+ }
$fontforge->execute();
$this->addToLog($fontforge);
}
if ($e[0] == '/ToUnicode') {
$this->cmap_id = $e[1];
- }
-
- if ($e[0] == '/DescendantFonts') {
+ } elseif ($e[0] == '/DescendantFonts') {
$this->descendant = new wsPDFFont($this->extractor, $e[1]);
- }
-
- if ($e[0] == '/BaseFont') {
+ } elseif ($e[0] == '/BaseFont') {
$this->name = ltrim($e[1], '/');
- }
-
- if ($e[0] == '/FontDescriptor') {
+ } elseif ($e[0] == '/FontDescriptor') {
$this->descriptor_id = $e[1];
+ } elseif ($e[0] == '/FirstChar') {
+ $this->firstChar = $e[1];
+ } elseif ($e[0] == '/Widths') {
+ $this->firstWidth = $e[2];
}
}
$formats = array('ttf', 'woff', 'svg');
foreach ($this->cssFont as $font => $infos) {
- fb($infos, $font);
$index = $infos['index'];
foreach ($formats as $format) {
$fontforge->setArg(null, '-');
$fontforge->setArg(null, $this->vdir . '/data/style/F' . $index . '.' . $format);
$fontforge->execute();
-
- fb($fontforge->commande);
- fb($fontforge->output);
}
}
}
}
$class = array('g');
- if ($group['oblique']) {
- $class[] = 'o';
- }
-
if (!is_null($group['color'])) {
$class[] = 'c' . $group['color'];
}
foreach ($this->cssFont as $font => $infos) {
$index = $infos['index'];
$style = $infos['oblique'] ? 'oblique' : 'normal';
- $res[] = "@font-face{font-family:F" . $index . ";src:url('F" . $index . ".ttf') format('truetype'),url('F" . $index . ".woff') format('woff'),url('F" . $index . ".svg#" . $font . "') format('svg')}";
- $res[] = '.f' . $index . '{font-family:F' . $index . ',Arial,Helvetica}';
+ $res[] = "@font-face{font-family:F" . $index . ";font-style:all;src:url('F" . $index . ".ttf') format('truetype'),url('F" . $index . ".woff') format('woff'),url('F" . $index . ".svg#" . $font . "') format('svg')}";
+ $res[] = '.f' . $index . '{font-family:F' . $index . ',Arial,Helvetica;}';
}
$res = array_chunk($res, 3500);
return array(
'color' => $this->getCSSColor($group['color']),
- 'size' => $this->getCSSSize($group['size'] * $this->fontScale),
+ 'size' => $this->getCSSSize($group['size']),
'font' => $this->getCSSFont($group['font'], $group['oblique'] == 'true', $document_id),
'y' => 0,
'x' => $group['x'],
}
protected function getCSSSize($size) {
+ $os=$size;
$size = $this->normalizeFloatValue($size);
$size*=$this->multiply;
return $this->getIndex($size, $this->cssSize);