Action:
|
Sets a text entity's font.
|
|
Filename:
|
kern/kern_scm/text_scm.cxx
|
|
Syntax:
|
(text:set-font text-entity font)
|
|
Arg Types:
|
text-entity
|
text
|
|
font
|
string
|
|
Returns:
|
text
|
|
|
text-entity specifies a text entity.
|
|
|
font specifies a text font to be used, which is enclosed in quotes.
font is interpreted by the current windowing driver; for example, if the system is running X Windows, available fonts are those listed by running the
xlsfonts tool. If the specified font name is not a perfect match, this extension inserts wildcards into the font at various places to search for an approximate match.
|
|
|
X Windows specifies fonts as the foundry, the family, the weight, the slant, the set-width, any additional style, the pixel size, the point size, the
x-resolution, the
y-resolution, the spacing, the average width, the registry, and the encoding. For example:
|
|
|
-adobe-courier-medium-r-normal--8-80-75-75-m-50-iso8859-1
|
|
|
The only fields used in this extension are family, weight, slant, and set-width. In the preceding example, these fields are the substring:
|
|
|
courier-medium-r-normal
|
|
Example:
|
; text:set-font
|
|
; Create the first text entity.
|
|
(define words (text (position -20 0 0)
|
|
|
"abcdefghijklm" "symbol-medium-r-normal" 30))
|
|
;; words
|
|
; Create the second text entity.
|
|
(define words2 (text (position -20 -20 -20)
|
|
|
"nopqrstuvwxyz" "symbol-medium-r-normal" 30))
|
|
;; words2
|
|
; OUTPUT Original
|
|
|
; Set the font of the first text entity.
|
|
(text:set-font words "courier-bold-r-normal")
|
|
;; #[entity 2 1]
|
|
; Set the font of the second text entity.
|
|
(text:set-font words2 "helvetica-bold-r-normal")
|
|
;; #[entity 3 1]
|
|
; OUTPUT Result
|
|
|
|
|
Figure 15-1. text:set-font
|