I'm trying to find the line flow change after inserting ruby text. I've tried these steps.
- By checking textspan before and after; waxLine->GetTextSpan; but return same value; also called invalidateruns.
- Then waxRun->GetCharCount
- Then waxGlyphs->GetGlyphAt last index
- also tried with few x, y offset calls
all returns same result before and after. Please refer the attached screen shot and suggest how to detect the line change.
The composer is a program that produces the wax structure of composed text, considering actual text, styles, attributes including your ruby, and the place to get filled (frames subdivided into parcels, tiles and so forth).
Composition works in an idle task (nowadays one would call that async) so you have to wait for completion before accessing the output structure "wax". E.g. You add a character at page 1, causing reflow on pages 1 thru 300 trickle thru until the portion of text relevant to you on page 301 is reached and updated. Using an idle task means the application remains responsive (even with CPU power 20 years ago) so the user can type another character and everything starts over. You wait for composer completion via an observer.
The alternative would mean to force composition - e.g. when the composition results such as text coordinates, line wraps etc. is to be displayed in UI, or a script refers to them. In that case the scripting subsystem / UI controller triggers a forced recompose until that portion of text. Your program can do the same, search the SDK for methods named "recompose".
Thank you Dirk for the imm response. Sure, will try that.. so after recompose the same textspan is right approach?
You can try a cheap experiment without much new programming:
After your change of the ruby don't expect immediate result, e.g. just insert a return to abort your routine.
Let InDesign reach the event loop and idle processing, so the user interface does the composition and updates the layout window to reflect your first changes.
When you then trigger your wax calls by a separate button or menu action, you should then receive the expected results. If so, you nailed it and can consider the architectural options from above.
It worked thank you bro!