Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > 51f7de0838007e2876221e819c82d833 > files > 598

sketch-0.6.13-2mdk.ppc.rpm

<html>
<head>
<title>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">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. Sketch's main
output format for printing is PostScript. Because of that, Sketch
identifies fonts with their PostScript names and must know how to get
the appropriate metrics (these tell Sketch 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 Sketch 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 Sketch 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 Sketch. Sketch 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, Sketch
will not be able to display the text.</P>

<P>On start-up, Sketch 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>Sketch maintains a list of directories where it searches for
font-related files like sfd-files and metrics. Note that this is a
sketch-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 Sketch 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 Sketch's start-up file, <CODE>~/.sketch/userhooks.py</CODE>,
which is executed by Sketch 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>


<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 Sketch,
you have to make them available to X and you have to create an sfd-file
for Sketch.</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, Sketch comes with a script,
mkfontdb.py, that can create both Sketch'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
Sketch 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 Sketch'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">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>