File: usersguide-4.html

package info (click to toggle)
skencil 0.6.17-7
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 6,136 kB
  • ctags: 8,589
  • sloc: python: 36,672; ansic: 16,571; sh: 151; makefile: 92
file content (203 lines) | stat: -rw-r--r-- 8,870 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<html>
<head>
<title>Skencil User's Guide: Configuration
</title>
</head>
<body bgcolor=white text=black link=blue vlink=navy alink=red>
<TABLE WIDTH="100%">
<TR>
<TH ALIGN="left" WIDTH="33%"><img SRC="Images/arrow-left.png" WIDTH="16" HEIGHT="16" ALIGN="top" ALT="Prev"></TH>
<TH ALIGN="center" WIDTH="33%"><img SRC="Images/arrow-up.png" WIDTH="16" HEIGHT="16" ALIGN="top" ALT="Up"></TH>
<TH ALIGN="right" WIDTH="33%"><img SRC="Images/arrow-right.png" WIDTH="16" HEIGHT="16" ALIGN="top" ALT="Next"></TH>
</TR>
<TR>
<TD ALIGN="left"><A HREF="usersguide-3.html">Concepts</A></TD>
<TD ALIGN="center"><A HREF="usersguide.html">Skencil User's Guide</A></TD>
<TD ALIGN="right"><A HREF="usersguide-5.html">User Scripting
</A></TD>
</TR>
</TABLE>
<HR NOSHADE>
<H1><FONT face="Helvetica,Arial"><A NAME="N1"></A>Configuration
</font></H1>




<H2><FONT face="Helvetica,Arial"><A NAME="N2"></A>Fonts
</font></H2>

<P>Fonts are a somewhat complex matter in Linux and X. Skencil's main
output format for printing is PostScript. Because of that, Skencil
identifies fonts with their PostScript names and must know how to get
the appropriate metrics (these tell Skencil how to place the individual
letters for instance) and it must know X's name for the font (to be able
to show the text on the screen appropriately).</P>
<P>The information Skencil needs to map the PostScript names to
metric-filenames (.afm-files) and X font names is stored in .sfd-files.</P>

<H3><FONT face="Helvetica,Arial"><A NAME="N3"></A>sfd-Files</font></H3>

<P>An sfd-file maps font names to the filenames of the <CODE>afm</CODE>-files and
to various font attributes like weight and width and to two strings that
are used to build the font name for X.</P>
<P>For example, the line concerning the Courier font in
<CODE>Resources/Fontmetrics/std.sfd</CODE> is:</P>
<P>
<table width="100%" cellpadding="10"><tr><td bgcolor="#FFFFD0">
<PRE>
Courier,Courier,Roman,-adobe-Courier-medium-r-normal,iso8859-1,pcrr
</PRE>
</td></tr></table>
</P>
<P>This tells Skencil that the metrics file is <CODE>pcrr.afm</CODE> and that the
first part of the X font name is <CODE>-adobe-Courier-medium-r-normal</CODE> and
its last part is <CODE>iso8859-1</CODE>. The parts missing from the X font name
describe the size and transformation which are automatically filled in
by Skencil. Skencil assumes that fonts can be arbitrarily scaled and
transformed. (The XFree servers often used on Linux have this
capability; other servers on other platforms may not)</P>
<P>If the font is not installed in the server (either the X-server or the
font server), or if it is installed under a different name, Skencil
will not be able to display the text.</P>

<P>On start-up, Skencil reads all sfd-files it finds in the directories
listed in its font-path.</P>


<H3><FONT face="Helvetica,Arial"><A NAME="N4"></A>The font-path</font></H3>

<P>Skencil maintains a list of directories where it searches for
font-related files like sfd-files and metrics. Note that this is a
skencil-specific font-path and has nothing to do with X's font-path.</P>
<P>By default (as of version 0.6.2) the font-path consists of the
directories <CODE>Resources/Fontmetrics</CODE> (relative to where Skencil is
installed), <CODE>/usr/X11R6/lib/X11/fonts/Type1</CODE> and
<CODE>/usr/share/ghostscript/fonts</CODE>.</P>
<P>If you need to add directories or otherwise modify the font-path, you
can do so in Skencil's start-up file, <CODE>~/.sketch/userhooks.py</CODE>,
which is executed by Skencil if it exists.  E.g. to add a directory to
the font-path you could put this code into <CODE>userhooks.py</CODE>:</P>
<P>
<table width="100%" cellpadding="10"><tr><td bgcolor="#FFFFD0">
<PRE>
from Sketch import config

config.font_path.append('/usr/local/share/fonts/bitstream')
</PRE>
</td></tr></table>
</P>

<P>In case you're wondering, Skencil was originally called `Sketch', hence
the name of the directory and the python module in the above code
snippet.</P>

<H3><FONT face="Helvetica,Arial"><A NAME="N5"></A>Adding Fonts</font></H3>

<P>If you install new Type 1 fonts on your system for use with Skencil,
you have to make them available to X and you have to create an sfd-file
for Skencil.</P>
<P>The X-specific part of this is described in the usual man-pages, like
<CODE>mkfontdir(1)</CODE> (for the format of <CODE>fonts.scale</CODE> and
<CODE>fonts.alias</CODE>), <CODE>xset(1)</CODE> (for ways to change the fontpath at
runtime), <CODE>Xserver(1)</CODE> (for general information about the X server,
including fonts) and <CODE>XF86Config(5)</CODE> (for the default configuration
of XFree86).</P>
<P>To help with the installation, Skencil comes with a script,
mkfontdb.py, that can create both Skencil's sfd-files and X's fonts.scale
files. In my opinion it's a good idea to generate both files with
mkfontdb.py to make sure the X-font-names in both files match, because
Skencil won't be able to display the fonts otherwise.</P>
<P>The easiest way to use mkfontdb.py is:</P>
<P>
<table width="100%" cellpadding="10"><tr><td bgcolor="#FFFFD0">
<PRE>
mkfontdb.py &lt;dir&gt;
</PRE>
</td></tr></table>
</P>
<P>When invoked like this, mkfontdb.py reads the afm-files in the directory
&lt;dir&gt; and creates the two files <CODE>fonts.scale</CODE> and <CODE>std.sfd</CODE>
in the current directory. For more information about the command line
options run 'mkfontdb.py -h'.</P>
<P>A good way to install new Type 1 fonts on a Linux-system, in my opinion,
is to put the files (pfb/pfa and afm) into a separate directory, e.g.
<CODE>/usr/local/share/fonts</CODE> and create <CODE>fonts.scale</CODE> and an sfd
file in that directory, and append it to X's font-path and Skencil's
font-path.</P>


<H3><FONT face="Helvetica,Arial"><A NAME="N6"></A>Installing Ghostscript's Type1 fonts for X.</font></H3>

<P>To use the standard PostScript fonts, I recommend installing the
appropriate Type1 fonts from the Ghostscript distribution. They are high
quality fonts and distributed under the GPL.</P>
<P>The following suggestions and instructions are mainly for XFree86. I
don't know in how far these are applicable to other X-servers or other
platforms than Linux.</P>
<P><EM>WARNING:</EM> The following instructions describe how to change the
configuration files of XFree86. Be careful and make backup copies of the
files you modify so you can restore them if something goes wrong.</P>
<P>Copy or symlink the necessary files from Ghostscript's <CODE>fonts</CODE>
directory to <CODE>/usr/X11R6/lib/X11/fonts/Type1/</CODE> (or wherever you
have X). On my system this can be done from the <CODE>Type1</CODE> directory
with:</P>
<P>
<table width="100%" cellpadding="10"><tr><td bgcolor="#FFFFD0">
<PRE>
$ ln -s /usr/share/ghostscript/fonts/*l.pfb .
</PRE>
</td></tr></table>
</P>
<P>Append the file <CODE>Doc/fonts.scale</CODE> to <CODE>Type1/fonts.scale</CODE>.
The first line in the latter file contains a single number. This is the
number of fonts listed in that file. Update that number to reflect the
changes (if there are no blank lines or comments, this number is the
number of lines minus 1)</P>
<P>You may have noticed that the font names used in
<CODE>Doc/fonts.scale</CODE> don't match the ones in in <CODE>std.sfd</CODE>.
The reason for this is that fonts you have just installed aren't the
original adobe PostScript fonts. Instead, they were contributed to
ghostscript by a company called URW. To use the standard PostScript
names to refer to these fonts, append <CODE>Doc/fonts.alias</CODE> to
<CODE>/usr/X11/lib/X11/fonts/misc/fonts.alias</CODE>. There is no number to
update here.</P>
<P>The file <CODE>Doc/fonts.scale</CODE> lists Ghostscript's fonts with their
own name and not with the name of the Adobe fonts they can replace. The
file <CODE>Doc/fonts.alias</CODE> maps the adobe names to these real names.</P>
<P>Now you have to run mkfontdir(1) to update the font database:</P>
<P>
<table width="100%" cellpadding="10"><tr><td bgcolor="#FFFFD0">
<PRE>
$ mkfontdir
</PRE>
</td></tr></table>
</P>
<P>If your X-server is running already you have to tell it to reread the
font databases with xset(1):</P>
<P>
<table width="100%" cellpadding="10"><tr><td bgcolor="#FFFFD0">
<PRE>
$ xset fp rehash
</PRE>
</td></tr></table>

</P>


<HR NOSHADE>
<TABLE WIDTH="100%">
<TR>
<TD ALIGN="left"><A HREF="usersguide-3.html">Concepts</A></TD>
<TD ALIGN="center"><A HREF="usersguide.html">Skencil User's Guide</A></TD>
<TD ALIGN="right"><A HREF="usersguide-5.html">User Scripting
</A></TD>
</TR>
<TR>
<TH ALIGN="left" WIDTH="33%"><img SRC="Images/arrow-left.png" WIDTH="16" HEIGHT="16" ALIGN="top" ALT="Prev"></TH>
<TH ALIGN="center" WIDTH="33%"><img SRC="Images/arrow-up.png" WIDTH="16" HEIGHT="16" ALIGN="top" ALT="Up"></TH>
<TH ALIGN="right" WIDTH="33%"><img SRC="Images/arrow-right.png" WIDTH="16" HEIGHT="16" ALIGN="top" ALT="Next"></TH>
</TR>
</TABLE>
</body>
</html>