[racket] Question on racket/gui and font

From: Mag. Dr. Nikolaus Klepp (office at klepp.biz)
Date: Mon Jun 10 06:22:05 EDT 2013


I'm having some issue with fonts when creating GUI elements.

In my understanding, when I pass [font some-font] when creating a new object, 
then that object should take that font to render its controls. This works on 
button%, but not on other elemts like group-box-panel% or tab-panel%.

So, how is the correct way to get these objects to use the font I'd like them 
to use?


example code: on debian, all labels of tab-panel% and group-box-panel% have 
the same font normal-control-font, while button% uses the font I passed on.

#lang racket
(require racket/gui)

(define frame (new frame% [label "TEST"] [width 800] [height 800] [min-width 
100] [min-height 100]))
(new tab-panel% [parent frame] [font tiny-control-font] [choices '(" 
tiny-control-font ")])
(new group-box-panel% [parent frame] [label " normal-control-font "] [font 
normal-control-font] )
(new group-box-panel% [parent frame] [label " tiny-control-font "  ] [font 
tiny-control-font] )
(new group-box-panel% [parent frame] [label " custom-font "        ] [font 
(make-object font% 28 'default)] )
(new button% [parent frame] [label " tiny-control-font "           ] [font 
tiny-control-font] )
(new button% [parent frame] [label " small-control-font "          ] [font 
small-control-font] )
(new button% [parent frame] [label " normal-control-font "         ] [font 
normal-control-font] )
(new button% [parent frame] [label " custom-font "                 ] [font 
(make-object font% 28 'default)] )

(send frame show #t)

Posted on the users mailing list.