• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

inherit field font from another field with JavaScript

Enthusiast ,
Nov 23, 2017 Nov 23, 2017

Copy link to clipboard

Copied

Hi,

Please i want to know if there a way to inherit field font from another field (in Acrobat Pro DC) .. not just setting the font to the field, because i have full embedded font inside my form in Other language than english (Arabic) and i want the english text field to inherit font from another field  (Ar --> En) or Vise Versa, so the statment :

this.getField("GenManagerAr").textFont

maybe is not the perfect one to use!, any tips please ? thanks in advance

Best
Mohammad Hasanin
TOPICS
Acrobat SDK and JavaScript , Windows

Views

404

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 23, 2017 Nov 23, 2017

Field fonts are always fully embedded (unless it is a type I font). Because any text could be placed in the field, the whole font is needed.  If you set another field to the same font, Acrobat will reference the font object for the first field. So for fields you never get duplicate font objects.

The line of code below copies a reference for the font in "text1" into "text2", it does not duplicate the font.

getField("Result2").textFont = getField("Result1").textFont;

However, fonts for page text are

...

Votes

Translate

Translate
Community Expert ,
Nov 23, 2017 Nov 23, 2017

Copy link to clipboard

Copied

Field fonts are always fully embedded (unless it is a type I font). Because any text could be placed in the field, the whole font is needed.  If you set another field to the same font, Acrobat will reference the font object for the first field. So for fields you never get duplicate font objects.

The line of code below copies a reference for the font in "text1" into "text2", it does not duplicate the font.

getField("Result2").textFont = getField("Result1").textFont;

However, fonts for page text are handled differently from field fonts. First, they are almost always embedded subsets, not full font definitions. There is also a possible difference in how the character codes are handled between fields and content. Fields typically use 1 byte codes, whereas content is often 2 byte character codes.  For these reasons Acrobat doesn't mix Field fonts and Content fonts.

That said, there is no reason why you couldn't write your own plug-in that modifies the fonts so that both content and fields share the same font definition.  In fact, it's possible that applications from Quite, Callas, or some other print oriented tool vendor already do this.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 23, 2017 Nov 23, 2017

Copy link to clipboard

Copied

LATEST

Thank you very much for your valuable information's!

Best
Mohammad Hasanin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines