25

Is it possible to make XELatex embed a full rather than a partial font?

The reason I ask is that I am trying to induce a fillable form to use the body font (a question asked before by several participants without satisfactory answer - e.g. related questions here or here). Acrobat forms can apparently only use embedded fonts if they are fully embedded rather than partially embedded - see here). At the moment I can create a form that uses my body font in the fillable fields, but this only works if the font is installed on the users machine.

Once I get a positive response to the above I'll extend my question to the actual use of this font in form.

Below a rather trivial MWE (in this case using libertine) for anyone who wants a starting point to experiment.

\documentclass{article}
\usepackage{fontspec}
\usepackage{libertine}
\begin{document}
The quick brown fox jumps over the dog 0123456789.
\end{document}

The below provides an extended MWE using the eforms package (somewhat unrelated to the question of font embedding). Not specifying any font uses the default helvetica for the field (which looks horrible) as does the underlying hyperref field. Using TiRo as the font at least gives a reasonably decent looking serif font (albeit not libertine) which seems to work in Acrobat reader, PDF-XChange viewer and the inbuilt Windows 8 reader. Specifying LinLibertineO as the font gives libertine in the field (only if this is installed, and only in Acrobat Reader, but not PDF-XChange viewer and the inbuilt Windows 8 reader).

\documentclass{article}
\usepackage{fontspec}
\usepackage{libertine}
\usepackage{eforms}
\begin{document}

\everyTextField{
\BC{1 0 0} % border color
\BG{.941 1 .941} % background color
\textColor{0 0 1} % is black
\textFont{TiRo} % LinLibertineO/TiRo (options see commentary)
\textSize{10}
\Ff{\FfDoNotScroll}
}

Your name: \textField{myText}{1.5in}{12bp}

\end{document}
  • 2
    could you (a) complete your MWE, i.e. include a basic version of that fillable form you're trying to implement, and (b) provide a link to that other question you're mentioning? – Nils L Oct 23 '13 at 19:47
  • Added a couple of links relating to the problem of having consistent fonts in forms. Have not added an actual form as yet, because unless it is possible to embed the full font, the issue is completely academic, and intrinsic to the PDF format. PDF forms cannot use fonts that are partially embedded, but can easily use system fonts (in any event I tend to use the great eforms package for forms which would result in MWE which would not compile for many as eforms not in Texlive). [I will add a second MWE later today which might help folk who have battled, as I did, to use system fonts in forms] – Aubrey Blumsohn Oct 23 '13 at 20:38
  • Found a step in the right direction: boekenenproefschriften.nl/proefschriften/sites/default/files/… – Jonathan Komar Jun 30 '16 at 15:20
  • 4
    Beware, embedding the whole fonts might not be covered by the license of the fonts, especially professional fonts. – Keks Dose Jun 27 '17 at 12:21
  • Interestingly, if I open the PDF with Acrobat Reader DC version 2018.011.20058 on a machine that has the font installed on the system and then click on a "combo box" element whose font is set to the target with JavaScript (this.getField('myCombo').textFont = "theFont";), Adobe Reader DC will embed the full font in the PDF. I can see this with Preferences (Ctrl-D). It's a work-around that doesn't require Acrobat, but is a manual step nonetheless. I suspect combo box elements load the entire font? – Fuhrmanator Aug 29 '18 at 22:22
11
+250

No, it's not possible to do this. Section 12 of the dvipdfmx documentation deals explicitly with font embedding. From page 21 of the documentation (the very last sentence of the docs, in fact):

dvipdfmx does not support full embedding. Only subset embedding is supported.

  • Thanks for the answer - can you post a link to the document please? – Fuhrmanator Aug 29 '18 at 22:42
  • @Fuhrmanator I've added a link. You can also find it with texdoc dvipdfmx from a command line. – Alan Munn Aug 29 '18 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.