8. Font Issues
This page is no longer relevant to SketchLaTeX, as since April 2005 it no longer renders text as fonts. Ignore this unless you are interested in embedding .eps fragments with computer modern fonts into LaTeX documents.
This section is about the issues involved with including characters from the computer-modern fonts in eps inclusions. This is what you get if you save a sketch file with sketchlatex inclusions directly to ps/eps format. This is quite different to the epstex format, which doesn't have any of these problems, as the latex portion is in a separate tex file.
When the file is saved as postscript, Sketch does not embed the fonts for the LaTeX characters. If the file is to be included in a LaTeX document, dvips embeds the appropriate fonts. It is important that the LaTeX installation uses fonts with the same encoding as Sketch uses, or there will be problems.
This could introduce a future portability risk, as the graphics eps files rely on a particular font distribution. This could be overcome by adding the fonts using dvips after creating the eps. The other alternative is to use the accompanying plugin to save as epstex format. This creates a short LaTeX fragment, that sets the text portions of the figure. It also includes a postscipt file, which contains the rest of the graphics.
My experimentation so far has shown the following:
- If the file is saved as a standard eps, and it is included in a LaTeX document that is completely empty of other text, dvips will correctly add the necessary fonts. This will increase the file size from around 10kB to 200kB. This resulting eps seems completely portable. With this file size, it seems that dvips can't handle subsetting properly with inclusions. If the same thing is done with the epstex output file, the size will only be about 35kB.
- If the fonts aren't added to the eps, and there is other text in the file, then there can be problems. If a font is used both in the inclusion, and in the main file, then all the characters in the inclusion need to be in the main file as well. It may be possible to fix this. One solution is to use the -j0 switch on dvips - to turn off font subsetting. This makes the file a bit larger (but still smaller than embedding the fonts in all the graphic files), but all characters come out.
- So there are (at least) three ways of including the graphics in
a LaTeX file. Use one of:
- First pass them through latex/dvips to embed the fonts (robust, but big files) - doing the same thing with the combined file works better.
- Use the -j0 switch on dvips (moderate overhead)
- Use the combined epstex output format - this works well
My expectation is that there is a neater solution to this. I would be grateful if someone could enlighten me further. One option may be to output via MetaPost format. This could offer really small file size overheads.