Next Prev Up Top Contents Index

3.1.3 Fonts

The CAPI interface supports the use of other fonts for text in title panes and other CAPI objects, such as buttons, through the use of the :font keyword. If the CAPI cannot find the specified font it reverts to the default font. The :font keyword applies to data following the :text keyword. The value is a graphics ports font-description object specifying various attributes of the font.

On Unix the xlsfonts command can be used to list which fonts are available. The X logical font descriptor can be explicitly passed as a string to the :font argument, which will convert them.

Here is an example of a title pane with an explicit font:

(contain
 (make-instance 'title-pane
                :text "A title pane"
                :font (gp:make-font-description
                       :family "times"
                       :size 12
                       :weight :medium                        
                       :slant :roman)))

Here is an example of using :font to produce a title pane with larger lettering. Note that the CAPI automatically resized the pane to fit around the text.

(contain
 (make-instance 'title-pane
                :text "A large piece of text"
                :font (gp:make-font-description
                       :family "times"
                       :size 34
                       :weight :medium
                       :slant :roman)))

 

Figure 3.1 An example of the use of font descriptions


LispWorks CAPI User Guide - 14 Dec 2001

Next Prev Up Top Contents Index