0% found this document useful (0 votes)
16 views1 page

Solutions 85

This document discusses different ways to observe changes that affect text recomposition in InDesign, including observing document changes, text attribute changes, and style changes. It notes that the best strategy is to check if recomposition has occurred rather than trying to observe every possible change. Any change that can affect line breaks will increment the change counter on the frame list, but there is no direct notification, so the counter must be checked periodically to detect changes. For example, caching the change counter before and after importing a story can detect if layout or styling changes were made.

Uploaded by

Charana Studios
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views1 page

Solutions 85

This document discusses different ways to observe changes that affect text recomposition in InDesign, including observing document changes, text attribute changes, and style changes. It notes that the best strategy is to check if recomposition has occurred rather than trying to observe every possible change. Any change that can affect line breaks will increment the change counter on the frame list, but there is no direct notification, so the counter must be checked periodically to detect changes. For example, caching the change counter before and after importing a story can detect if layout or styling changes were made.

Uploaded by

Charana Studios
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

CHAPTER 2: Text Text composition 85

static void MyRecomposeAllStories(IDocument* document)


{
InterfacePtr<IGlobalRecompose> globalRecompose(document, UseDefaultIID());
if (globalRecompose != nil) {
globalRecompose->RecomposeAllStories();
globalRecompose->ForceRecompositionToComplete();
}
}

Getting notified when text is recomposed


It is hard to observe recomposition, because to do so, you need to maintain an observer on each frame
(kFrameItemBoss). See “Observing changes that affect text” for an alternative approach that relies on
observing the cause rather than the effect.

Observing changes that affect text


Because many types of changes affect text, observing changes quickly becomes complex; for example:

 Changes to the geometry of the text layout (such as resize and text inset) are observed using a
document observer.

 Changes to character and text attributes are observed by attaching an observer to each text model of
interest.

 Changes to text styles are observed by attaching observers to the style name tables in the workspace.

An optimal strategy is to be aware recomposition has occurred and not try to observe everything that
might happen.

Any change to text, attributes, styles, or layout that affects lines breaks causes damage. The change
counter on the frame list (IFrameList::GetChangeCounter) is incremented any time something happens
that requires recomposition. No notification is broadcast when the change counter is incremented, so you
cannot catch the change immediately. In general, though, immediate feedback is not needed; the fact that
something changed in a way that affects text needs to be determined only at fixed times.

For example, export a story from InDesign to a copy-editor application. When the story is imported back
into InDesign, you may want to tell the user about changes to the layout or text styling that were made
through InDesign. To arrange this, cache the value of IFrameList::GetChangeCounter when you export the
story. You can then compare this cached value to the actual value when the story is imported. To notify
users when layout changes are made that affect text, check IFrameList::GetChangeCounter using an idle
task.

Controlling the paragraph composer used to compose text


In the “Text Fundamentals” chapter of Adobe InDesign Programming Guide, see the section on “Paragraph
Composers” for information on how to control the paragraph composer used to compose text.
Programmatically, set the kTextAttrComposerBoss paragraph attribute to reference the paragraph
composer to be used.

You might also like