Skip to main content
Known Participant
September 6, 2009
Question

Modifying text before rendering

  • September 6, 2009
  • 1 reply
  • 779 views

In my application there are different use cases where it would be good if I could modify the text before rendering without actually altering the textflow. For example if you want to implement faux small caps by using a style name (example: <p styleName="fauxSmallCaps">Heading</p>). So it would be nice if you got the paragraph as a text flow to export a clean version of it, but if you render it it would be something like <p>H<span fontSize="12">EADING</span></p> so that it would be rendered correctly.

It would be also a nice way to create automatically numbered lists or headings, but then it would be necessary to create a type of text that isn't selectable and changeable.

Is there a way to implement something like this without using hacks like a hidden TextFlow that contains the clean code and/or layering another TextFlow on top of the current one?

This topic has been closed for replies.

1 reply

Adobe Employee
September 9, 2009

You could try implementing a IFormatResolver on TextFlow and using that to generate attributes on your styled text.  That exporter would export  your markup as you've written it.  The format resolver allows for rendering with attributes based on the style.  Even that may not be quite right as it doesn't allow for splitting spans based on a style into separate formatted spans - at least I hadn't thought about that case - might not be that hard but would take some investigation.

http://blogs.adobe.com/tlf/2009/02/iformatresolver-and-using-css-1.html

http://opensource.adobe.com/wiki/display/tlf/Text+Layout+Framework (up to date examples in download section)

Hope that helps,

Richard

Known Participant
September 12, 2009

Thank you for the response.

That would be a possible solution to the small caps problem, but the text itself is not changed, so that it's not possible to create a numbered heading without really inserting some text or layering another TextFlow on top. I thought about this layering method, but it would be very difficult to position the numbers and it would probably not be very cpu optimized.

Btw: is it itentional, that posting in this forum with a browser like Opera is impossible, because the text field doesn't appear?