# PSTricks + pdfLaTeX resulting in fonts not embedding into eventual PDF

I want my eventual PDF to have all fonts embedded. Using special psdots in pstricks is causing this to fail. Here is a MWE of something which results in non-embedded fonts:

\documentclass[10pt]{article}

\usepackage{pstricks,epsfig,pst-node}
\usepackage{auto-pst-pdf}

\begin{document}

\begin{pspicture}(0,0)(3,3)
\psdots[dotstyle=asterisk](0,0)
\psdots[dotstyle=o](0,0)
\psdots[dotstyle=triangle*](0,0)
\psdots[dotstyle=diamond*](0,0)
\psdots[dotstyle=pentagon*](0,0)
\end{pspicture}

\end{document}


Here is output from pdffonts:

[mishchea@linty mwe]\$ pdffonts mwe.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
SDXKYB+CMR10                         Type 1            Builtin          yes yes no       6  0
Times-Roman                          Type 1            Standard         no  no  no      13  0
[none]                               Type 3            Custom           yes no  no      14  0

-
Everything is fine with the document! Times-Roman is a default PostScript font and available on all PS-printer or used by one of the GhostScript fonts. The Type 3 font is an internal softfont ehich is created by PSTricks itself on the fly. –  Herbert Sep 27 '12 at 5:49
Nevertheless, the entity to which I'm submitting this document insists that all fonts are embedded, so I need to embed this one... –  Andrey Sep 27 '12 at 14:59
sure that is no problem. I also prefer embedded fonts and in my local config.ps the PostScript fonts are always embedded by default –  Herbert Sep 27 '12 at 15:04

if you want to embed standard PostScript fonts then use

\usepackage[dvips={-h tir_____.pfb}]{auto-pst-pdf}


that is the setting for Times-Roman. The font file (in this case tir_____.pfb) is free available in the net. If you want to embed all standard PostScript fonts then use an own config.ps file which enables the embedding of these fonts by default, eg:

[...]
% Partially download Type 1 fonts by default.  Only reason not to do
% this is if you encounter bugs.  (Please report them to
% @email{tex-k@@mail.tug.org} if you do.)
j

% and perhaps in other places, bit of a waste but better save than sorry
h hvb_____.pfb
h hv______.pfb
h tir_____.pfb
h tii_____.pfb
h tib_____.pfb
h pzdr.pfb
[...]


running kpsewhich config.ps in a terminal tells you where your current file config.ps is located, eg:

voss@shania:~> kpsewhich config.ps
/usr/local/texlive/2012/texmf/dvips/config/config.ps


And here is the output of your example running with the above -h option:

voss@shania:~> pdffonts Test/Namenlos-4.pdf
name                    type              encoding         emb sub uni object ID
----------------------- ----------------- ---------------- --- --- --- ---------
SDXKYB+CMR10            Type 1            Builtin          yes yes no       6  0
GNSOXG+Times-Roman      Type 1C           WinAnsi          yes yes no      13  0
[none]                  Type 3            Custom           yes no  no      14  0

-
How many times do we need to press _ for the font filename in \usepackage[dvips={-h tir_____.pfb}]{auto-pst-pdf} ? Because it is not so obvious for a glance sight. –  The Last Error Sep 27 '12 at 6:51
from history: file names were 8.3 characters. 8 for the name and 3 for the extension. –  Herbert Sep 27 '12 at 7:02
Thanks! I only have one question: does enabling this cause the whole font character set to be loaded into the PDF, or just those characters I actually use? In other words, if I set my config.ps as described here, will it cause EVERY PDF I generate to have EVERY PostScript font embedded unnecessarily? –  Andrey Sep 27 '12 at 17:52
As seen in my output of pdffonts it is a subset –  Herbert Sep 27 '12 at 18:56

I think it is better to use standalone class and compile the source with latex-dvips-ps2pdf compilation sequence to get a tight, single PDF output as follows,

% this file name is goo.tex
\documentclass[10pt,pstricks,border=12pt]{standalone}
\usepackage{pst-node}

\begin{document}

\begin{pspicture}[showgrid=bottom](-1,-1)(5,5)
\psframe[fillstyle=solid,fillcolor=yellow,opacity=0.1](-1,-1)(5,5)
\psdots[dotstyle=asterisk](0,0)
\psdots[dotstyle=o](1,1)
\psdots[dotstyle=triangle*](2,2)
\psdots[dotstyle=diamond*](3,3)
\psdots[dotstyle=pentagon*](4,4)
\end{pspicture}

\end{document}


Invoking pdffonts goo.pdf produces an output as follows,

## Tips and tricks:

• First, create a single LaTeX input file with standalone class for every PSTricks pspicture you have in your main LaTeX input file.

• Second, compile each of those standalone-based LaTeX input files with latex-dvips-ps2pdf sequence to produce a PDF output.

• Third, from within your main LaTeX input file, import those PDF output with \includegraphics and compile the main LaTeX input file with pdflatex.

• Done!

## Does the main LaTeX input file embed the fonts?

% this file name is main.tex
\documentclass[12]{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{goo}
\end{document}


compile it with pdflatex main to produce a PDF file named main.pdf. Then check the fonts as follow,

-
I am not familiar with the standalone class, but this problem is actually buried in the middle of what typesets to a 160 page document which is a finished product except that this single font will not embed correctly. It is thus undesirable to change the document class... –  Andrey Sep 27 '12 at 5:26
Anyway I just tried the latex-dvips-ps2pdf route, also latex-dvipdf, on my actual document, and both gave a PDF with the same unembedded font. –  Andrey Sep 27 '12 at 5:30
I may end up having to do this, but I have around 90 or so figures... in the future I will try to avoid using my method, which apparently causes problems, but if there is a more workable solution for my actual situation I would prefer it. –  Andrey Sep 27 '12 at 5:46