[racket] Question on racket/gui and font

From: Mag. Dr. Nikolaus Klepp (dr.klepp at gmx.at)
Date: Mon Jun 10 06:23:22 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)

Mag. Dr. Nikolaus Klepp
Einnehmerstraße 14
A-4810 Gmunden
Tel.: +43 650 82 11 724
email: office at klepp.biz
       dr.klepp at gmx.at 

Posted on the users mailing list.