You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A style-delta% can only 'change-size to values of a byte?, but it is documented as taking a "size." Meanwhile a font% reports sizes as (real-in 0.0 1024.0). (A Racket byte? is 0 to 255.)
I'm not even sure how to interpret the values, so it's not clear how to convert one to the other. (I'm already using 'change-size-in-pixels to make sure the style-delta% and font% interpret the size the same way, but they don't speak the same contract…)
I tried using a size of 1, an additive factor of 0, and a multiplicative factor of the font's size, but that produced the wrong results (too big) on normal-control-font, which has a size of 13.0.
Context: I'm trying to convert a font% to a style-delta% so that the different fonts in my application are consistent. All the other properties seem straightforward to translate. Here's the current version of the function, and the results using normal-control-font as the base font (minus the size changes, of course):
(define (font->delta f)
(define d (new style-delta%))
(define size-in-pixels? (send f get-size-in-pixels))
(define size (send f get-size))
(define family (send f get-family))
(define face (send f get-face))
(define style (send f get-style))
(define weight (send f get-weight))
(define underline (send f get-underlined))
(define smoothing (send f get-smoothing))
(send* d
(set-delta 'change-size-in-pixels size-in-pixels?)
#;(set-delta 'change-size size)
(set-delta 'change-family family)
(set-face face)
(set-delta 'change-style style)
(set-delta 'change-weight weight)
(set-delta 'change-underline underline)
(set-delta 'change-smoothing smoothing))
d)
(I'm also hoping to figure out how to scale the pict? in the text so it's the same size, but that's unrelated to this, I think.)
The text was updated successfully, but these errors were encountered:
A
style-delta%
can only'change-size
to values of abyte?
, but it is documented as taking a "size." Meanwhile afont%
reports sizes as(real-in 0.0 1024.0)
. (A Racketbyte?
is 0 to 255.)I'm not even sure how to interpret the values, so it's not clear how to convert one to the other. (I'm already using
'change-size-in-pixels
to make sure thestyle-delta%
andfont%
interpret the size the same way, but they don't speak the same contract…)I tried using a size of 1, an additive factor of 0, and a multiplicative factor of the font's size, but that produced the wrong results (too big) on
normal-control-font
, which has a size of 13.0.Context: I'm trying to convert a
font%
to astyle-delta%
so that the different fonts in my application are consistent. All the other properties seem straightforward to translate. Here's the current version of the function, and the results usingnormal-control-font
as the base font (minus the size changes, of course):(I'm also hoping to figure out how to scale the
pict?
in the text so it's the same size, but that's unrelated to this, I think.)The text was updated successfully, but these errors were encountered: