set-rich-text-pane-character-format pane &key selection attributes-plist default => result
The function
set-rich-text-pane-character-format
sets current character attributes for
pane
.
selection
determines the text for which the attributes are set. If selection is
nil
, then the attributes are set on the next text entered in
pane
. If
selection
is
t
, then the attributes are set on the current selection. The default value of
selection
is
t
.
attributes-plist is a plist of keywords and values. These keywords are valid on MS 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 MS 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.
A cons
(
charset
.
pitch-and-family
)
where
charset
has the value of a 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.
Note: This example uses some features which are supported only on MS Windows:
(defun ok-to-edit-p (pane start end s)
(declare (ignore pane))
(capi:prompt-for-confirmation
(format nil "Editing~:[ ~; selection ~]from ~a to ~a"
s start end)))
(setq rtp
(capi:contain
(make-instance
'capi:rich-text-pane
:protected-callback 'ok-to-edit-p
:character-format
'(:size 14 :color :red)
:visible-min-height 300
:visible-min-width 400
:paragraph-format
'(: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.
(capi:set-rich-text-pane-character-format
rtp
:attributes-plist '(:color :blue)
:selection nil)
(capi:set-rich-text-pane-character-format
rtp :attributes-plist '(:protected t) :selection nil)
Now try to delete a character, and also to delete the selection. In both cases the
ok-to-edit-p
callback is called.