1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the Ghostscript package |
4
|
|
|
* |
5
|
|
|
* @author Simon Schrape <[email protected]> |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace GravityMedia\Ghostscript\Device\CommandLineParameters; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* The font-related parameters trait. |
12
|
|
|
* |
13
|
|
|
* @package GravityMedia\Ghostscript\Device\CommandLineParameters |
14
|
|
|
* |
15
|
|
|
* @link http://ghostscript.com/doc/current/Use.htm#Font_related_parameters |
16
|
|
|
*/ |
17
|
|
|
trait FontTrait |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* Get argument value. |
21
|
|
|
* |
22
|
|
|
* @param string $name |
23
|
|
|
* |
24
|
|
|
* @return null|string |
25
|
|
|
*/ |
26
|
|
|
abstract protected function getArgumentValue($name); |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Set argument. |
30
|
|
|
* |
31
|
|
|
* @param string $argument |
32
|
|
|
* |
33
|
|
|
* @return $this |
34
|
|
|
*/ |
35
|
|
|
abstract protected function setArgument($argument); |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* TODO |
39
|
|
|
* |
40
|
|
|
* -dDISKFONTS |
41
|
|
|
* Causes individual character outlines to be loaded from the disk the first time they are encountered. |
42
|
|
|
* (Normally Ghostscript loads all the character outlines when it loads a font.) This may allow loading more |
43
|
|
|
* fonts into memory at the expense of slower rendering. DISKFONTS is effective only if the diskfont feature |
44
|
|
|
* was built into the executable; otherwise it is ignored. |
45
|
|
|
* |
46
|
|
|
* -dLOCALFONTS |
47
|
|
|
* Causes Type 1 fonts to be loaded into the current VM -- normally local VM -- instead of always being loaded |
48
|
|
|
* into global VM. Useful only for compatibility with Adobe printers for loading some obsolete fonts. |
49
|
|
|
* |
50
|
|
|
* -dNOCCFONTS |
51
|
|
|
* Suppresses the use of fonts precompiled into the Ghostscript executable. See "Precompiling fonts" in the |
52
|
|
|
* documentation on fonts for details. This is probably useful only for debugging. |
53
|
|
|
* |
54
|
|
|
* -dNOFONTMAP |
55
|
|
|
* Suppresses the normal loading of the Fontmap file. This may be useful in environments without a file system. |
56
|
|
|
* |
57
|
|
|
* -dNOFONTPATH |
58
|
|
|
* Suppresses consultation of GS_FONTPATH. This may be useful for debugging. |
59
|
|
|
* |
60
|
|
|
* -dNOPLATFONTS |
61
|
|
|
* Disables the use of fonts supplied by the underlying platform (X Windows or Microsoft Windows). This may be |
62
|
|
|
* needed if the platform fonts look undesirably different from the scalable fonts. |
63
|
|
|
* |
64
|
|
|
* -dNONATIVEFONTMAP |
65
|
|
|
* Disables the use of font map and corresponding fonts supplied by the underlying platform. This may be needed |
66
|
|
|
* to ensure consistent rendering on the platforms with different fonts, for instance, during regression |
67
|
|
|
* testing. |
68
|
|
|
* |
69
|
|
|
* -sFONTMAP=filename1;filename2;... |
70
|
|
|
* Specifies alternate name or names for the Fontmap file. Note that the names are separated by ":" on Unix |
71
|
|
|
* systems, by ";" on MS Windows systems, and by "," on VMS systems, just as for search paths. |
72
|
|
|
*/ |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Get FONTPATH parameter value |
76
|
|
|
* |
77
|
|
|
* @return string|null |
78
|
|
|
*/ |
79
|
2 |
|
public function getFontPath() |
80
|
|
|
{ |
81
|
2 |
|
return $this->getArgumentValue('-sFONTPATH'); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Set FONTPATH parameter |
86
|
|
|
* |
87
|
|
|
* @param string $fontPath Specifies a list of directories that will be scanned when looking for fonts not found on |
88
|
|
|
* the search path, overriding the environment variable GS_FONTPATH. |
89
|
|
|
* |
90
|
|
|
* @return $this |
91
|
|
|
*/ |
92
|
2 |
|
public function setFontPath($fontPath) |
93
|
|
|
{ |
94
|
2 |
|
$this->setArgument(sprintf('-sFONTPATH=%s', $fontPath)); |
95
|
|
|
|
96
|
2 |
|
return $this; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* TODO |
101
|
|
|
* |
102
|
|
|
* -sSUBSTFONT=fontname |
103
|
|
|
* Causes the given font to be substituted for all unknown fonts, instead of using the normal intelligent |
104
|
|
|
* substitution algorithm. Also, in this case, the font returned by findfont is the actual font named fontname, |
105
|
|
|
* not a copy of the font with its FontName changed to the requested one. THIS OPTION SHOULD NOT BE USED WITH |
106
|
|
|
* HIGH LEVEL DEVICES, such as pdfwrite, because it prevents such devices from providing the original font |
107
|
|
|
* names in the output document. The font specified (fontname) will be embedded instead, limiting all future |
108
|
|
|
* users of the document to the same approximate rendering. |
109
|
|
|
* |
110
|
|
|
* -dOLDCFF |
111
|
|
|
* Reverts to using the old, sequential, PostScript CFF parser. New CFF parser is coded in C and uses direct |
112
|
|
|
* access to the font data. This option and the old parser will be removed when the new parser proves its |
113
|
|
|
* reliability. |
114
|
|
|
*/ |
115
|
|
|
} |
116
|
|
|
|