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

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:


Horizontal Text Alignment

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


Vertical Text Placement

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


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