EasyManua.ls Logo

Adobe 0046100128056 - InDesign - Mac - Formatting Text

Adobe 0046100128056 - InDesign - Mac
209 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
CHAPTER 6: Text and Type Formatting Text 90
var myInsertionPoint = myTextFrame.paragraphs.item(0).insertionPoints.item(0);
var myInlineFrame = myInsertionPoint.textFrames.add();
//Recompose the text to make sure that getting the
//geometric bounds of the inline graphic will work.
myTextFrame.texts.item(0).recompose;
//Get the geometric bounds of the inline frame.
var myBounds = myInlineFrame.geometricBounds;
//Set the width and height of the inline frame. In this example, we'll
//make the frame 24 points tall by 72 points wide.
var myArray = [myBounds[0], myBounds[1], myBounds[0]+24, myBounds[1]+72];
myInlineFrame.geometricBounds = myArray;
myInlineFrame.contents = "This is an inline frame.";
myInsertionPoint = myTextFrame.paragraphs.item(1).insertionPoints.item(0);
var myAnchoredFrame = myInsertionPoint.textFrames.add();
//Recompose the text to make sure that getting the
//geometric bounds of the inline graphic will work.
myTextFrame.texts.item(0).recompose;
//Get the geometric bounds of the inline frame.
var myBounds = myAnchoredFrame.geometricBounds;
//Set the width and height of the inline frame. In this example, we'll
//make the frame 24 points tall by 72 points wide.
myArray = [myBounds[0], myBounds[1], myBounds[0]+24, myBounds[1]+72];
myAnchoredFrame.geometricBounds = myArray;
myAnchoredFrame.contents = "This is an anchored frame.";
with(myAnchoredFrame.anchoredObjectSettings){
anchoredPosition = AnchorPosition.anchored;
anchorPoint = AnchorPoint.topLeftAnchor;
horizontalReferencePoint = AnchoredRelativeTo.anchorLocation;
horizontalAlignment = HorizontalAlignment.leftAlign;
anchorXoffset = 72;
verticalReferencePoint = VerticallyRelativeTo.lineBaseline;
anchorYoffset = 24;
anchorSpaceAbove = 24;
}
Formatting Text
In the previous sections of this chapter, we added text to a document, linked text frames, and worked with
stories and text objects. In this section, we apply formatting to text. All the typesetting capabilities of
InDesign are available to scripting.
Setting text defaults
You can set text defaults for both the application and each document. Text defaults for the application
determine the text defaults in all new documents; text defaults for a document set the formatting of all
new text objects in that document. (For the complete script, see TextDefaults.)

Table of Contents

Related product manuals