[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Widget Fonts
David Fanning wrote:
>
> Bernard Puc (bpuc@va.aetc.com) writes:
>
> > Is there a way to get the current default widget font? I can define it
> > using widget_control, default_font = ***, but I can't seem to determine
> > what its set to. What I'd like to be able to do is define say a label
> > in a larger size of the default font. Any ideas?
>
> As far as I know, there is no way to get at this
> information programmatically. IDL is picking up
> system font information. I can change various
> fonts by playing with the Appearances/Font
> properties on my Windows machine, but so far not
> the font that is used for most things in widgets. :-(
>
> Cheers,
>
> David
So it seems, the only way to control the fonts is to set them
explicitely and store them either in some UValue field of the widget
or use object oriented widgets where you should be able to
thewidget->SetProperty, defaultfont=defaultfont
and redisplay. You can then try to apply some arithmetics on
defaultfont to choose a somewhat larger yet related font for the
labels (or you just set this explicitly as, say, labelfont). In order
to please Pavel who will want to run it on a Mac, too, please make
sure that your solution works for all platforms. In a recent program
by David (with a little influence of myself ;-) we use the following:
; Set widget font names.
thisOS = StrUpCase(!Version.os_family)
CASE thisOS OF
'WINDOWS': BEGIN
IF N_Elements(labelfont) EQ 0 THEN self.labelfont = 'Times*Bold'
IF N_Elements(defaultfont) EQ 0 THEN self.defaultfont = 'MS Sans
Serif*10'
END
'MACOS': BEGIN
IF N_Elements(labelfont) EQ 0 THEN self.labelfont = 'Times*Bold'
IF N_Elements(defaultfont) EQ 0 THEN self.defaultfont =
'Times*10'
END
ELSE: BEGIN
IF N_Elements(labelfont) EQ 0 THEN self.labelfont =
'-*-times-bold-r-*-*-12-*'
IF N_Elements(defaultfont) EQ 0 THEN self.defaultfont =
'-*-times-medium-r-*-*-12-*'
END
ENDCASE
Widget_Control,
Default_Font=self.defaultfont
This only works if the widget is currently not realized.
Cheers,
Martin
PS: By pure chance, I recently discovered IDL's xfont utility.
Apparently it only works for Unix platforms, although it shouldn't be
too hard to write a tool that would be platform independent.
--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[