inherit field font from another field with JavaScript

Engaged ,
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

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

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.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

122

Likes

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

inherit field font from another field with JavaScript

Engaged ,
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

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

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.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

123

Likes

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
Nov 23, 2017 0
Adobe Community Professional ,
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.

Likes

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
Reply
Loading...
Nov 23, 2017 0
medos20 LATEST
Engaged ,
Nov 23, 2017

Copy link to clipboard

Copied

Thank you very much for your valuable information's!

Likes

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
Reply
Loading...
Nov 23, 2017 1