[Tex/LaTex] How to embed fonts with pdflatex

embeddingfontspdfpdftex

In last 3-4 days I tried to embed to my pdf file fonts, that it contains. I visit more links, including questions from tex.stackexchange.com, and I achieve it even. But yesterday I have seen, that fonts are not embedded again.

I use non-latex font. I've created tfm and afm files and added them to myfonts.map file. Also I've made updmap-sys --enable Map=myfonts.map for adding my map file. And it is added to updmap. I've checked ~/.texmf-var/fonts/map/pdftex/updmap/pdftex.map and it contains in tail next.

% myfonts.map
recarial ArialMT " T1Encoding ReEncodeFont " <T1-WGL4.enc
recarialbd Arial-BoldMT " T1Encoding ReEncodeFont " <T1-WGL4.enc
recarialbdo Arial-BoldMT " .167 SlantFont T1Encoding ReEncodeFont " <T1-WGL4.enc
recarialbi Arial-BoldItalicMT " T1Encoding ReEncodeFont " <T1-WGL4.enc
recarialbio Arial-BoldItalicMT " .167 SlantFont T1Encoding ReEncodeFont " <T1-WGL4.enc
recariali Arial-ItalicMT " T1Encoding ReEncodeFont " <T1-WGL4.enc
recarialio Arial-ItalicMT " .167 SlantFont T1Encoding ReEncodeFont " <T1-WGL4.enc
recarialo ArialMT " .167 SlantFont T1Encoding ReEncodeFont " <T1-WGL4.enc

For generating afm and tfm files I use next commands http://vpaste.net/9yytH. File ttfonts.map I don't use.

For including fonts to document I've created arial.sty file.

\DeclareFontFamily{T1}{arial}{}%

\DeclareFontShape{T1}{arial}{b}{n}{<->ecarialbd}{}%
\DeclareFontShape{T1}{arial}{b}{sl}{<-> ecarialbdo}{}%
\DeclareFontShape{T1}{arial}{b}{it}{<-> ecarialbi}{}%

\DeclareFontShape{T1}{arial}{m}{n}{<-> ecarial}{}%
\DeclareFontShape{T1}{arial}{m}{sl}{<-> ecarialo}{}%
\DeclareFontShape{T1}{arial}{m}{it}{<-> ecariali}{}%

\DeclareFontShape{T1}{arial}{bx}{n}{<->ssub * arial/b/n}{}%
\DeclareFontShape{T1}{arial}{bx}{sl}{<->ssub * arial/b/sl}{}%
\DeclareFontShape{T1}{arial}{bx}{it}{<->ssub * arial/b/it}{}

\usepackage[T1]{fontenc}%
\renewcommand{\rmdefault}{arial}%
\renewcommand{\sfdefault}{arial}%

I compile my document by pdflatex. I don't know how, but after compilation by latex and getting dvi, I get broken markup. I mean that I get ugly document. Also, when I compile dvi and convert it to pdf, I see, that text are become raster. It is unreadable on big scaling. And document is still ugly.

Also I've added to updmap.cfg option pdftexDownloadBase14 true by command updmap --edit. This is packages, that I use http://vpaste.net/biTOJ. It contains:

  • \usepackage[T1]{fontenc}
  • \usepackage[utf8]{inputenc}

I'm using next software:

  • Kubuntu 14.04
  • pdfTeX 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian)
    kpathsea version 6.1.1
    Compiled with libpng 1.2.49; using libpng 1.2.50
    Compiled with zlib 1.2.8; using zlib 1.2.8
    Compiled with poppler version 0.24.5
  • TexStudio 2.6.6

About custom fonts. I use not only Arial, also I use another fonts, but I point Arial as popular font.

How can I fix embedding fonts to pdf document? Sorry if my english is not clear. I can clarify anything, if something is strange. Thank you!

Best Answer

You need to add the real font name to the map file entries, e.g.

 recarial ArialMT " T1Encoding ReEncodeFont " <T1-WGL4.enc <arial.ttf. 

If the real font is a .ttf (and not a .pfb) it is better to compile with pdflatex.