Attributes Object

An Attributes object collects together formatting that is applied to some piece of text. If a particular attribute property is not defined by the formatting applied to the text, that property will have the @undefined value.

Currently Attributes objects can be obtained via the following commands:

Attributes.selectedAttributes

Attributes.selectedDisplayAttributes

Text.attributesAtIndex

Text.displayAttributesAtIndex

TextSelection.firstAttributes

TextSelection.firstDisplayAttributes

TextSelection.typingAttributes

TextSelection.displayTypingAttributes

Style.addedAttributes

Style.attributes

Style.displayAttributes

Attributes Type Commands

Attributes.selectedAttributes v3.0.2

Returns the first Attributes object applied to text selected in the active document. If the selection is zero length (ie: an insertion point) this returns the typing attributes. If there’s no active document or selection, this returns the undefined value.

Attributes.selectedDisplayAttributes v3.0.2

This command works just like Attributes.selectedAttributes but returns display attributes. For more on display attributes see displayAttributesAtIndex.

Attributes Object Properties

.fontSize v1.1

The size of the font, in points. Read-only.

.font v2.0.5

Returns the applied Font object. Read-only.

.fontName v1.1

The name of the font as it would be displayed to the user. Read-only.

.fontFamilyName v1.1

The name of the font family the font belongs to. Read-only.

.postScriptFontName v1.1

The name of the font in the PostScript language. Read-only.

.isFontSubstituted v1.2

Returns @true if the font originally applied by the user had to be substituted because the characters the font is applied to are not contained in the requested font. This property is only defined in display attributes. Read-only.

.substitutedFont v2.0.5

If the font was substituted because the characters are not contained in the font, this will return the originally desired Font object (ie: before substitution). Returns the @undefined value if no font substitution occurred. This property is only defined in display attributes. Read-only.

.isFontMissing v1.2

Returns @true if the font originally applied by the user is not installed on the system. This property is only defined in display attributes. Read-only.

.bold v1.1

Returns @true if bold, otherwise @false. Read-only.

.italic v1.1

Returns @true if italic, otherwise @false. Read-only.

.underline v1.1

Returns one of the following read-only values:

0 = no underline, 1 = single underline, 2 = double underline.

.strikethrough v1.1

Returns one of the following read-only values:

0 = no strikethrough, 1 = single strikethrough, 2 = double strikethrough.

.baseline v2.1.2

Returns the baseline adjustment from neutral, in points. Positive values mean the text is elevated from the natural baseline; negative values mean the text is lowered. Read-only.

.superscript v1.1

Returns one of the following read-only values:

0 = no super/sub, 1 = superscripted, -1 = subscripted.

.characterCase v1.1

Returns one of the following read-only values:

0 = no case change, 1 = lowercase, 2 = title case, 3 = small caps, 4 = uppercase.

.textColor v1.2

Returns the Color object used to draw the actual characters in the text, usually black. Read-only.

.textBackgroundColor v1.2

Returns the Color object drawn behind the text, usually white. Read-only.

.textHighlightColor v1.2

Returns the Color object used to highlight the text. Can be @undefined if no highlighting is drawn. Read-only.

.shadow v3.2

Returns the Shadow object that is drawn for the text, or the undefined value if none. Read-only. To change the shadow of text use the Set Text Shadow command.

.language v1.2

The applied Language object, read-only.

.languageCode v1.1

Returns the code property of the applied Language object. Read-only.

.firstLineHeadIndent v1.2

Returns the number of points (72 points in an inch) the first line of the paragraph is indented on its “head” side. The head side is the primary/dominant side of the paragraph, meaning the left side for left-to-right text and the right side for right-to-left text. Read-only.

.headIndent v1.2

Returns the number of points (72 points in an inch) all lines of the paragraph besides the first are indented on their “head” side. The head side is the primary/starting side of the paragraph, meaning the left side for left-to-right text and the right side for right-to-left text. Read-only.

.tailIndent v1.2

Returns the number of points (72 points in an inch) all lines of the paragraph are indented on their “tail” side. The tail side is the secondary/ending side of the paragraph, meaning the right side for left-to-right text and the left side for right-to-left text. Read-only.

.fixedLineHeight v1.2

Returns the number of points (72 points in an inch) to use as the absolute line height for all lines of text in the paragraph. If the paragraph does not use fixed line heights, and instead uses line height multiples, the @undefined values is returned. Read-only.

.lineHeightMultiple v1.2

Returns the factor to apply to all line heights in the paragraph, eg: 2.0 is returned for double line spacing. If the paragraph does not use line height multiples, and instead uses fixed line spacing, the @undefined values is returned. Read-only.

.paragraphAlignment v1.2

Returns one of the following read-only values describing the alignment of the paragraph:

0 = left, 1 = right, 2 = center, 3 = justified.

.paragraphWritingDirection v1.2

Returns one of the following read-only values describing the writing direction of the paragraph:

0 = natural (determined by language), 1 = left-to-right, 2 = right-to-left.

.paragraphSpacingBefore v1.2

Returns the number of points (72 points in an inch) to include before the paragraph as vertical spacing. Read-only.

.paragraphSpacingAfter v1.2

Returns the number of points (72 points in an inch) to include after the paragraph as vertical spacing. Read-only.

.paragraphShadingAttributes v2.0.7

Returns a ShadingAttributes object describing how the paragraph’s background is filled, or the @undefined value if no background is drawn. Read-only.

.paragraphLineAttributesForEdge edgeName v2.0.7

Returns a LineAttributes object describing the appearance of the given edge of the paragraph’s border. Returns the @undefined value if no edge appears. Read-only.

Edge names are: "top", "bottom", "left", "right", and "between". If you give a invalid/unknown edge name, this returns the @undefined value.

.characterStyle v1.2

The character Style object, or the @undefined value if none. Read-only.

.paragraphStyle v1.2

The paragraph Style object, or the @undefined value if none. Read-only.

.listStyle v1.2

The list Style object, or the @undefined value if none. Read-only.

.listLevel v2.1.2

Returns the list level. Read-only.

The value is one-based: a value of 1 is the first level in all list styles. Returns 0 if the text is not in a list.

.noteStyle v2.0.5

The note Style object, or the @undefined value if none. Read-only.

.characterStyleName v1.1

The name of the character style. Read-only.

.paragraphStyleName v1.1

The name of the applied paragraph style. Read-only.

.listStyleName v2.0

The name of the applied list style. Read-only.

.noteStyleName v2.0.5

The name of the applied note style. Read-only.

.link v1.3

The string representation of the applied link, or the @undefined value if none. Read-only.

.linkObject v2.0.5

The Link object for the applied hyperlink, or the @undefined value if none. Read-only.

.tocLevelForStyleName tocStyleName v2.0

For the given TOC style name (eg: “Default TOC”), returns the applicable TOC level. The level is 1-based, but zero can be returned if a “do not include” override is in effect. The @undefined value is returned if the text is not marked for the named TOC style. Read-only.

Note: for a list of all TOC style names in a document, see tocStyleNames.

.textIndexTopicsForStyleName indexStyleName v2.0

For the given Text Index style name (eg: “Default Index”), returns an Array of associated topic arrays (ie: an array of arrays). These nested arrays are necessary because any text in the document can be indexed more than a single way. 

An example return value might be: (("Monsters", "Vampires"), ("Dracula")) which means the text is indexed directly under “Dracula”, but also indexed under the topic “Monsters” sub-topic “Vampires”.

If a topic is generated automatically as the marked text changes, one topic array will be an empty array. If no indexing is in effect for the named style, returns the @undefined value. Read-only.

Note: for a list of all Text Index style names in a document, see textIndexStyleNames.


Previous Chapter
Content Objects
<<  index  >>
 
Next Chapter
Bookmark Object