7. Font Installation

This page is no longer relevant to SketchLaTeX, as since April 2005 it no longer renders text as fonts. Ignore this page unless you are wanting to render computer modern fonts in X or in Skencil.

This part of the installation is optional and no longer recommended. In fact, you need to using the older 2002-06-07 version for this involved process to have any effect at all. By installing the computer-modern fonts for Sketch, Sketch can then display the equations accurately and output postscript files with computer-modern fonts in them. However, this bit takes a little effort, and it doesn't affect the quality of the epstex output. Firstly, to utilise the fonts, the latextext.py file needs to be edited to change the line

latex_use_times=1
to
latex_use_times=0
This line is shortly after the comments at the top.

The following comments are focused on Linux/XFree86, but there are also some solaris notes below courtesy of Kostas Oikonomou.

Versions of Sketch prior to 0.6.4 have problems reading the computer-modern fonts, so you will either need the later version, or the fonts.py file from a later version.

LaTeX Fonts

The latex distribution (dvips in particular) needs to be configured to use Type-1 postscript fonts. This is a good idea regardless of this plugin, especially when creating pdf files. In the past, Type-3 bitmapped fonts have been used by dvips. There are a few distributions of Type-1 Computer-Modern fonts, but I will assume the Bluesky ones are being used. You can tell type-1 fonts are used if you can zoom the postscript file to high magnifications without jagged edges appearing on the text.

Most recent distributions will have this configured by default, or have a comment regarding it in the config.ps file for dvips. You may need to uncomment a line like “p +bsr.map” in config.ps

Sketch Fonts

A postscript is usually distributed in two files. One is the font itself, which has a .pfb (binary form) or .pfa (ascii form) extension. There is also a metric file (.afm) which describes the size of the characters. On an X system, the X-server needs the .pfb files, and programs doing typesetting need the .afm files to know where to place characters.

Sketch needs to know about the LaTeX fonts in order to display them. In particular, a directory with the *.afm files has to be added to the sketch font path. This can be done in the ~/.sketch/userhooks.py file with the lines:

from Sketch import config
config.font_path.append('/usr/local/share/cmpsfont/afm')

where the path matches your installation. (if you choose a different path, you have to make corresponding changes it the paths listed below)

The afm files are not needed by LaTeX (it uses .tfm files), so they may not already be included in your LaTeX distribution. If that's the case, you can download the complete bluesky computer modern fontset distribution from CTAN. On a CTAN mirror this will be at fonts/cm/ps-type1/bluesky/cmps-unix.tar.gz. Untar the archive in /usr/local/share/ and adjust the permissions on the files if necessary, ie.

cd /usr/local/share
tar -zxvf /some_path/cmps-unix.tar.gz
chmod 755 cmpsfont/ cmpsfont/afm/ cmpsfont/pfb/

The afm directory also needs to contain a sketch font description file, so sketch can understand what they are. This can be generated by Sketch's script "mkfontdb.py", but I had to modify it to work properly for the Computer-Modern fonts. My version is here (look for “SJH” to see the changes). Alternatively you can simply use my generated description file std.sfd. Copy this to /usr/local/share/cmpsfont/afm/std.sfd

X Fonts

The X-server needs to be able to read the fonts used by LaTeX for sketch to be able to display them. Normally this means adding the directory with *.pfb files (like cmr10.pfb) to the X fontpath. This can be done by adding the line:

FontPath  "/usr/local/share/cmpsfont/pfb"

to the "Files" section of the XF86Config file (assuming you're using xfree86). Just put it after the other "FontPath" lines. If you are using a font-server (like xfs), you could instead add it to the font server path. Alternatively, to change the font-path on the fly, or with systems other than xfree86, you can issue this command,

xset fp+ /usr/local/share/cmpsfont/pfb

The directory here is the one that contains a whole lot of *.pfb files. Instead of using the directory listed above, you could share the pfb font files with LaTeX, in which case the directory would be something like:

FontPath  "/usr/share/texmf/fonts/type1/bluesky/cm"

The pfb directory must also contain files called fonts.scale and fonts.dir to specify the font names. mkfontdb.py can create a fonts.scale, and mkfontdir copies this to fonts.dir. The font naming must be consistent with the std.sfd from sketch (otherwise you could just use the normal type1inst and mkfontdir). For the bluesky fonts, you can use my fonts.dir, and also fonts.scale. These would be copied to the directory /usr/local/share/cmpsfont/pfb/

To have the fontpath updated, you either need to restart the X-server after doing this, or use the xset command.

Next Page... Font Issues