NextPrevUpTopContentsIndex

4.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 gp:font-description object specifying various attributes of the font.

On systems running X Windows, 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 initarg, 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 4.1 An example of the use of font descriptions


LispWorks CAPI User Guide (Macintosh version) - 17 Mar 2008

NextPrevUpTopContentsIndex