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
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.
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
North America
Europe, Middle East and Africa
Asia Pacific