1

the acroreader is showing missing fonts in one pdf-file (WPMathB,WPMathA WP Greek Helve, ...) which can be easily downloaded from http://www.fontpalace.com.

However, the ghostscript command fails, though it is points to the missing fonts directory, /home/user/WP_ttf_fonts:

 $ gs -o file-with-embedded-fonts.pdf -sDEVICE=pdfwrite -dEmbedAllFonts=true  -sFONTPATH="/home/user/WP_ttf_fonts" input-without-embedded-fonts.pdf
Page 35    
Can't find CID font "WPMathB".    
Attempting to substitute CID font /Adobe-Identity for /WPMathB, see doc/Use.htm#CIDFontSubstitution.    
Loading a TT font from 
/usr/share/ghostscript/9.10/Resource/CIDFSubst/DroidSansFallback.ttf to emulate a CID font Adobe-Identity   **** Warning: can't process font stream, loading font by the name.    
 ... Done.    
Can't find CMap Identity-UTF16-H building a CIDDecoding resource.     
Can't find CID font "WPMathB".    
Attempting to substitute CID font /Adobe-Identity for /WPMathB, see doc/Use.htm#CIDFontSubstitution.    
Loading a TT font from /usr/share/ghostscript/9.10/Resource/CIDFSubst/DroidSansFallback.ttf to emulate a CID font Adobe-Identity
**** Error reading a content stream.     
The page may be incomplete.    
   **** File did not complete the page properly and may be damaged.    
 ... Done.

Any help, how to tell ghostscript to accept these fonts, please ?

1 Answer 1

4

WPMathA etc. is from Correl Word Perfect and Correl allows you download those fonts (although I didn't find any license in the self-extracting zip archive). Don't fear the *.exe as it works just fine if you unzip it. The FILE name for the WP MathA font is Wphv06na.ttf and it doesn't get less gruesome.

Example:

sudo chown $USER /usr/local/share/fonts/
cd /usr/local/share/fonts/
wget http://www.corel.com/akdlm/6763/downloads/WordPerfect/wpwin/9/wpfonts.exe
unzip wpfonts.exe
sudo chown -R root /usr/local/share/fonts/
sudo fc-cache

The next hurdle is that the PDF has WPMathA but the font cache has WP MathA:

fc-list | grep local.*MathA
/usr/local/share/fonts/Wphv06na.ttf: WP MathA:style=Normal
fc-list -v | grep -c WPMathA
0

Your mission is to create the missing configuration files with the required aliases to tie WPMathA to WP MathA. After that you can relax by building an aircraft carrier out of toothpicks.

mkdir -p ~/.config/fontconfig/
echo '<?xml version="1.0"?>' > ~/.config/fontconfig/fonts.conf
xmlcopyeditor ~/.config/fontconfig/fonts.conf

insert:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- $XDG_CONFIG_HOME/fontconfig/fonts.conf for per-user font configuration -->
<fontconfig>
  <alias>
    <family>WPMathA</family>
    <prefer><family>WP MathA</family></prefer>
  </alias>
</fontconfig>

Don't forget to rebuild the cache again. Didn't need root/sudo for me.

fc-cache

By this time acroread has stopped complaining about the missing WPMathA and the ghostscript bugzilla bug 687595 has a comment that fontconfig support was added in 8.60 but I guess they lied. If you still insist on creating a PDF with the embedded font even though the one you have should be working by now you can read ghostscript bugzilla bug 692001 which I will quote right here:

Comment 2 Ken Sharp 2011-02-28 11:44:42 PST

There are 2 ways to do this:

1) Locate a genuine CIDFont named Arial, place it in gs/Resource/CIDFont and then tell Ghostscript to use disk files as well as the built in file system. This is done with the -I command line switch (eg -I/gs/Resource).

2) Use a TrueType font as a replacement. To do this you need to edit gs/Resource/Init/cidfmap and add an entry for the font (Arial), specifying the TrueType font to be used instead and some other parameters. You must then also tell Ghostscritp [sic] to use the specified file, again using the -I switch as above.

You can also use an existing CIDfont with a different name as a replacement by specifying this in the cidfmap file.

Please refer to the documentation in : /gs/doc/Use.htm

Look for "CID fonts" and "CID font substitution".

You will have to apt-get install ghostscript-doc to get the file:///usr/share/doc/ghostscript-doc/Use.htm Ken refers to.

The file to update is /var/lib/ghostscript/fonts/cidfmap just add this line /WPMathA << /FileType /TrueType /Path (/usr/local/share/fonts/Wphv07na.ttf) /SubfontID 0 /CSI [(Identity) 0] >> ;

And run gs -o embedeed-font.pdf -sDEVICE=pdfwrite -dEmbedAllFonts=true -I/usr/local/share/fonts/Wphv06na.ttf no-embedded-font.pdf

Please read file:///usr/share/doc/fontconfig/fontconfig-user.html for background information. It will tell you to please see XDG Base Directory Specification for more details because there you will find the defaults for the $XDG... series of environment variables none of which are set to anything on 14.04 as far as ps axwwe shows.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .