All Manuals > CAPI User Guide and Reference Manual > 21 CAPI Reference Entries




Sets the character format.




set-rich-text-pane-character-format pane &key selection attributes-plist => result



A rich-text-pane.


Must be t. This argument is deprecated.


A plist or :default.



A plist.


The function set-rich-text-pane-character-format sets current character attributes for text in pane .

If there is a current selection in the pane, then the attributes are set for the selected text. If there is no selection, then it sets the "typing attributes", which are applied to characters that are typed by the user. Note that any cursor movement changes these attributes, so the setting is ephemeral.

The selection argument is deprecated. If selection is nil an error is signalled. The default value of selection is t.

If attributes-plist is the symbol :default then the default character format of the pane (that is, the value of the rich-text-pane initarg :character-format) is used. Otherwise attributes-plist is a plist of keywords and values. These are the valid keywords on Microsoft Windows and Cocoa:


A boolean.


A boolean.


A boolean.


A string naming a font.


A color spec or alias specifying the foreground color.


The size of the font.

Additionally these attributes-plist keywords are valid on Microsoft Windows only:


A boolean.


An integer specifying the vertical offset of characters from the line (a positive value makes them superscript and a negative value makes them subscript).


A boolean. See the description of protected-callback in rich-text-pane.


A cons ( charset . pitch-and-family ) where charset has the value of a Microsoft Windows charset identifier, and pitch-and-family is the value of (logior pitch family ) where pitch and family have the value of a Windows pitch and a Windows font family respectively.

Compatibility note

The value nil for the keyword argument :selection is not supported in LispWorks 6.1 and later. See the description above for details of the current behavior with respect to the current selection in the rich-text-pane.


Note: This example uses some features which are supported only on Microsoft Windows:

(defun ok-to-edit-p (pane start end s)
  (declare (ignore pane))
   (format nil "Editing~:[ ~; selection ~]from ~a to ~a"
           s start end)))
(setq rtp 
        :protected-callback 'ok-to-edit-p
        '(:size 14  :color :red)
        :visible-min-height 300
        :visible-min-width 400
        '(:start-indent 20 :offset -15)
        :text-limit 160
        :text (format nil "First paragraph.~%Second paragraph, a little longer.~%Another paragraph, which should be long long enough that it spans more than one line. ~%" ))))

Enter some characters in the rich text window and select a range.

Set the selection to blue:

 :attributes-plist '(:color :blue))

Make it protected:

 rtp :attributes-plist '(:protected t))

Now try to delete a character, and also to delete the selection. In both cases the ok-to-edit-p callback is called.

See also


CAPI User Guide and Reference Manual (Unix version) - 25 Feb 2015