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
|