Next Prev Up Top Contents Index

4.1 Conceptual Overview of Text Styles

CLIM's model for the appearance of text is that the application program should describe how the text should appear in high-level terms, and that CLIM will take care of the details of choosing a specific device font. This approach emphasizes portability.

You specify the appearance of text by giving it an abstract text style . Each CLIM medium defines a mapping between these abstract style specifications and particular device-specific fonts. At runtime, CLIM chooses an appropriate device font to represent the characters. However, some programmers may require direct access to particular device fonts. The text-style mechanism allows you to specify device fonts by name, thus trading portability for control.

A text style is a combination of three characteristics that describe how characters appear. Text style objects have components for family , face , and size :

family Characters of the same family have a typographic integrity, so that all characters of the same family resemble one another. One of :fix , :serif , :sans-serif , or nil .

face A modification of the family, such as bold or italic. One of :roman (meaning normal), :bold , :italic , ( :bold :italic ), or nil .

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

Not all of these attributes need be specified for a given text style object. Text styles can be merged in much the same way as pathnames are merged; unspecified components in the style object (that is, components that have nil in them) may be filled in by the components of a "default" style object.

*default-text-style*  

Summary: This is the default text style used by all streams.

Note that the sizes :smaller and :larger are treated differently than the others, in that they are merged with the default text style size to produce a size that is discernibly smaller or larger. For example, a text style size of :larger would merge with a default text size of :small to produce the resulting size :normal .

A text style object is called fully specified if none of its components is nil and the size component is not a relative size (that is, neither :smaller nor :larger ).

When text is rendered on a medium, the text style is mapped to some medium-specific description of the glyphs for each character. This description is usually that medium's concept of a font object. This mapping is mostly transparent to the application developer, but it is worth noting that not all text styles have mappings associated with them on all mediums. If the text style used does not have a mapping associated with it on the given medium, a special text style reserved for this case will be used.

*undefined-text-style* 

Summary: The text style that is used as a fallback if no mapping exists for some other text style when some text is about to be rendered on a display device (via write-string and draw-string* , for example). This text style must be fully merged, and it must have a mapping for all display devices.


Common Lisp Interface Manager 2.0 User Guide - 14 Dec 2001

Next Prev Up Top Contents Index