9.29 style-delta%
A style-delta% object encapsulates a style change. The changes expressible
by a delta include:
changing the font family
changing the font face
changing the font size to a new value
enlarging the font by an additive amount
enlarging the font by a multiplicative amount, etc.
changing the font style (normal, italic, or slant)
toggling the font style
changing the font to italic if it is currently slant, etc.
changing the font weight, etc.
changing the underline, etc.
changing the vertical alignment, etc.
changing the foreground color
dimming or brightening the foreground color, etc.
changing the background color, etc.
changing text backing transparency
The
set-delta method is convenient for most style delta settings; it takes a
high-level delta specification and sets the internal delta information.
To take full advantage of a style delta, it is necessary to understand
the internal on/off settings that can be manipulated through methods such as
set-weight-on. For example, the font weight change is specified through the weight-on and
weight-off internal settings. Roughly, weight-on turns on a weight
setting when it is not present and weight-off turns off a weight setting
when it is present. These two interact precisely in the following way:
If both
weight-onandweight-offare set to'base, then the font weight is not changed.If
weight-onis not'base, then the weight is set toweight-on.If
weight-offis not'base, then the weight will be set back to'normalwhen the base style has the weightweight-off.If both
weight-onandweight-offare set to the same value, then the weight is toggled with respect to that value: if the base style has the weightweight-on, then weight is changed to'normal; if the base style has a different weight, it is changed toweight-on.If both
weight-onandweight-offare set, but to different values, then the weight is changed toweight-ononly when the base style has the weightweight-off.
Font styles, smoothing, underlining, and alignment work in an analogous manner.
The possible values for alignment-on and alignment-off are:
The possible values for style-on and style-off are:
The possible values for smoothing-on and smoothing-off are:
The possible values for underlined-on and underlined-off are:
#f(acts like'base)#t
The possible values for size-in-pixels-on and size-in-pixels-off are:
#f(acts like'base)#t
The possible values for transparent-text-backing-on and
transparent-text-backing-off are:
#f(acts like'base)#t
The possible values for weight-on and weight-off are:
The family and face settings in a style delta are interdependent:
When a delta's face is
#fand its family is'base, then neither the face nor family are modified by the delta.When a delta's face is a string and its family is
'base, then only face is modified by the delta.When a delta's family is not
'base, then both the face and family are modified by the delta. If the delta's face is#f, then applying the delta sets a style's face to#f, so that the family setting prevails in choosing a font.
(make-object style-delta%->change-command)style-delta%object
change-command='change-nothing: symbol in'(change-nothing change-normal change-toggle-underline change-toggle-size-in-pixels change-normal-color change-bold)
(make-object style-delta%->change-commandv)style-delta%object
change-command: symbol in'(change-family change-style change-toggle-style change-weight change-toggle-weight change-smoothing change-toggle-smoothing change-alignment)
v: symbol
(make-object style-delta%->change-commandv)style-delta%object
change-command: symbol in'(change-size change-bigger change-smaller)
v: exact integer in [0, 255]
(make-object style-delta%->change-commandv)style-delta%object
change-command: symbol in'(change-underline change-size-in-pixels)
v: booleanThe initialization arguments are passed on to
set-delta.
Methods
collapse
copy
equal?
get-alignment-off
get-alignment-on
get-background-add
get-background-mult
get-face
get-family
get-foreground-add
get-foreground-mult
get-size-add
get-size-in-pixels-off
get-size-in-pixels-on
get-size-mult
get-smoothing-off
get-smoothing-on
get-style-off
get-style-on
get-transparent-text-backing-off
get-transparent-text-backing-on
get-underlined-off
get-underlined-on
get-weight-off
get-weight-on
set-alignment-off
set-alignment-on
set-delta
set-delta-background
set-delta-face
set-delta-foreground
set-face
set-family
set-size-add
set-size-in-pixels-off
set-size-in-pixels-on
set-size-mult
set-smoothing-off
set-smoothing-on
set-style-off
set-style-on
set-transparent-text-backing-off
set-transparent-text-backing-on
set-underlined-off
set-underlined-on
set-weight-off
set-weight-on