[Translted] Linux FAQs with Answers--How to embed all fonts in a PDF document generated with LaTex

This commit is contained in:
zhengsihua 2014-09-27 11:29:33 +08:00
parent bf605bfab4
commit 01790a0742
2 changed files with 39 additions and 41 deletions

View File

@ -1,41 +0,0 @@
Tanslating------geekpi
Linux FAQs with Answers--How to embed all fonts in a PDF document generated with LaTex
================================================================================
> **Question**: I generated a PDF document by compiling LaTex source files. However, I noticed that not all fonts used are embedded in the PDF document. How can I make sure that all fonts are embedded in a PDF document generated from LaTex?
When you create a PDF file, it is a good idea to embed fonts in the PDF file. If you don't embed fonts, a PDF viewer can replace a font with something else if the font is not available on the computer. This will cause the document to be rendered differently across different PDF viewers or OS platforms. Missing fonts can also be an issue when you print out the document.
When you generate a PDF document from LaTex (for example with pdflatex or dvipdfm), it's possible that not all fonts are embedded in the PDF document. For example, the following output of [pdffonts][1] says that there are missing fonts (e.g., Helvetica) in a PDF document.
![](https://farm3.staticflickr.com/2944/15344704481_d691f66e75_z.jpg)
To avoid this kind of problems, here is how to embed all fonts at LaTex compile time.
$ latex document.tex
$ dvips -Ppdf -G0 -t letter -o document.ps document.dvi
$ ps2pdf -dPDFSETTINGS=/prepress \
-dCompatibilityLevel=1.4 \
-dAutoFilterColorImages=false \
-dAutoFilterGrayImages=false \
-dColorImageFilter=/FlateEncode \
-dGrayImageFilter=/FlateEncode \
-dMonoImageFilter=/FlateEncode \
-dDownsampleColorImages=false \
-dDownsampleGrayImages=false \
document.ps document.pdf
Now you will see that all fonts are properly embedded in the PDF file.
![](https://farm4.staticflickr.com/3890/15161184500_15ec673dca_z.jpg)
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/embed-all-fonts-pdf-document-latex.html
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://ask.xmodulo.com/check-which-fonts-are-used-pdf-document.html

View File

@ -0,0 +1,39 @@
Linux有问必答-- 如何在PDF中嵌入LaTex中的所有字体
================================================================================
> **提问**: 我通过编译LaTex源文件生成了一份PDF文档。然而我注意到并不是所有字体都嵌入到了PDF文档中。我怎样才能确保所有的字体嵌入在由LaTex生成的PDF文档中
当你创建一个PDF文件时在PDF文件中嵌入字体是一个好主意。如果你不嵌入字体PDF浏览器可以在计算机上没有字体的情况下使用其他东西代替。这将导致文件被在不同的PDF浏览器或操作系统平台上呈现不同的样式。当你打印出来的文档时缺少的字体是一个问题。
当你从LaTex中生成PDF文档时例如用pdflatex或dvipdfm可能并不是所有的字体都嵌入在PDF文档中。例如[pdffonts][1]下面的输出中提示PDF文档中有缺少的字体如Helvetica
![](https://farm3.staticflickr.com/2944/15344704481_d691f66e75_z.jpg)
为了避免这样的问题下面是如何在LaTex编译时嵌入所有的字体。
$ latex document.tex
$ dvips -Ppdf -G0 -t letter -o document.ps document.dvi
$ ps2pdf -dPDFSETTINGS=/prepress \
-dCompatibilityLevel=1.4 \
-dAutoFilterColorImages=false \
-dAutoFilterGrayImages=false \
-dColorImageFilter=/FlateEncode \
-dGrayImageFilter=/FlateEncode \
-dMonoImageFilter=/FlateEncode \
-dDownsampleColorImages=false \
-dDownsampleGrayImages=false \
document.ps document.pdf
现在你可以看到所有的字体都被嵌入到PDF中了。
![](https://farm4.staticflickr.com/3890/15161184500_15ec673dca_z.jpg)
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/embed-all-fonts-pdf-document-latex.html
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://ask.xmodulo.com/check-which-fonts-are-used-pdf-document.html