All Manuals > CLIM 2.0 User Guide > 4 Text Styles

4.2 CLIM Text Style Objects

It is often useful to create a text style object that represents a style you wish to use frequently, rather than continually specifying the corresponding text style suboptions.

For example, if you want to write on a stream with a particular family, face, and size, you can create a text style object using make-text-style:

(clim:with-text-style 
 ((clim:make-text-style :fix :bold :large) my-stream) 
 (write-string "Here is a text-style example." my-stream))

Note that text style objects are interned. That is, two different invocations of make-text- style with the same combination of family, face and size will result in the same (in the sense of eq) text style object. For this reason, you should not modify text style objects.

text-style Protocol Class

Summary: The protocol class for text styles. If you want to create a new class that behaves like a text style, it should be a subclass of text-style. Subclasses of text-style must obey the text style protocol.

text-style-p Function

text-style-p object

Summary: Returns t if object is a text style; otherwise, it returns nil.

standard-text-style Class

Summary: An instantiable class that implements text styles. It is a subclass of text-style. This is the class that make-text-style instantiates. Members of this class are immutable.

make-text-style Function

make-text-style family face size

Summary: Returns an object of class standard-text-style with a family of family, a face of face, and a size of size.

family is one of :fix, :serif, :sans-serif, or nil.

face is one of :roman, :bold, :italic, (:bold :italic), or nil.

size is a real number representing the size in printer's points, one of the logical sizes (:normal, :tiny, :very-small, :small, :large, :very-large, :huge), a relative size (:smaller or :larger), or nil.

You can use text style suboptions to specify characteristics of a text style object. Each text style suboption has a reader function which returns the current value of that component from a text style object. The suboptions are listed as follows.

:text-family Option

text-style-family Generic Function

text-style-family text-style

Summary: Specifies the family of the text style text-style.

:text-face Option

text-style-face Generic Function

text-style-face text-style

Summary: Specifies the face of the text style text-style.

:text-size Option

text-style-size Generic Function

text-style-size text-style

Summary: Specifies the size of the text style text-style.


CLIM 2.0 User Guide - 01 Dec 2021 19:38:57