[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Embedded Font formatting and positioning commands in Object Graphics



Ricardo Fonseca (zamb@physics.ucla.edu) writes:

> Is it possible to use Embedded Font formatting and positioning commands in
> Object Graphics? I wanted to produce the same result as the use of the
> following string does in Direct Graphics
> 
> '[1/!4x!X!Ip!N]'

As Mark Hadfield pointed out in this newsgroup a month or so
ago, not only can you use vector graphics:

   xyouts, 0.5, 0.5, /normal, '[1/!4x!X!Ip!N]', size=3, font=-1

But, true-type fonts also support the same embedded character
formatting. Although you do have to search for the correct
fonts a little bit. That is to say, I haven't yet found 
a table that shows me that !4 will select, say, the 
Simplex Greek  true-type font. In the example you gave, I
selected a Times Roman true-type font like this:

   device, set_font='Times*Roman', /tt_font

Then I searched the Symbol font type for the
correct unicode representation for the omega (?)
symbol used in the above xyouts command. I found
the symbol to be the value 77 in hexadecimal notation:
'77'xb. (I used the Unicode Character Map application
on my Windows NT machine.)

So, in true-type fonts I selected Symbol (!9) and the proper 
unicode representation, like this:

   xyouts, 0.5, 0.25, /normal, '[1/!9' + String('77'xb) + '!X!Ip!N]', $
      size=3, font=1

So, given that this is possible in direct graphics, you
have only to set the ENABLE_FORMATTING keyword on the text object
to get the object graphics text object to do the same thing.
You have your choice (in how you name the font) in the font
object of choosing Hershey vector fonts or true-type fonts.

Cheers,

David
-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155