1

I am running the following command to add bookmarks to a pdf file. The file bookmarks.txt contains bookmarks in Chinese characters and in pdfmarks format. The output of gs shows that there seem to be some problem with the font. Is there some way to solve the problem? Thanks in advance!

$ gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=out.pdf note.pdf  bookmarks.txt
GPL Ghostscript 9.05 (2012-02-08)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 102.
Page 1
Substituting font Times-Bold for Times New Roman,Bold.
Loading NimbusRomNo9L-Medi font from /usr/share/fonts/type1/gsfonts/n021004l.pfb... 2889932 1499918 3254752 1759198 3 done.
Substituting font Times-Roman for Times New Roman.
Loading NimbusRomNo9L-Regu font from /usr/share/fonts/type1/gsfonts/n021003l.pfb... 2993796 1627069 4166144 2692107 3 done.
Page 2
Substituting font Times-Roman for Times New Roman.
Page 3
Substituting font Times-Roman for Times New Roman.
Page 4
Can't find (or can't open) font file /usr/share/ghostscript/9.05/Resource/Font/Arial-BoldMT.
Can't find (or can't open) font file Arial-BoldMT.
Can't find (or can't open) font file /usr/share/ghostscript/9.05/Resource/Font/Arial-BoldMT.
Can't find (or can't open) font file Arial-BoldMT.
Querying operating system for font files...
Loading Arial-BoldMT font from /usr/share/fonts/truetype/msttcorefonts/arialbd.ttf... 3073992 1671962 5497244 3026723 3 done.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 3074368 1692578 5853472 3515223 3 done.
Substituting font Times-Roman for Times New Roman.
Page 5
Substituting font Times-Roman for Times New Roman.
Page 6
Substituting font Times-Roman for Times New Roman.
Page 7
Page 8
Loading Arial-BoldMT font from /usr/share/fonts/truetype/msttcorefonts/arialbd.ttf... 3074180 1679830 4371296 2897061 3 done.
Substituting font Times-Roman for Times New Roman.
Page 9
Substituting font Times-Roman for Times New Roman.
Substituting font Times-Bold for Times New Roman,Bold.
Loading Arial-BoldMT font from /usr/share/fonts/truetype/msttcorefonts/arialbd.ttf... 3073992 1671819 4631712 2938526 3 done.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 3073992 1672099 4987940 3383317 3 done.
Page 10
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 3094652 1711038 3749692 2384326 3 done.

The font map files of my GhostScript is under /usr/share/ghostscript/9.05/Resource/Init, and can be viewed here Fontmap and Fontmap.GS.

I have installed ttf-mscorefonts-installer, and

$ ls /usr/share/fonts/truetype/msttcorefonts/
Andale_Mono.ttf              Georgia.ttf
andalemo.ttf                 georgiaz.ttf
arialbd.ttf                  impact.ttf
arialbi.ttf                  Impact.ttf
Arial_Black.ttf              timesbd.ttf
Arial_Bold_Italic.ttf        timesbi.ttf
Arial_Bold.ttf               timesi.ttf
Arial_Italic.ttf             Times_New_Roman_Bold_Italic.ttf
ariali.ttf                   Times_New_Roman_Bold.ttf
arial.ttf                    Times_New_Roman_Italic.ttf
Arial.ttf                    Times_New_Roman.ttf
ariblk.ttf                   times.ttf
comicbd.ttf                  trebucbd.ttf
Comic_Sans_MS_Bold.ttf       trebucbi.ttf
Comic_Sans_MS.ttf            Trebuchet_MS_Bold_Italic.ttf
comic.ttf                    Trebuchet_MS_Bold.ttf
courbd.ttf                   Trebuchet_MS_Italic.ttf
courbi.ttf                   Trebuchet_MS.ttf
Courier_New_Bold_Italic.ttf  trebucit.ttf
Courier_New_Bold.ttf         trebuc.ttf
Courier_New_Italic.ttf       Verdana_Bold_Italic.ttf
Courier_New.ttf              Verdana_Bold.ttf
couri.ttf                    verdanab.ttf
cour.ttf                     Verdana_Italic.ttf
Georgia_Bold_Italic.ttf      verdanai.ttf
Georgia_Bold.ttf             verdana.ttf
georgiab.ttf                 Verdana.ttf
Georgia_Italic.ttf           verdanaz.ttf
georgiai.ttf                 webdings.ttf
georgia.ttf                  Webdings.ttf

updated

The error is that in the generated pdf file, the bookmarks are not Chinese characters but unrecognizable (if you view it in evince, click side pane and then index). I suspect the substitution is the reason (or do I misunderstand the cause of the problem?)

Here is the updated Fontmap.GS, after adding the font files for the four types of Times New Roman fonts

Here is the output of running the above command using gs

  • Do you have these fonts installed? Are Times New Roman and Times New Roman,Bold available on the system? – eppesuig Apr 27 '14 at 11:48
  • @eppesuig How can I check if I have them installed? thanks. – user66259 Apr 27 '14 at 14:48
  • gs open a file called fontmap. This is normally present in your gs library directory (search it with find). This file contains complete font names and their definition file. Some information on how to add fonts to gs is available at linux.about.com/library/howto/font/blfont5.htm – eppesuig Apr 27 '14 at 15:00
  • @eppesuig: please see my edit to my post. – user66259 Apr 28 '14 at 2:42
0

You are missing the right font information. Your Fontmap.GS file state that /TimesNewRoman is an alias for /TimesNewRomanPSMT. But the latter is not available in the same file. Since you have the ttf files in a directory, you only need to update the fontmap.GS adding these lines:

/TimesNewRomanPSMT (/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf) ;

You may use the same line as template for the bold font.

  • my file is here dl.dropboxusercontent.com/u/13029929/fonts/Times_New_Roman.ttf – user66259 Apr 28 '14 at 11:52
  • I add the two to fontmap.GS. gs still says Substituting font Times-Bold for Times New Roman,Bold. ... Substituting font Times-Roman for Times New Roman. – user66259 Apr 28 '14 at 11:55
  • I read once again all your output, and now I think that there is no error there: the font substitution are required by your Fontmap.GS file, and the Arial fonts, once it is not found internally by gs, it is found querying the operating system. So, just to be sure: could you please better explain what the error is supposed to be? – eppesuig Apr 28 '14 at 14:38
  • The error is that in the generated pdf file, the bookmarks are not Chinese characters but unrecognizable (if you view it in evince, click side pane and then index). I suspect the substitution is the reason (or do I misunderstand the cause of the problem?) Here is the updated Fontmap.GS. Here is the output of gs – user66259 Apr 28 '14 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy