From 5d815a034506d5074df2d1abc6ee6db40e8b5911 Mon Sep 17 00:00:00 2001 From: Robby Findler <robby@racket-lang.org> Date: Sat, 5 Sep 2015 17:34:57 -0500 Subject: [PATCH] add the framework:standard-style-list:weight preference --- gui-lib/framework/private/editor.rkt | 10 +++++++++- gui-lib/framework/private/main.rkt | 6 ++++++ gui-lib/info.rkt | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/gui-lib/framework/private/editor.rkt b/gui-lib/framework/private/editor.rkt index baeb68fa..84d67fa4 100644 --- a/gui-lib/framework/private/editor.rkt +++ b/gui-lib/framework/private/editor.rkt @@ -373,6 +373,11 @@ (update-standard-style (λ (the-delta) (send the-delta set-smoothing-on sym)))) + + (define (set-font-weight sym) + (update-standard-style + (λ (the-delta) + (send the-delta set-weight-on sym)))) (define (update-standard-style cng-delta) (let* ([the-standard (send standard-style-list find-named-style "Standard")] @@ -415,11 +420,14 @@ (set-font-size (get-current-preferred-font-size)) (set-font-name (preferences:get 'framework:standard-style-list:font-name)) (set-font-smoothing (preferences:get 'framework:standard-style-list:smoothing)) + (set-font-weight (preferences:get 'framework:standard-style-list:weight)) (preferences:add-callback 'framework:standard-style-list:font-size (λ (p v) (set-font-size/callback (font-size-pref->current-font-size v)))) (preferences:add-callback 'framework:standard-style-list:font-name (λ (p v) (set-font-name v))) - (preferences:add-callback 'framework:standard-style-list:smoothing (λ (p v) (set-font-smoothing v))) + (preferences:add-callback 'framework:standard-style-list:smoothing + (λ (p v) (set-font-smoothing v))) + (preferences:add-callback 'framework:standard-style-list:weight (λ (p v) (set-font-weight v))) (define fl (get-face-list)) (unless (member (preferences:get 'framework:standard-style-list:font-name) fl) (define preferred-font diff --git a/gui-lib/framework/private/main.rkt b/gui-lib/framework/private/main.rkt index 88fe930d..021108de 100644 --- a/gui-lib/framework/private/main.rkt +++ b/gui-lib/framework/private/main.rkt @@ -263,6 +263,12 @@ (λ (x) (memq x '(unsmoothed partly-smoothed smoothed default)))) +(preferences:set-default + 'framework:standard-style-list:weight + 'normal + (λ (x) + (memq x '(normal light bold)))) + (editor:set-standard-style-list-pref-callbacks) (let ([gray-level diff --git a/gui-lib/info.rkt b/gui-lib/info.rkt index 9c817632..dfc462c3 100644 --- a/gui-lib/info.rkt +++ b/gui-lib/info.rkt @@ -30,4 +30,4 @@ (define pkg-authors '(mflatt robby)) -(define version "1.16") +(define version "1.17")