▼ |  | The Racket Drawing Toolkit

1 | Overview
2 | bitmap%
3 | bitmap-dc%
4 | brush%
5 | brush-list%
6 | color%
7 | color-database<%>
8 | dc<%>
9 | dc-path%
10 | font%
11 | font-list%
12 | font-name-directory<%>
13 | gl-config%
14 | gl-context<%>
15 | linear-gradient%
16 | pdf-dc%
17 | pen%
18 | pen-list%
19 | point%
20 | post-script-dc%
21 | ps-setup%
22 | radial-gradient%
23 | record-dc%
24 | region%
25 | svg-dc%
26 | Drawing Functions
27 | Drawing Contracts
28 | Signature and Unit
29 | Unsafe Libraries
30 | Drawing Conveniences
31 | Platform Dependencies
| Bibliography
| Index

On this page:

new
find-or-create-font

top ← prev up next →

class font-list% : class?
superclass: object%

A font-list% object maintains a list of font% objects to avoid repeatedly creating fonts.

A global font list, the-font-list, is created automatically.

> constructor (new font-list%) → (is-a?/c font-list%)

Creates an empty font list.

> > method
> > (send a-font-list find-or-create-font |  | size |
> > |  | family |
> > |  | style |
> > |  | weight |
> > | [ | underline? |
> > |  | smoothing |
> > |  | size-in-pixels? |
> > |  | hinting]) |
> → (is-a?/c font%)
> size : (real-in 0.0 1024.0)
> | family |  | : |  |
> (or/c 'default 'decorative 'roman 'script
> 'swiss 'modern 'symbol 'system)
> style : (or/c 'normal 'italic 'slant)
> weight : (or/c 'normal 'bold 'light)
> underline? : any/c = #f
> | smoothing |  | : |  | (or/c 'default 'partly-smoothed 'smoothed 'unsmoothed)
> |  |  | = |  | 'default
> size-in-pixels? : any/c = #f
> hinting : (or/c 'aligned 'unaligned) = 'aligned
> (send a-font-list find-or-create-font |  | size |
> |  | face |
> |  | family |
> |  | style |
> |  | weight |
> | [ | underline |
> |  | smoothing |
> |  | size-in-pixels? |
> |  | hinting]) |
> → (is-a?/c font%)
> size : (real-in 0.0 1024.0)
> face : string?
> | family |  | : |  |
> (or/c 'default 'decorative 'roman 'script
> 'swiss 'modern 'symbol 'system)
> style : (or/c 'normal 'italic 'slant)
> weight : (or/c 'normal 'bold 'light)
> underline : any/c = #f
> | smoothing |  | : |  | (or/c 'default 'partly-smoothed 'smoothed 'unsmoothed)
> |  |  | = |  | 'default
> size-in-pixels? : any/c = #f
> hinting : (or/c 'aligned 'unaligned) = 'aligned

Finds an existing font in the list or creates a new one (that is automatically added to the list). The arguments are the same as for creating a font% instance.

Changed in version 1.4 of package draw-lib: Changed size to allow non-integer and zero values.

top ← prev up next →