Text

Text is a fundamental element of an OmniGraffle document. Most documents contain some amount of text, if only labels for objects and drawings. This section details how to create and manipulate text in an OmniGraffle document.

A Basic Text Container

Here’s an example script that creates a graphic containing text. It uses the addText() method of the Canvas class to create a solid shape with no background, shadow, or border, in which the provided text is placed. Note that the script incorporates many of the text-related properties to define the look of the instance:

cnvs = document.windows[0].selection.canvas textShape = cnvs.addText('HOW NOW BROWN COW',Point.zero) textShape.autosizing = TextAutosizing.Full textShape.fontName = 'MarkerFelt-Wide' textShape.textSize = 36 textShape.textHorizontalAlignment = HorizontalTextAlignment.Center textShape.textVerticalPlacement = VerticalTextPlacement.Middle textShape.textHorizontalPadding = 0 textShape.textVerticalPadding = 0 // adjust position aRect = textShape.geometry aRect.origin = Point.zero textShape.geometry = aRect
omnigraffle:///omnijs-run?script=cnvs%20%3D%20document%2Ewindows%5B0%5D%2Eselection%2Ecanvas%0AtextShape%20%3D%20cnvs%2EaddText%28%27HOW%20NOW%20BROWN%20COW%27%2CPoint%2Ezero%29%0AtextShape%2Eautosizing%20%3D%20TextAutosizing%2EFull%0AtextShape%2EfontName%20%3D%20%27MarkerFelt-Wide%27%0AtextShape%2EtextSize%20%3D%2036%0AtextShape%2EtextHorizontalAlignment%20%3D%20HorizontalTextAlignment%2ECenter%0AtextShape%2EtextVerticalPlacement%20%3D%20VerticalTextPlacement%2EMiddle%0AtextShape%2EtextHorizontalPadding%20%3D%200%0AtextShape%2EtextVerticalPadding%20%3D%200%0A%2F%2F%20adjust%20position%0Arect%20%3D%20textShape%2Egeometry%0Arect%2Eorigin%20%3D%20Point%2Ezero%0AtextShape%2Egeometry%20%3D%20rect

TIP: The postion of the text box is indicated by a Point. In the above case, the Point class property of zero was used to indicate the coordinates of {0, 0} on the canvas.

Text-Related Properties

Since the text in an OmniGraffle document is actually text contained within Shapes, the following text-related properties are a subset of properties of the Solid class.

 

Text Autosizing

The TextAutosizing properties are the value for the autosizing property of the Solid class:

textautosizing  

Horizontal Text Alignment

The HorizontalTextAlignment props are the value for the textHorizontalAlignment property of the Solid class:

horizontalTextAlignment  

Vertical Text Placement

The VerticalTextPlacement props are the value for the textVerticalPlacement property of the Solid class:

verticalTextPlacement
UNDER CONSTRUCTION

This webpage is in the process of being developed. Any content may change and may not be accurate or complete at this time.

DISCLAIMER