Completed
Push — master ( bdc37e...5a8dc8 )
by Daniel
10s
created

FontTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 82
rs 10

4 Methods

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