Discussion:
Text Formatting with TexToIDL
(too old to reply)
David Fanning
2006-02-15 22:09:38 UTC
Permalink
Folks,

Here is a straightforward string using TexToIDL:

IDL> xyouts, 0.5, 0.5, charsize=2.5, align=0.5, /normal, $
textoidl(' \lambda_{1} (nm)')
IDL> Print, textoidl(' \lambda_{1} (nm)')
!7k!X!D1!N (nm)

Just what I want. But...I want it in object graphics:

IDL> string = textoidl(' \lambda_{1} (nm)')
IDL> text = obj_new('idlgrtext', string, ENABLE_FORMATTING=1)
IDL> xobjview, text

NOT what I want. :-(

What good is it to enable formatting if I'm going to get something
completely different!?

Any ideas?

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Paul Van Delst
2006-02-15 22:29:16 UTC
Permalink
Post by David Fanning
Folks,
IDL> xyouts, 0.5, 0.5, charsize=2.5, align=0.5, /normal, $
textoidl(' \lambda_{1} (nm)')
IDL> Print, textoidl(' \lambda_{1} (nm)')
!7k!X!D1!N (nm)
IDL> string = textoidl(' \lambda_{1} (nm)')
IDL> text = obj_new('idlgrtext', string, ENABLE_FORMATTING=1)
IDL> xobjview, text
NOT what I want. :-(
What good is it to enable formatting if I'm going to get something
completely different!?
Any ideas?
This works:

IDL> s2='!Ml!X!D1!N (nm)'
IDL> text = obj_new('idlgrtext', s2, ENABLE_FORMATTING=1)
IDL> xobjview, text

I have similar problems with PS output in DG (i.e the difference between on screen chars
and PS output when !p.font=1) but it happens rarely enough that I've never bothered to
figure it out for good.

paulv

p.s. To have the character "k" correspond to lambda in the IDL font list/whatever makes no
sense (to me at least).
--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
Craig Markwardt
2006-02-15 23:21:59 UTC
Permalink
Post by David Fanning
Folks,
IDL> xyouts, 0.5, 0.5, charsize=2.5, align=0.5, /normal, $
textoidl(' \lambda_{1} (nm)')
IDL> Print, textoidl(' \lambda_{1} (nm)')
!7k!X!D1!N (nm)
IDL> string = textoidl(' \lambda_{1} (nm)')
IDL> text = obj_new('idlgrtext', string, ENABLE_FORMATTING=1)
IDL> xobjview, text
NOT what I want. :-(
What good is it to enable formatting if I'm going to get something
completely different!?
David, the problem is that the font sets and character encodings for
the TrueType and PostScript fonts are totally different than the
direct graphics Hershey fonts. textoidl() only knows about the
Hershey fonts. Somebody would have to re-write a part of textoidl()
to handle the new encodings.

Craig
--
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D. EMAIL: ***@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------
Craig Markwardt
2006-02-15 23:29:38 UTC
Permalink
Post by Craig Markwardt
David, the problem is that the font sets and character encodings for
the TrueType and PostScript fonts are totally different than the
direct graphics Hershey fonts. textoidl() only knows about the
Hershey fonts. Somebody would have to re-write a part of textoidl()
to handle the new encodings.
But here's an interesting tidbit. The PS and TrueType symbol fonts
are close enough that one can switch to Postscript mode and get the
desired effect:

set_plot, 'ps'
str = textoidl(' \lambda_{1} (nm)', font=0)
set_plot, 'x'
text = obj_new('idlgrtext', str, ENABLE_FORMATTING=1)
xobjview, text

Major-kludge, but it suggests that a modification to textoidl() would
be fairly straightforward.

Craig
--
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D. EMAIL: ***@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------
David Fanning
2006-02-16 05:27:15 UTC
Permalink
Post by Craig Markwardt
But here's an interesting tidbit. The PS and TrueType symbol fonts
are close enough that one can switch to Postscript mode and get the
set_plot, 'ps'
str = textoidl(' \lambda_{1} (nm)', font=0)
set_plot, 'x'
text = obj_new('idlgrtext', str, ENABLE_FORMATTING=1)
xobjview, text
Major-kludge, but it suggests that a modification to textoidl() would
be fairly straightforward.
I've suggested to the person who passed this information along
to me that he get in touch with Matt Craig and offer to help
fix this up, but so far stone silence on the other end. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Loading...