Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How one can change font in the text form?

\documentclass{standalone}

\usepackage{xcolor}
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}
\usepackage[english,russian,french]{babel}
\usepackage{hyperref}

\begin{document}
    \pagestyle{empty}
    \begin{Form}
        \TextField[bordercolor=white
            ,borderwidth=0
            ,width=2.5in
            ,name=name.1
            ,format={
                var f = this.getField('name.1');
                f.textFont = 'Europe';
                f.userName = 'first name'
            }
            ,value=something
                    ,charsize=7pt]{Type:}
    \end{Form}
\end{document}

This example is not working. If I open the Adobe Acrobat Pro it says that the forms font is helvetica. If I change \usepackage[english,russian,french]{babel} to \usepackage[english]{babel} or \usepackage[russian]{babel} everything works.

share|improve this question
    
Do you have this font installed? I tried with other fonts (like Consolas or Times New Roman) it worked. –  m0nhawk Feb 22 '13 at 8:43
    
Yes, I have this font installed. –  Ptech Feb 22 '13 at 8:48
1  
I've updated code, so that it represents the question. I found that the problem with french in babel. –  m0nhawk Feb 22 '13 at 9:26
    
Not only french, when I add one more lang to babel this textfont format function not works. –  Ptech Feb 22 '13 at 9:39
2  
@Ptech The \select@language error is normal when you change options for babel and will vanish at the next LaTeX run, provided you don't interrupt the present one. –  egreg Feb 22 '13 at 10:11

1 Answer 1

up vote 5 down vote accepted

Package babel uses shorthand characters for different languages. Example, ; is redefined as active character if french is loaded to insert some space before according to French typography.

With \shorthandoff and \shorthandon a shorthand character can be dis- and enabled:

\shorthandoff{;}%
\TextField...
\shorthandon{;}%

Another possibility is the use of \string (or e-TeX's \detokenize). \string converts the next token to a character with catcode "other" (12, such as digits) or "space" (10) if the token has the character code of a space (32).

\TextField[...
  format={... f.textFont = 'Europe'\string; ...},
  ....]{...}

Another problem is font embedding. The font is only referenced by name and must be installed at the system of the user.

share|improve this answer
    
For me only the \shorthandoff/\shorthandon way works. Using pdflatex. –  m0nhawk Feb 23 '13 at 18:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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