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

Force format resolver to resolve again

Guest
Mar 16, 2012 Mar 16, 2012

Copy link to clipboard

Copied

Hi,

Currently I am using a format resolver to pick up custom user style attributes on paragraph elements and translating them into TextLayoutFormat properties. This is working well, as I am able to perform tasks such as getting properties from external style sheets. For example, ...<p myExternalStyle="someExternalStyle">..., and someExternalStyle, stored externally, would contain properties such as font size, font color, etc.

In the application workflow, sometimes the properties within the external style sheets may change, and, when this happens, I would like to recompose or refresh the text  such that my format resolver gets called again. This would allow the format resolver to reassign updated properties  from the external style sheet, and cause the text properties to be updated. However, I have tried:

textFlow.flowComposer.damage(0, textFlow.textLength, FlowDamageType.INVALID);

followed by either textFlow.flowComposer.compose() or textFlow.flowComposer.updateAllControllers(), but the format resolver is not called again on the text. Is there a way to force or damage the text flow such that a recompse or update would force the format resolvers to get called again?

Thank you for the help.

Will

TOPICS
Text layout framework

Views

3.1K

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
Adobe Employee ,
Mar 16, 2012 Mar 16, 2012

Copy link to clipboard

Copied

Only when function "get formatForCascade():ITextLayoutFormat" in class FlowElement is called, you retrieve the custom styles again. So try to get it called in your code.

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
Guest
Mar 17, 2012 Mar 17, 2012

Copy link to clipboard

Copied

Thank you for your reply.

Isn't get formatForCascade() a TLF internal method?

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
Adobe Employee ,
Mar 18, 2012 Mar 18, 2012

Copy link to clipboard

Copied

I don't mean you just call formatForCascade(). formatForCascade only get the exact "top" format value from all formats that cascade. Then a composition process is also a must to get the textlines refreshed.

You can find which functions will call formatForCascade() in TLF and why formatForCascade is not called or returns a wrong value in your code.

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
Guest
Mar 18, 2012 Mar 18, 2012

Copy link to clipboard

Copied

Looks like _computedFormat isn't being nulled in FlowElement as part of damage with invalid, so the format isn't being recalculated and the format resolver isn't being called again on recompose after damage. _computedFormat can be nulled out a few ways via consequences of public API. In this case, the best ways are either re-setting the text flow format with the equivalent value:

     textFlow.format = new TextLayoutFormat(textFlow.format);

Or setting some dummy user style:

     textFlow.setStyle("dummy", null);

Does this sound correct? Any other suggestions? Thanks again for your help.

Will

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
Adobe Employee ,
Mar 18, 2012 Mar 18, 2012

Copy link to clipboard

Copied

LATEST

Correct.

Besides, I think you may not need to call textFlow.flowComposer.damage() after resetting format. textFlow.flowComposer.updateAllControllers() will be enough.

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