Discussion:
IDL Fonts
(too old to reply)
Jared Espley
2006-11-01 19:28:28 UTC
Permalink
Hi all,

I have a few questions that I haven't been able to answer with some
digging around on the web and in the IDL help files so maybe someone
can help. The background on my question is that I'm trying to produce
a "publication" quality plot using IDL and I intend to either make a
.tif from a screen capture using tvread.pro
(http://www.dfanning.com/programs/pswindow.pro) or a color .eps using
postscript output. I'm using IDL 6.2 on Windows XP.

1. Has anyone been able to get True Type fonts (i.e. !p.font=1) to look
ok on the screen? When I use them, they look awful -- even worse than
the default vector fonts I was trying to improve upon. I've seen some
"tricks" about blowing them up 4x times in size, but that's not an
option for me since that size of font won't fit on my plot.

2. Has anyone been able to get device fonts (i..e !p.font=0) to work
correctly with vertical axis labels on the screen? When I use them,
the labels are just letters stacked on top of each other right-side up.
In other words instead of having to turn your head to read them, they
look like this:
L
E
B
A
L

3. Assuming I could get the fonts to work correctly, how do I get
special symbols? For example, using vector fonts, I would type,
"title='!4d!B'" to get little delta B -- how can I do this with the
other font styles?

4. How come when I make sure that my plot size is the same on both the
output window on my monitor and in the postscript output (by using
David Fanning's pswindow.pro
http://www.dfanning.com/programs/pswindow.pro) then I still have to
adjust the positions of my plots, colorbars, etc. to make both outputs
look the same?

5. It appears that the color output of the .eps file I make has very
discrete color levels (about 10 or so) compared to the fairly smooth
continuum I see when I output to a window on the screen. Is this a
fundamental limit of postscript or am I doing something wrong?

Thanks for any help and to all of you that have posted helpful IDL code
on the web.

Jared
Jared Espley
2006-11-01 20:24:19 UTC
Permalink
Post by Jared Espley
3. Assuming I could get the fonts to work correctly, how do I get
special symbols? For example, using vector fonts, I would type,
"title='!4d!B'" to get little delta B -- how can I do this with the
other font styles?
First I made a typo here -- it should say: title='!4d!3B'

Answering my own question:
For Truetype, there are 4 fonts instead of the 20 vector ones. The
commands are the same but one has to look up the exact truetype font
being used since the numbers don't necessarily correspond between
truetype and vector.

For device fonts, the IDL manual states:
"Embedded formatting commands prefaced by the exclamation mark have no
special significance for hardware-generated characters unless the
ability is provided by the particular device in use. The IDL PostScript
device driver accepts many of the standard embedded formatting
commands, and is described here. If you wish to use hardware fonts with
IDL Direct Graphics devices other than the PostScript device [like
'win'], consult the description of the device in IDL Direct Graphics
Devices before trying to use these commands with hardware characters."
Since the entry on 'win' is sparse to say the least, I think we're on
our own.
David Fanning
2006-11-01 20:29:41 UTC
Permalink
Post by Jared Espley
I have a few questions that I haven't been able to answer with some
digging around on the web and in the IDL help files so maybe someone
can help. The background on my question is that I'm trying to produce
a "publication" quality plot using IDL and I intend to either make a
.tif from a screen capture using tvread.pro
(http://www.dfanning.com/programs/pswindow.pro) or a color .eps using
postscript output. I'm using IDL 6.2 on Windows XP.
1. Has anyone been able to get True Type fonts (i.e. !p.font=1) to look
ok on the screen?
No. This is an item with a long history, but I think I can
say with some assurance that direct graphics fonts will NEVER
look good on the screen. To make them look good requires bitmaps,
apparently, and IDL direct graphics does not have the machinery
to manipulate bitmaps quickly. OpenGL *does* have the machinery,
which is why screen fonts can (and do) look good in object
graphics programs.
Post by Jared Espley
2. Has anyone been able to get device fonts (i..e !p.font=0) to work
correctly with vertical axis labels on the screen?
No, screen fonts do not rotate on your display. They rotate
in PostScript, but only in the XY plane, not in 3D.
Post by Jared Espley
3. Assuming I could get the fonts to work correctly, how do I get
special symbols? For example, using vector fonts, I would type,
"title='!4d!B'" to get little delta B -- how can I do this with the
other font styles?
Symbols in Postscript usually require UNICODE characters.
Here is an article that explains the situation in a lot
more detail:

http://www.dfanning.com/graphics_tips/lesign.html
Post by Jared Espley
4. How come when I make sure that my plot size is the same on both the
output window on my monitor and in the postscript output (by using
David Fanning's pswindow.pro
http://www.dfanning.com/programs/pswindow.pro) then I still have to
adjust the positions of my plots, colorbars, etc. to make both outputs
look the same?
Humm. Not sure about this. Probably because your
programs are written incorrectly. I've never found
this to be a problem. Are you trying to position things
in Device coordinates? That would wreak havoc.
Post by Jared Espley
5. It appears that the color output of the .eps file I make has very
discrete color levels (about 10 or so) compared to the fairly smooth
continuum I see when I output to a window on the screen. Is this a
fundamental limit of postscript or am I doing something wrong?
This is something you are doing wrong. Probably you set the COLOR=1
keyword, but forgot the BITS_PER_PIXEL=8 keyword for the DEVICE
command.

Since you are already using PSWINDOW and other programs, why
not just use PSCONFIG to get your PostScript page set up.
Then most of these problems will be avoided.

keywords = PSCONFIG(_Extra=PSWINDOW(), Cancel=cancelled)
IF ~cancelled THEN BEGIN
thisDevice = !D.Name
Set_Plot, 'PS'
Device, _Extra=keywords
YourPlotHere
Device, /Close
Set_Plot, thisDevice
ENDIF


Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Jared Espley
2006-11-02 02:27:12 UTC
Permalink
Post by David Fanning
Symbols in Postscript usually require UNICODE characters.
Here is an article that explains the situation in a lot
http://www.dfanning.com/graphics_tips/lesign.html
Thanks for the quick and helpful response, David. Everything you said
seemed to be spot on except for some quibbles I have with your tutorial
you link above. I found that I could not get the specific unicode
characters I wanted using the !z trick for any of the truetype fonts I
had on my Windows XP system. Specifically, I was trying to get the
perpendicular symbol (unicode 22A5) to show up -- instead I just got a
square. I could get less-than-equal as per your example. Thus, I
think that the fonts may not have been fully unicode compliant so the
fault doesn't really lie with your tutorial.

Thus, I found myself back to using the vector fonts in the end. At
least they look better in .ps than they do on the screen. Furthermore,
I found that if I used triplex roman (!17) instead of single roman (!3)
things looked much better -- in fact, very professional looking. I was
left with strings that looked this:
'!7d!17B!D!M!!!M!!!N/!7d!17B!D!9x!17!N' but hey life's not perfect. In
end, after all my wailing and gnashing of teeth, I was able to make a
nice "publication" quality figure with vectors fonts as .ps output.

In any case, thanks again for your help and all you do for the IDL
community.

Jared
David Fanning
2006-11-02 02:36:50 UTC
Permalink
Post by Jared Espley
'!7d!17B!D!M!!!M!!!N/!7d!17B!D!9x!17!N' but hey life's not perfect.
You are thinking of this in the wrong way. Think
of it as "job security" and it makes a lot more
sense to you. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
David Fanning
2006-11-02 15:26:12 UTC
Permalink
Post by Jared Espley
Post by David Fanning
Symbols in Postscript usually require UNICODE characters.
Here is an article that explains the situation in a lot
http://www.dfanning.com/graphics_tips/lesign.html
Thanks for the quick and helpful response, David. Everything you said
seemed to be spot on except for some quibbles I have with your tutorial
you link above. I found that I could not get the specific unicode
characters I wanted using the !z trick for any of the truetype fonts I
had on my Windows XP system. Specifically, I was trying to get the
perpendicular symbol (unicode 22A5) to show up -- instead I just got a
square.
Well, I am using the same Windows XP and IDL 6.2 system you
are, and I find that unicode 22A5 is for a box! The perpendicular
line is listed as unicode 007C. This code worked for me.

device, set_font='Times New Roman', /tt_font
thisDevice = !D.Name
set_plot, 'ps'
device, xsize=5, ysize=1, /inches, filename='test.ps', /isolatin1
xyouts, 0.5, 0.5, /normal, charsize=2, align=0.5, $
'Straight bar (!Z(007C)) sign.'
device, /close
set_plot, thisDevice

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
David Fanning
2006-11-02 15:33:25 UTC
Permalink
Post by David Fanning
Well, I am using the same Windows XP and IDL 6.2 system you
are, and I find that unicode 22A5 is for a box! The perpendicular
line is listed as unicode 007C. This code worked for me.
device, set_font='Times New Roman', /tt_font
thisDevice = !D.Name
set_plot, 'ps'
device, xsize=5, ysize=1, /inches, filename='test.ps', /isolatin1
xyouts, 0.5, 0.5, /normal, charsize=2, align=0.5, $
'Straight bar (!Z(007C)) sign.'
device, /close
set_plot, thisDevice
Whoops! That XYOutS command needs a FONT=1 keyword on the
end of it! Sorry.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Jared Espley
2006-11-02 16:35:39 UTC
Permalink
Post by David Fanning
Well, I am using the same Windows XP and IDL 6.2 system you
are, and I find that unicode 22A5 is for a box! The perpendicular
line is listed as unicode 007C.
At risk of being unduly argumentative, I don't think 22A5 is supposed
to be a box. I got that code from here:
http://www.unicode.org/charts/PDF/U2200.pdf You'll see which
perpendicular symbol I'm trying to achieve there. Also, if you use,
for example, 22A6 you also get a box when using the XP device fonts.

Thus, I stick by my assertion that many of the XP device fonts don't
have the full unicode implementation and thus are less useful for
specific tasks. Fortunately, as I noted I was able to get something
satisfactory with vector fonts.

As usual, thanks for your time.

Jared
David Fanning
2006-11-02 16:49:56 UTC
Permalink
Post by Jared Espley
At risk of being unduly argumentative, I don't think 22A5 is supposed
http://www.unicode.org/charts/PDF/U2200.pdf You'll see which
perpendicular symbol I'm trying to achieve there. Also, if you use,
for example, 22A6 you also get a box when using the XP device fonts.
I think you need to read the first page of PDF file
you cite, under the topic of "Fonts". They point
out that their chart is "not prescriptive. Considerable
variation is to be expected in actual fonts."

To get the actual Unicode values for a *particular*
font, you have to know something about that font. In
the case I presented, I used the Character Map application
for the Times New Roman font. There, 22A5 is *definitely*
a box. :-)
Post by Jared Espley
Thus, I stick by my assertion that many of the XP device fonts don't
have the full unicode implementation and thus are less useful for
specific tasks.
I'm not saying this isn't true. I'm just saying
that I found the perpendicular line in the font I use
day in and day out to have a Unicode value of 007C, and
when I used it like that it worked perfectly. What font
were you trying to use?

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
David Fanning
2006-11-02 17:24:02 UTC
Permalink
Post by Jared Espley
At risk of being unduly argumentative, I don't think 22A5 is supposed
http://www.unicode.org/charts/PDF/U2200.pdf You'll see which
perpendicular symbol I'm trying to achieve there. Also, if you use,
for example, 22A6 you also get a box when using the XP device fonts.
It is hard to know what that chart means. For example, if
you look on page two of the document (the actual chart),
you find that a vertical bar has a Unicode value of 2223
(not 22A5, which I read as a "flagpole" or something).
But if you look on the next page, under Operators, you
see 2223, and indented the value 007C for a "vertical line".

I have no idea what any of this means! I do notice
that I can get a vertical bar in my display text
if I use !z(2223) but it appears as a box in PostScript!
To get the vertical bar in PostScript I have to use
!z(007c).

Too weird...

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Kenneth Bowman
2006-11-02 17:58:49 UTC
Permalink
Post by David Fanning
I have no idea what any of this means! I do notice
that I can get a vertical bar in my display text
if I use !z(2223) but it appears as a box in PostScript!
To get the vertical bar in PostScript I have to use
!z(007c).
Too weird...
I think the box is the default postscript symbol for "You asked me to display
something here that I don't understand".

Ken Bowman
Jared Espley
2006-11-02 18:16:49 UTC
Permalink
Post by David Fanning
It is hard to know what that chart means. For example, if
you look on page two of the document (the actual chart),
you find that a vertical bar has a Unicode value of 2223
(not 22A5, which I read as a "flagpole" or something).
Yeah, it's actually that flagpole symbol (a straight vertical line with
a straight horizontal line at the bottom) that I'm going for and not
the vertical "pipe" (e.g. |). In my field, it's often used as a
subscript to indicate the perpendicular components of a vector relative
to some background direction. That fact is largely irrelevant since
our discussion had progressed from the specific to the general.

In the end, I think we're saying the same thing -- knowing the unicode
number isn't sufficient. You also have to know something about how the
particular font and its precise unicode implementation. If you're
feeling energetic you may consider appending something like that to
your discussion at http://dfanning.com/graphics_tips/lesign.html.
Again, many kudos to you for even having such a help page in the first
place. One would have hoped that RSI could have provided sufficient
documentation.

Jared



Jared
Jared Espley
2006-11-02 18:16:57 UTC
Permalink
Post by David Fanning
It is hard to know what that chart means. For example, if
you look on page two of the document (the actual chart),
you find that a vertical bar has a Unicode value of 2223
(not 22A5, which I read as a "flagpole" or something).
Yeah, it's actually that flagpole symbol (a straight vertical line with
a straight horizontal line at the bottom) that I'm going for and not
the vertical "pipe" (e.g. |). In my field, it's often used as a
subscript to indicate the perpendicular components of a vector relative
to some background direction. That fact is largely irrelevant since
our discussion had progressed from the specific to the general.

In the end, I think we're saying the same thing -- knowing the unicode
number isn't sufficient. You also have to know something about how the
particular font and its precise unicode implementation. If you're
feeling energetic you may consider appending something like that to
your discussion at http://dfanning.com/graphics_tips/lesign.html.
Again, many kudos to you for even having such a help page in the first
place. One would have hoped that RSI could have provided sufficient
documentation.

Jared
David Fanning
2006-11-02 18:34:20 UTC
Permalink
Post by Jared Espley
In the end, I think we're saying the same thing -- knowing the unicode
number isn't sufficient. You also have to know something about how the
particular font and its precise unicode implementation.
Ah, yes, I see what you mean. I believe you are right.

I've thought about adding this whole discussion to the
article. Just so people can see how confusing all of
this can be! :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Continue reading on narkive:
Loading...