|
Re: WIDGET_LABEL FONT cross platform compatability [message #41469 is a reply to message #41465] |
Thu, 28 October 2004 00:48  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Chad Bender writes:
> Are the 4 standard IDL font families included as device fonts, or only
> vector fonts? The WIDGET_LABEL documentation states that it requires
> device fonts. Setting the 'Font' keyword to Font='symbol' or
> Font='Symbol' just returns the error: "Requested font does not exist: symbol".
>
> I'd be quite happy to use the IDL symbol font, as it does provide
> everything I need. I just couldn't figure out how to use it with
> WIDGET_LABEL.
Well, I guess I was mistaken. I thought you could
use WIDGET_CONTROL, DEFAULT_FONT='Times' to set
a times font. And although that command doesn't
complain in UNIX, it does complain when I try to
make a label with the font.
Fonts are one of those things that are always
site-specific, I'm afraid. The original IDL FAQ
used to have an article about how fonts could be
set to work everywhere, but I think even that scheme
failed more than it worked. :-(
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http:/www.dfanning.com/
Phone: 970-221-0438, IDL Book Orders: 1-888-461-0155
|
|
|
Re: WIDGET_LABEL FONT cross platform compatability [message #41476 is a reply to message #41469] |
Wed, 27 October 2004 15:49  |
andrew.cool
Messages: 47 Registered: July 2003
|
Member |
|
|
Chad Bender <cbender@mail.astro.sunysb.eud> wrote in message news:<pan.2004.10.27.16.13.30.438805.29775@mail.astro.sunysb.eud>...
> Hi -
>
> I'm writing a widget and need to label some text boxes with greek letters.
> I've managed to do this using the FONT keyword to WIDGET_LABEL, but am
> not real happy with this solution because it relies on a pre-specified
> device font being installed on a machine, and I have very little hope that
> it is cross platform compatible. Is there a more elegant way to 'write' on
> a widget (perhaps using IDL's built in vector fonts), so that the routine
> doesn't break on other platforms that don't have a certain pre-specified
> font installed?
>
> Thanks
> Chad
>
> Here's what I've done so far:
>
> First, figure out what 'symbol' type fonts I have available:
>
> /home/cbender> xlsfonts | grep "symbol"
> -adobe-symbol-medium-r-normal--10-100-75-75-p-61-adobe-fonts pecific
> -adobe-symbol-medium-r-normal--12-120-75-75-p-74-adobe-fonts pecific
> -adobe-symbol-medium-r-normal--14-140-75-75-p-85-adobe-fonts pecific
> -adobe-symbol-medium-r-normal--18-180-75-75-p-107-adobe-font specific
> -adobe-symbol-medium-r-normal--24-240-75-75-p-142-adobe-font specific
> -adobe-symbol-medium-r-normal--8-80-75-75-p-51-adobe-fontspe cific
> -microsoft-webdings-medium-r-normal--0-0-0-0-p-0-microsoft-s ymbol
> -urw-standard symbols l-medium-r-normal--0-0-0-0-p-0-adobe-symbol
> -urw-standard symbols l-medium-r-normal--0-0-0-0-p-0-iso10646-1
>
> Then, pick one and feed it to WIDGET_LABEL:
>
> wlabel=WIDGET_LABEL(wbase,Value='w', $
> Font='-adobe-symbol-medium-r-normal--10-100-75-75-p-61-adobe -fontspecific')
Chad,
What about using a bitmap of your greek symbols on a button?
Something like this :-
Pro test_greek_button_event,ev
widget_control,ev.id,get_Uvalue = uvalue
Case Uvalue Of
'PI INPUT' : $
Begin
widget_control,ev.id,get_value=pi_text
print,'New pi text = ',pi_text
End
'STOP' : widget_control,ev.top,/destroy
Else : ;;; swallow event
End
End
;........................................................
Pro test_greek_button
; demo for Chad Bender. Written by Andrew Cool, DSTO, Adelaide, South Australia
window,1,xsize=16,ysize=16,/pix
; write out the desried symbol using Matthew Craig's TextoIDL software
xyouts,0.1,0.1,textoidl('\pi'),/norm,charsize=2,charthick=2
; grab the screen image
pi_image = TVRD()
wdelete,1
; convert byte array to bitmap
pi_bitmap = cvttobm(pi_image)
TLB = Widget_base(/Col)
Base1 = Widget_base(TLB,/Row)
pi_Btn = Widget_button(base1,Value=pi_bitmap,Uvalue='PI LABEL')
; Use bitmap as value for button
pi_input = Widget_text(base1,Value=' ',Uvalue='PI INPUT',/EDIT)
Base2 = Widget_base(TLB,/row)
Stop_btn = Widget_Button(base2,Value='STOP',Uvalue='STOP')
Widget_control,TLB,/Real
; possibly de-sensitise bitmapped button??
; widget_control,pi_Btn,sensitive=0
Xmanager,'test_greek_button',TLB
End
HTH,
Andrew
DSTO, Adelaide, Oz
|
|
|
|
Re: WIDGET_LABEL FONT cross platform compatability [message #41484 is a reply to message #41483] |
Wed, 27 October 2004 11:53  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Chad Bender writes:
> I'm writing a widget and need to label some text boxes with greek letters.
> I've managed to do this using the FONT keyword to WIDGET_LABEL, but am
> not real happy with this solution because it relies on a pre-specified
> device font being installed on a machine, and I have very little hope that
> it is cross platform compatible. Is there a more elegant way to 'write' on
> a widget (perhaps using IDL's built in vector fonts), so that the routine
> doesn't break on other platforms that don't have a certain pre-specified
> font installed?
>
> Thanks
> Chad
>
> Here's what I've done so far:
>
> First, figure out what 'symbol' type fonts I have available:
>
> /home/cbender> xlsfonts | grep "symbol"
> -adobe-symbol-medium-r-normal--10-100-75-75-p-61-adobe-fonts pecific
> -adobe-symbol-medium-r-normal--12-120-75-75-p-74-adobe-fonts pecific
> -adobe-symbol-medium-r-normal--14-140-75-75-p-85-adobe-fonts pecific
> -adobe-symbol-medium-r-normal--18-180-75-75-p-107-adobe-font specific
> -adobe-symbol-medium-r-normal--24-240-75-75-p-142-adobe-font specific
> -adobe-symbol-medium-r-normal--8-80-75-75-p-51-adobe-fontspe cific
> -microsoft-webdings-medium-r-normal--0-0-0-0-p-0-microsoft-s ymbol
> -urw-standard symbols l-medium-r-normal--0-0-0-0-p-0-adobe-symbol
> -urw-standard symbols l-medium-r-normal--0-0-0-0-p-0-iso10646-1
>
> Then, pick one and feed it to WIDGET_LABEL:
>
> wlabel=WIDGET_LABEL(wbase,Value='w', $
> Font='-adobe-symbol-medium-r-normal--10-100-75-75-p-61-adobe -fontspecific')
Yeah, that's not going to be very cross-platform compatible. :-)
I think you are going to have to stick to the four font
families IDL supplies: courier, helvetica, symbol, and times.
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http:/www.dfanning.com/
Phone: 970-221-0438, IDL Book Orders: 1-888-461-0155
|
|
|