Skip to content
Prev 156496 / 398506 Next

PDF fonts problem

Hi
Mihalicza P?ter wrote:
Thanks for the clear example.  A couple of changes, fixes, and
explanations included below ...
On Linux, that needs to be something like ...

Sys.setlocale(category="LC_CTYPE", locale="hu_HU.utf8")
For me, with Adobe Reader, on Linux, u151 and u171 are just missing, but 
the root problem is probably the same;  the PDF reader is probably 
substituting a font and not using the default font because the real font 
is not embedded in the file.  The "slippage" you are seeing is probably 
due to the fact that the metrics (size of each character) are completely 
wrong in the substituted font so the characters are drawn in the wrong 
positions.
The 'fontpaths' argument describes where the PFB files are, not where 
the AFM files are.  So this is probably failing to embed the fonts 
because it can't find the fonts.  Does it work if you change to 
something like ...

  embedFonts("tryfont-cms.pdf",
            outfile="tryfont-cms-embed.pdf",
            fontpaths="cm-super/pfb/")

In your PDF reader, see if you can find a "document properties" or 
something similar;  that should tell you whether the fonts have been 
embedded or whether the reader is substituting a different font.

On Linux, you can use pdffonts to find out.  For example, for me (look 
at the 'emb' column) ...

$ pdffonts tryfont-cms.pdf
name                                 type         emb sub uni object ID
------------------------------------ ------------ --- --- --- ---------
SFRM1000                             Type 1       no  no  no       9  0


$ pdffonts tryfont-cms-embed.pdf
name                                 type         emb sub uni object ID
------------------------------------ ------------ --- --- --- ---------
PPLABU+Times-Roman?                  Type 1C      yes yes no      10  0


Paul