I have some code to increase the font size in my application:
(define (change-canvas-font-size canvas amount)
(define standard (send (send canvas get-style-list) find-named-style "Standard"))
(when standard
(define delta (make-object style-delta%))
(send standard get-delta delta)
(send delta set-delta 'change-size (+ (send standard get-size) amount))
(send standard set-delta delta)
(send canvas redo-layout)))
This works but it doesn't update the size of other style%
objects derived from Standard
, ie styles that have Standard
as their base style. Am I misunderstanding the docs here? It seems like the point of having a hierarchy of styles is so that you don't have to walk down the tree manually updating styles.
Here is an example of how I have some of my styles defined:
(define standard (send style-list find-named-style "Standard"))
(define standard-delta (make-object style-delta%))
(send* standard-delta
(set-family 'modern)
;(set-face font-name)
(set-delta 'change-size 12)
(set-delta-foreground text-fg-color)
(set-delta-background canvas-bg-color))
(send standard set-delta standard-delta)
(define (make-color-style name color)
;; Each style created with this procedure copies "Standard" style
;; and creates a new style by name 'name' and with the foreground
;; color 'color'.
(send (send style-list new-named-style name standard)
set-delta (send* (make-object style-delta%)
(copy standard-delta)
(set-delta-foreground color))))
(make-color-style "Link" link-color)
(make-color-style "Link Highlight" link-highlight-color)
Link
and Link Highlight
are derived from Standard
so it would be nice if their size changed to match Standard
. I was thinking that perhaps it has something to do with the fact that the style-delta%
I use for the derived styles is copying the change-size
delta from standard-delta
but removing change-size
from standard-delta
didn't change anything.
I probably need to do something with the additive or multiplicative style size parameters(instead of just using change-size
, but my experiments with those haven't gone well.