Common Lisp the Language, 2nd Edition


next up previous contents index
Next: Predicates on Characters Up: Characters Previous: Characters

13.1 Character Attributes

Every character has three attributes: code, bits, and font. The code attribute is intended to distinguish among the printed glyphs and formatting functions for characters. The bits attribute allows extra flags to be associated with a character. The font attribute permits a specification of the style of the glyphs (such as italics).

change_begin
The treatment of character attributes in Common Lisp has not been entirely successful. The font attribute has not been widely used, for two reasons. First, a single integer, limited in most implementations to 255 at most, is not an adequate, convenient, or portable representation for a font. Second, in many applications where font information matters it is more convenient or more efficient to represent font information as shift codes that apply to many characters, rather than attaching font information separately to each character.

As for the bits attribute, it was intended to support character input from extended keyboards having extra ``shift'' keys. This, in turn, was imagined to support the programming of a portable EMACS-like editor in Common Lisp. (The EMACS command set is most convenient when the keyboard has separate ``control'' and ``meta'' keys.) The bits attribute has been used in the implementation of such editors and other interactive interfaces. However, software that relies crucially on these extended characters will not be portable to Common Lisp implementations that do not support them.

X3J13 voted in March 1989 (CHARACTER-PROPOSAL)   and in June 1989 (MORE-CHARACTER-PROPOSAL)   to revise considerably the treatment of characters in the language. The bits and font attributes are eliminated; instead a character may have implementation-defined attributes. The treatment of such attributes by existing character-handling functions is carefully constrained by certain rules.

Implementations are free to continue to support bits and font attributes, but they are formally regarded as implementation-defined attributes. The rules are generally consistent with the previous treatment of the bits and font attributes. My guess is that the font attribute as currently defined will wither away, but the bits attribute as defined by the first edition will continue to be supported as a de facto standard extension, because it fills a useful small purpose.
change_end


[Constant]
char-code-limit

The value of char-code-limit is a non-negative integer that is the upper exclusive bound on values produced by the function char-code, which returns the code component of a given character; that is, the values returned by char-code are non-negative and strictly less than the value of char-code-limit.

change_begin
Common Lisp does not at present explicitly guarantee that all integers between zero and the value of char-code-limit are valid character codes, and so it is wise in any case for the programmer to assume that the space of assigned character codes may be sparse.
change_end

old_change_begin

[Constant]
char-font-limit

The value of char-font-limit is a non-negative integer that is the upper exclusive bound on values produced by the function char-font, which returns the font component of a given character; that is, the values returned by char-font are non-negative and strictly less than the value of char-font-limit.


Implementation note: No Common Lisp implementation is required to support non-zero font attributes; if it does not, then char-font-limit should be 1.

old_change_end

change_begin
X3J13 voted in March 1989 (CHARACTER-PROPOSAL)   to eliminate char-font-limit.

Experience has shown that numeric codes are not an especially convenient, let alone portable, representation for font information. A system based on typeface names, type styles, and point sizes would be much better. (Macintosh software developers made the same discovery and have recently converted to a new font identification scheme.)
change_end

old_change_begin

[Constant]
char-bits-limit

The value of char-bits-limit is a non-negative integer that is the upper exclusive bound on values produced by the function char-bits, which returns the bits component of a given character; that is, the values returned by char-bits are non-negative and strictly less than the value of char-bits-limit. Note that the value of char-bits-limit will be a power of 2.


Implementation note: No Common Lisp implementation is required to support non-zero bits attributes; if it does not, then char-bits-limit should be 1.

old_change_end

change_begin
X3J13 voted in March 1989 (CHARACTER-PROPOSAL)   to eliminate char-bits-limit.
change_end



next up previous contents index
Next: Predicates on Characters Up: Characters Previous: Characters


AI.Repository@cs.cmu.edu