0
votes

I have a PostScript that uses TrueType fonts. However, I want to include rarly used characters like registration marks (®) and right/left single/double quotes (’, “ etc).

So I used glyphshow and called the names of the glyphs

%! 

<< /PageSize [419.528 595.276] >> setpagedevice 
/DeviceRGB setcolorspace 
% Page 1 

%
% Set the Original to be the top left
%
0 595.276 translate 
1 -1 scale 
gsave 
%
% Save this state before moving x y specifically for images
%

1 -1 scale 
/BauerBodoniBT-Roman findfont 30 scalefont setfont % set the pt size %-3.792 - 16 

1 0 0 setrgbcolor
10 -40 moveto /quoteright glyphshow
10 -80 moveto /registered glyphshow

/Museo-700 findfont 30 scalefont setfont % set the pt size %-3.792 - 16 

1 0 1 setrgbcolor
10 -120 moveto /quoteright glyphshow
10 -180 moveto /registered glyphshow


showpage 

When I execute this PostScript using the following command (due to my requirement for the pdf to be editable in Illustrator i.e. can be opened with all fonts intact) the PDF shows nothing but seems to contain the glyphs if you copy and paste from the pdf into a text file.

gs -o gly_subsetfalse.pdf -sDEVICE=pdfwrite -dCompatibilityLevel=1.3 -dSubsetFonts=false -dPDFSETTINGS=/prepress textglyph.ps

However, this above command now causes issues with pulling it into Illustrator. The rare glyphs become unrecongisble (', Æ). Normal characters and regular glyphs seem fine i.e. /a glyphshow and just show text appear in pdf and illustrator.

So, it seems that having the SubsetFonts option as True shows rare glyphs but this stops me from pulling the PDF into Illustrator.

Attached are the TrueType Fonts for reference and two PDFs (one with subsetfont option being truw and the other not - default).

I have also tried the following command with the same ill results (no visible glyphs appearing on the PDF and Illustrator incorrectly shows the glyphs).

gs -o gly_subsetfalse_embedallfonts.pdf -sDEVICE=pdfwrite -dCompatibilityLevel=1.3 -dPDFSETTINGS=/prepress -dSubsetFonts=false -dEmbedAllFonts=true textglyph.ps

But with this command I also get a PreFlight error from the PDF if that helps:

"Glyph width info in PDF does not match width info in embedded font"

Attached are all the files spoke about above - click here.


Encoding the font also does not produce good results.

I have encoded a TrueType(and a Type42) font in my PostScript and listed a few new characters to glyphshow.

Results are:

Command 1:

gs -o encode_ttf_subset_false.pdf -sDEVICE=pdfwrite -dSubsetFonts=false encode.ps

Results 1: Open the PDF in Acrobat does NOT display any glyphshow characters.

Command 2:

gs -o encode_ttf_subset_true.pdf -sDEVICE=pdfwrite encode.ps

Results 2: Open the PDF in Acrobat and it DOES show the glyphshow characters but not in Illustrator.

Command 3:

gs -o encode_ttf_subset_false_embedtrue.pdf -sDEVICE=pdfwrite -dSubsetFonts=false -dEmbedAllFonts=true encode.ps

Results 3: Same as Result 1 (glyphshow characters do not appear).

Below is my new PostScript with Encoded TTF and Type42 (I've also included them in my file further below).

Is this a bug at least with Ghostscript?

/museobold findfont dup  %%%%% This is the Type42 Font
length dict
copy begin

/Encoding Encoding 256 array copy def 
Encoding 1 /oacute put
Encoding 2 /aacute put
Encoding 3 /eacute put
Encoding 4 /questiondown put
Encoding 5 /quotedblleft put
Encoding 6 /quoteright put
Encoding 7 /quotedblbase put

/museobold-Esp currentdict definefont pop

end

/museobold-Esp 18 selectfont

72 600 moveto
(\005D\001lnde est\002 el camino a San Jos\003? More characters \006 and \007) show

%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%

/BauerBodoniBT-Roman findfont dup
length dict
copy begin

/Encoding Encoding 256 array copy def 
Encoding 1 /oacute put
Encoding 2 /aacute put
Encoding 3 /eacute put
Encoding 4 /questiondown put
Encoding 5 /quotedblleft put
Encoding 6 /quoteright put
Encoding 7 /quotedblbase put

/BauerBodoniBT-Roman-Esp currentdict definefont pop

end

/BauerBodoniBT-Roman-Esp 18 selectfont

72 630 moveto
(\005D\001lnde est\002 el camino a San Jos\003? More characters \006 and \007) show

showpage

Click here to downloading the following: BBBTRom.ttf (TrueType font); 3 pdfs (results 1, 2 and 3); museobold (TrueType font converted to Type42 using ttftotype42) and encode.ps.

1

1 Answers

2
votes

This is back to your problem with using Illustrator as a general PDF application. It can't do that. Now as you note you've found ways round that in the past, this time I believe you are out of luck.

The PostScript glypshow operator doesn't have a PDF equivalent. Also, because of the way glyphshow works, we cannot simply use any existing font instance to store the glyph (because the glyph may not be, and probably isn't, present in the Encoding). As a result pdfwrite does the only thing it can. It makes a new font which consists only of the glyphs used by glyphshow from the specific original font's CharStrings.

Because we don;t have an Encoding to work from we have to use a custom (suymbolic) Encoding (because fonts in a PDF file have to have an Encoding) which from your previous experience I suspect means that Illustrator is unable to read the font we embed.

Using glyphshow with pdfwrite is something I would not encourage.

Now having said that, there should not be a problem with the PDF file when SubsetFonts is true, though I do have an open bug report which sounds similar. You haven't actually said which version of Ghostscript you are using, so I can't be sure if its the same problem. (nor do I have the same fonts etc). Note that this is not (I believe) related to your problem with Illustrator, that's caused by your use of glyphshow and some Illustrator limitation.

As a general rule I would not use -dPDFSETTINGS, certainly not while trying to debug a problem, nor would I limit the output to PDF 1.3.