Skip navigation
will_spi
Currently Being Moderated

Force format resolver to resolve again

Mar 16, 2012 9:19 PM

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

 
Replies
  • Currently Being Moderated
    Mar 16, 2012 10:21 PM   in reply to will_spi

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 18, 2012 1:31 AM   in reply to will_spi

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 18, 2012 10:53 PM   in reply to will_spi

    Correct.

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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points