Discussion:
[pdftex] Embedding a font to use it in a form
Gregory Heytings
2015-07-13 13:31:51 UTC
Permalink
Hi,

I try to use pdfTeX to create (text field) forms, and I would like to use
an embedded font for the text fields, instead of the standard system
fonts. This is feasible (Acrobat can do it), be it that the font needs to
be embedded in full (i.e. not a subset), and apparently in a special way
(they do not appear in the list of embedded fonts in Acrobat).

This question is more or less similar to: http://tex.stackexchange.com/questions/36630/hyperref-how-to-format-text-in-a-forms-text-field , but it got no answer.

Does anyone know how to do this?

Thanks,

Gregory
Karl Berry
2015-07-13 21:57:04 UTC
Permalink
It should work to fully embed a font (no subsetting) by using <<foo.pfb
in the map file entry instead of <foo.pfb. This is tersely discussed in
the pdftex manual under "fontfile", page 11 in the pdftex-a.pdf that is
in TeX Live 2015.

However, I have no knowledge of how to specify a font for use in text
field forms. Maybe someone else here (Heiko, Martin ... ?) can help.

Best,
Karl
Gregory Heytings
2015-07-13 22:23:45 UTC
Permalink
Hi Karl,

Many thanks for your answer!
Post by Karl Berry
It should work to fully embed a font (no subsetting) by using <<foo.pfb
in the map file entry instead of <foo.pfb. This is tersely discussed in
the pdftex manual under "fontfile", page 11 in the pdftex-a.pdf that is
in TeX Live 2015.
After some more research, it seems indeed that one aspect of the problem
is to fully embed the font. Apparently it does not work with pfa/pfb
fonts, however (but I am not sure that it cannot be done); it does work,
for sure, with an otf font file.
Post by Karl Berry
However, I have no knowledge of how to specify a font for use in text
field forms. Maybe someone else here (Heiko, Martin ... ?) can help.
So far my best answer to my own question goes as follows: one has to
insert the otf file as a pdf object, with something like "\pdfobj stream
attr { /Subtype /OpenType } file {Font.otf}", and then create two other
pdf objects manually, namely a /FontDescriptor and a /Font, the latter
containing /FirstChar 0 /LastChar 255, and 256 values in the /Width array.
Then that font can be used in a form, by adding a reference to it in the
resource dictionary of the form.

(Once I got the above scheme working, I tried to remplace the "\pdfobj
stream attr { /Subtype /OpenType } file {Font.otf}" with a "\pdfobj stream
attr { /Subtype /Type1 } file {Font.pfa}", but it did not work anymore.)

The problem is that doing this involves a lot of manual work. A more
direct way to do this (with pdfTeX) would be much appreciated.

Gregory

Loading...