textFrame overflows to the continuity of history

Hello.

I'm setting up a newspaper, and I need to print stories in the form of columns in the pages. This works well.

I use the information returned in textFrame.overflows to know if the story was finished (then go to the next) or keep the same story in the new textFrame of printing.

But sometimes I got stories with strange strings, like "=" who can not handle the wrapper "text".

In these stories, the overflow property will be true aways (I never create new frameworks of texts related with the same width, defined in the column). I get an infinite loop here, that I walked it use:

(if((/^\s+$/.test(textFrame.Contents):! textFrame.contents)

overflowing = false;

But it is not very pleasant, once the text is not correctly displayed in the newspaper.

How can I handle these channels in Adobe Script?

Thank you

Dan Koch

But if you keep pressing '=', the text will appear in the next line.

Oh. This is interesting. I wonder why this happens?

But I don't think you should expect InDesign to be able to cut out the words that are defined to be unbreakable and does not fit in the space that assign you...

However, do you like? I guess you can assume that the characters are pretty much an em-width (most are!), take the size measured in em of the type, divide the width of the box, and you have a number of characters. Subtract a margin (10%? 50%?) It depends) and line break there. If it doesn't, repeat?

Maybe this could work. I can do this analysis in Adobe Script?

Sure. It is called ExtendScript, BTW, or you could just say JavaScript. No such thing as Adobe Script.

Something like this:

var
    p=frame.parentStory,
    st=p.characters[frame.characters[-1].index+1],
    overset=p.texts.itemByRange(st,p.texts[0].characters[-1]),
    pos = Math.round(
        (frame.geometricBounds[3]-frame.geometricBounds[1])
        *12/st.pointSize*0.9);
overset.insertionPoints[pos].contents=" ";

In other words, assume that this framework is the framework that we are moving on, which is in excess

Get the character object that contains the cahracter after a last in the framework.

Then, get the text from this character at the last range in history.

Then take the width of the frame (geometricBounds is y1, x 1, x 2, y2), assuming that the units of measure is picas. Multiply by 12 to get points, divide by the pointsize of the first character and multiply by 0.9 for the margin of 10%. Insert a space at this location.

There are many things to do here, but it seems to work.

Tags: InDesign

Similar Questions

Maybe you are looking for