Google

txtattr Specification Sheet


Portable Object Compiler (c) 1997,98,99. All Rights Reserved.

TextAttribute

Inherits from: Object

Maturity Index: Experimental

Class Description

Abstract superclass for Text Attributes, as used by the Text and the RunArray classes.

Typically, an application will subclass TextAttribute and use its own subclass with the Text instance method addAttribute:.

Method types

Text Emphasis

Accessing

Comparison

Coalescing

Setting Scanner Attributes

Printing

Methods

normal

+normal
A Text Attribute instance with emphasiscode set to 0.

new

+new
A Text Attribute instance with emphasiscode set to 0.

bold

+bold
Creates a Textattribute with emphasiscode set to 1.

emphasiscode:

+emphasiscode:(unsigned)n
A Text Attribute instance with emphasiscode set to n. This value may suffice for simple applications, but normally a subclass of TextAttribute would be used to associate more sophisticated values to a Text Attribute (such as URL of a hypertext link, or such as a Color value, or an X-Windows font etc.).

emphasiscode

- (unsigned)emphasiscode

emphasiscode:

-emphasiscode:(unsigned)c

isEqual:

- (BOOL)isEqual:attrib
The equality test for TextAttributes is used by RunArray's coalesce method to merge adjacent TextAttribute instances.

dominates:

- (BOOL)dominates:attrib
Should return YES if the receiver dominates attrib. This implies that, when the receiver is added to a list of Text Attributes, attributes that are dominated by the receiver will be removed.

The default returns NO, unless both objects are members of the same class and equal to each other (in which case they don't need to be added more than once to the attribute list).

reset

-reset
Message that is sent to the attribute before it is added to a list of attributes. Doesn't do anything by default.

set

- (BOOL)set
Message that is sent to the attribute before it is added to a list of attributes. If it returns YES (the default), the attribute will be added. May be overridden to turn off attributes.

emphasizeScanner:

-emphasizeScanner:aScanner
The default implementation of this method simply returns self.

Normally a scanner class (which renders text in some specific format) would send emphasizeScanner: messages with itself as argument to a list of text attributes. The text attributes can then act upon the scanner and set text color, font and other formatting properties.

printOn:

-printOn:(IOD)aFile