Help:Manual Fontsgs: Difference between revisions
(Blanked the page) |
No edit summary |
||
Line 1: | Line 1: | ||
[[Category:Help_Manual]] | |||
[[Help:TOC|Table of Contents]] | |||
<h2>Ghostscript Font Hints for Linux, Unix and MacOSX.</h2> <br> <em>These notes thanks to Craig Ringer and Russell Lang, maintainer of GSview.</em> <p>One of the most common causes of Ghostscript failure to render/import/convert a file is when Ghostscript can't find the fonts it needs to either display an EPS or PS. This not a weakness or flaw in Ghostscript, as <strong>all</strong> EPS/PS interpreters need to be able access the correct fonts listed within the PostScript. This can most definitely affect EPS/PS files you are trying to import into Scribus. Some applications do not properly embed the fonts, so they must be supplied externally.</p> <p>When Ghostcript can't find a font usually an error message from the console will be something like:</p> <pre> gs -h AFPL Ghostscript 8.50 (2004-12-10) Copyright (C) 2004 artofcode LLC, Benicia, CA. All rights reserved. blah blah bah... invalidfont Current allocation mode is local Last OS error: No such file or directory and so on... </pre> <p>The <strong>invalidfont</strong> error means a: Ghostscript can't find the font or fonts. b: Ghostscript can't find <strong>any</strong> fonts c: There is a broken or malformed font on your system.</p> <p>The fix:</p> <h4>Creating a Fontmap File</h4> There's a secret gem in the GS source distribution, <pre> $GS_SRC_DIR/toolbin/genfontmap.ps </pre> This can be used to generate a Fontmap file - the same files you see frightening perl scripts for on the 'net. This file may or may not be shipped by your distro, so for this example, we are mentioning the un-tarred source directory for building a parallel GS install. You should use the <em>genfontmap.ps</em> from the version of Ghostscript you are using. Others may not work correctly. This is another good reason to get a recent version of Ghostscript. <pre> $ gs -q -sFONTPATH=/usr/local/share/fonts/TrueType ${HOME}/build/ghostscript-8.31/toolbin/genfontmap.ps % This Fontmap generated by genfontmap.ps (AndaleMono) (/usr/local/share/fonts/TrueType/AndaleMo.TTF) ; (Arial-Black) (/usr/local/share/fonts/TrueType/AriBlk.TTF) ; (Arial-BoldItalicMT) (/usr/local/share/fonts/TrueType/Arialbi.TTF) ; (Arial-BoldMT) (/usr/local/share/fonts/TrueType/Arialbd.TTF) ; ... blah blah blah ... (Utopia-Regular) (putr.pfa) ; (Verdana) (/usr/local/share/fonts/TrueType/Verdana.TTF) ; (Verdana-Bold) (/usr/local/share/fonts/TrueType/Verdanab.TTF) ; (Verdana-BoldItalic) (/usr/local/share/fonts/TrueType/Verdanaz.TTF) ; (Verdana-Italic) (/usr/local/share/fonts/TrueType/Verdanai.TTF) ; (Webdings) (/usr/local/share/fonts/TrueType/Webdings.TTF) ; (ZapfChancery-MediumItalic) /URWChanceryL-MediItal ; (ZapfDingbats) /Dingbats ; genfontmap completed OK. 42 new fonts added. </pre> <p>So you redirect stdout or copy paste everything from the <code>% This Fontmap..</code> line to a text editor to save the Fontmap, copy the generated FontMap into the font directory, then add the directory to your GS_LIB env var:</p> <p>The exact path may vary.</p> <pre> $ gs -q -sFONTPATH=/usr/local/share/fonts/TrueType ${HOME}/build/ghostscript-8.50/toolbin/genfontmap.ps > /tmp/Fontmap $ sudo cp /tmp/Fontmap /usr/local/share/fonts/Truetype $ export GS_LIB=/usr/local/share/fonts/TrueType:$GS_LIB </pre> <p>Then you can launch Scribus from the same console and GS will find them and will import EPS/PS files without issues.</p> <p>Alternately, you can edit your GS lib/Fontmap to source the new fontmap or append the new fontmap entries to your main lib/Fontmap.</p> <h4>Adding User Added TrueType Fonts</h4> <p>Despite the very best efforts of the Ghostscript documentation to make it appear otherwise, TrueType fonts are well supported in Ghostscript and quite easy to use with it.</p> <p>Most importantly, the GS_FONTPATH environment var and the -sFONTPATH argument may specify directories containing any supported type of font - not just PostScript fonts as described in the documentation.</p> <pre> $ export GS_FONTPATH=$MY_FONT_DIR:$HOME/.fonts $ scribus </pre> <h4>Ghostscript Fonts and EPS Import</h4> <p>EPS import in Scribus is affected by the Ghostscript font path. If GS can't find the fonts, they'll be silently substituted. You really, really want GS to be able to find your fonts.</p> <p>You are recommend to create Fontmap files for your font directories then add them to the GS_LIB env var, as this will cause GS to load fonts quickly in future. Testing confirms that once GS has been told where to find the fonts, the EPS import in Scribus happily pulls in local fonts where there is a suitable one to use for a font requested by the EPS, but not embedded.</p> <p>Note in all of the above, the creation and updating of Fontmap.gs is usually handled automagically, by using Kfontinstaller, as noted here: [[Help:Manual_Fontsadvanced|Font Installation with KDE]]</p> |
Revision as of 03:41, 28 April 2011
Ghostscript Font Hints for Linux, Unix and MacOSX.
These notes thanks to Craig Ringer and Russell Lang, maintainer of GSview.
One of the most common causes of Ghostscript failure to render/import/convert a file is when Ghostscript can't find the fonts it needs to either display an EPS or PS. This not a weakness or flaw in Ghostscript, as all EPS/PS interpreters need to be able access the correct fonts listed within the PostScript. This can most definitely affect EPS/PS files you are trying to import into Scribus. Some applications do not properly embed the fonts, so they must be supplied externally.
When Ghostcript can't find a font usually an error message from the console will be something like:
gs -h AFPL Ghostscript 8.50 (2004-12-10) Copyright (C) 2004 artofcode LLC, Benicia, CA. All rights reserved. blah blah bah... invalidfont Current allocation mode is local Last OS error: No such file or directory and so on...
The invalidfont error means a: Ghostscript can't find the font or fonts. b: Ghostscript can't find any fonts c: There is a broken or malformed font on your system.
The fix:
Creating a Fontmap File
There's a secret gem in the GS source distribution,
$GS_SRC_DIR/toolbin/genfontmap.ps
This can be used to generate a Fontmap file - the same files you see frightening perl scripts for on the 'net. This file may or may not be shipped by your distro, so for this example, we are mentioning the un-tarred source directory for building a parallel GS install. You should use the genfontmap.ps from the version of Ghostscript you are using. Others may not work correctly. This is another good reason to get a recent version of Ghostscript.
$ gs -q -sFONTPATH=/usr/local/share/fonts/TrueType ${HOME}/build/ghostscript-8.31/toolbin/genfontmap.ps % This Fontmap generated by genfontmap.ps (AndaleMono) (/usr/local/share/fonts/TrueType/AndaleMo.TTF) ; (Arial-Black) (/usr/local/share/fonts/TrueType/AriBlk.TTF) ; (Arial-BoldItalicMT) (/usr/local/share/fonts/TrueType/Arialbi.TTF) ; (Arial-BoldMT) (/usr/local/share/fonts/TrueType/Arialbd.TTF) ; ... blah blah blah ... (Utopia-Regular) (putr.pfa) ; (Verdana) (/usr/local/share/fonts/TrueType/Verdana.TTF) ; (Verdana-Bold) (/usr/local/share/fonts/TrueType/Verdanab.TTF) ; (Verdana-BoldItalic) (/usr/local/share/fonts/TrueType/Verdanaz.TTF) ; (Verdana-Italic) (/usr/local/share/fonts/TrueType/Verdanai.TTF) ; (Webdings) (/usr/local/share/fonts/TrueType/Webdings.TTF) ; (ZapfChancery-MediumItalic) /URWChanceryL-MediItal ; (ZapfDingbats) /Dingbats ; genfontmap completed OK. 42 new fonts added.
So you redirect stdout or copy paste everything from the % This Fontmap..
line to a text editor to save the Fontmap, copy the generated FontMap into the font directory, then add the directory to your GS_LIB env var:
The exact path may vary.
$ gs -q -sFONTPATH=/usr/local/share/fonts/TrueType ${HOME}/build/ghostscript-8.50/toolbin/genfontmap.ps > /tmp/Fontmap $ sudo cp /tmp/Fontmap /usr/local/share/fonts/Truetype $ export GS_LIB=/usr/local/share/fonts/TrueType:$GS_LIB
Then you can launch Scribus from the same console and GS will find them and will import EPS/PS files without issues.
Alternately, you can edit your GS lib/Fontmap to source the new fontmap or append the new fontmap entries to your main lib/Fontmap.
Adding User Added TrueType Fonts
Despite the very best efforts of the Ghostscript documentation to make it appear otherwise, TrueType fonts are well supported in Ghostscript and quite easy to use with it.
Most importantly, the GS_FONTPATH environment var and the -sFONTPATH argument may specify directories containing any supported type of font - not just PostScript fonts as described in the documentation.
$ export GS_FONTPATH=$MY_FONT_DIR:$HOME/.fonts $ scribus
Ghostscript Fonts and EPS Import
EPS import in Scribus is affected by the Ghostscript font path. If GS can't find the fonts, they'll be silently substituted. You really, really want GS to be able to find your fonts.
You are recommend to create Fontmap files for your font directories then add them to the GS_LIB env var, as this will cause GS to load fonts quickly in future. Testing confirms that once GS has been told where to find the fonts, the EPS import in Scribus happily pulls in local fonts where there is a suitable one to use for a font requested by the EPS, but not embedded.
Note in all of the above, the creation and updating of Fontmap.gs is usually handled automagically, by using Kfontinstaller, as noted here: Font Installation with KDE