How to fit frame to content when content contains anchored text box?


hi there

 

i creating series of inline text frames within text frame. each of these inline frames contains text includes anchored text frame. if tell inline frames fit content seem ignore anchored frames contained therein. there way can them consider anchored frames contain when fit content?

 

i tried checking geometric bounds of anchored frame before , after parent frame has fitted content. when there has been no change in position bounds after fitting content seem give numbers way off. thought might able reset geometric bounds of containing frame manually if anchored frame therein had moved fit frame content.

 

here snippet of code:

 

var anchoredbounds = anchoredframe.geometricbounds; mainframe.fit(fitoptions.frame_to_content); mainframe.texts.item(0).recompose; var newanchoredbounds = anchoredframe.geometricbounds; alert(anchoredbounds[0] + "; " + newanchoredbounds[0]); 

 

so “mainframe” text frame containing text , anchored frame, “anchoredframe”. “anchoredbounds[0]” seems correlate top edge of frame when check manually after script has finished (when hasn’t move fit content). “newanchorbounds[0]”, however, gives numbers way off every time. ideas why case?

 

and importantly, can suggest how can “mainframe” consider “anchoredframe” contained in when fits content?

 

i’m using cs4 on pc. let me know if post more code, or if haven’t explained myself enough.

is there way can them consider anchored frames contain when fit content?

 

@graham – long anchored text frames "inline" text frames,

 

mainframe.fit(fitoptions.frame_to_content); 

 

should work expected or @ least sort of *.

without calculating @ all.

just tested in indesign cs5.5 (v7.5.3).

 

could cs4 fail on that?

 

of course, can only rely on this, if main text frame contains "real" text @ all. not the  special characters representations of "inline" text frames. in case fit() method nothing @ all.

 

 

* it's debatable, if fit() method yields desirable output.

it depends on expectations.


see following examples:

 

1. case 1:
text frame before fitting:

 

case1_beforefit.png

 

2. case 1:

after fitting ui command, context menu: "fit frame contents"
(note gap between last baseline of text , text frame; note also  new width)

is result expect? guess not.

case1_afterfit.png

 

3. case 1:

after fitting  programmatically mytextframe.fit(fitoptions.frame_to_content);

case1_afterfitprogrammatically.png

 

 

 

4. case 2:
before fitting

same text frame in #1, different height

case2_beforefit.png

 

 

5. case 2:

after fitting ui command, context menu: "fit frame contents"

a different width in #2 , gap @ bottom of text frame!

not desired result, i'd say…

case2_afterfit_ui.png

 

6. case 2:

after fitting  programmatically mytextframe.fit(fitoptions.frame_to_content);

same result in #3
so scripting could, @ least, consistent results.

case2_afterfitprogrammatically.png

 

of course, same results in ui, if double-click on bottom center control point…

 

 

maybe helps, if showing screen grabs:

1. starting point
2. desired result

 

uwe



More discussions in InDesign Scripting


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support