racket/collects/scribblings/draw/font-list-class.scrbl
Matthew Flatt b3002cfab0 add hinting configuration to `font%'
The default is that hiniting is enabled, which causes some text
metrics (notably width) to be rounded to integer values, which makes
spacing more consistent. This default is backward-compatible. The
non-default 'unaligned mode refrains from rounding, which makes metric
information scale correctly and improves output for PS/PDF (such as
Redex output).

The `text' function from `slideshow/pict' defaults to
disabling hinting --- which is consistent with its default to combine
text instead of drawing character-by-character -- so slides and Redex
inherit the improvement.
2012-03-27 11:16:27 -06:00

45 lines
2.0 KiB
Racket

#lang scribble/doc
@(require "common.rkt")
@defclass/title[font-list% object% ()]{
A @racket[font-list%] object maintains a list of @racket[font%]
objects to avoid repeatedly creating fonts.
A global font list, @racket[the-font-list], is created automatically.
@defconstructor[()]{
Creates an empty font list.
}
@defmethod*[([(find-or-create-font [size (integer-in 1 255)]
[family (one-of/c 'default 'decorative 'roman 'script
'swiss 'modern 'symbol 'system)]
[style (one-of/c 'normal 'italic 'slant)]
[weight (one-of/c 'normal 'bold 'light)]
[underline? any/c #f]
[smoothing (one-of/c 'default 'partly-smoothed 'smoothed 'unsmoothed) 'default]
[size-in-pixels? any/c #f]
[hinting (or/c 'aligned 'unaligned) 'aligned])
(is-a?/c font%)]
[(find-or-create-font [size (integer-in 1 255)]
[face string?]
[family (one-of/c 'default 'decorative 'roman 'script
'swiss 'modern 'symbol 'system)]
[style (one-of/c 'normal 'italic 'slant)]
[weight (one-of/c 'normal 'bold 'light)]
[underline any/c #f]
[smoothing (one-of/c 'default 'partly-smoothed 'smoothed 'unsmoothed) 'default]
[size-in-pixels? any/c #f]
[hinting (or/c 'aligned 'unaligned) 'aligned])
(is-a?/c font%)])]{
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 @racket[font%] instance.
}}