Re: Different Platforms [message #10333 is a reply to message #10331] |
Wed, 19 November 1997 00:00   |
mgs
Messages: 144 Registered: March 1995
|
Senior Member |
|
|
In article <3473138C.B39FFA08@ssec.wisc.edu>, Liam Gumley
<Liam.Gumley@ssec.wisc.edu> wrote:
> Neil Winrow wrote:
>
>> I have written a number of widget programs, which are visually correct
>> on my PC, however when they are run on the silicon graphics machines the
...
> (1) If your development platform is a PC, then make sure that once a day
> you test the program on a Unix box, and a Mac. Unless you do this, it is
> easy in your program design to go down a path from which there is no
> return.
>
> (2) As David Fanning suggested, having the commands
>
> Device, Set_Character_Size = [ 6, 9 ]
> Widget_Control, Default_Font = '7x13'
>
> in your IDL startup file will guarantee consistent graphics font and widget
> font sizes on all *Unix* platforms. However, these commands are ignored on
> PCs. You should try David's STR_SIZE program.
>
> (3) You may wish to look into using *hardware* fonts for graphics. I've
> been experimenting with them in Unix, and getting pretty good results. You
> can see the list of available hardware fonts in IDL by using the command
>
...
> The major drawback to using hardware fonts is that they do not rotate
> automatically, e.g.
>
> plot, indgen(10), xtitle = 'X AXIS', ytitle = 'Y AXIS'
>
> when using hardware fonts will give you the Y title plotted vertically, but
> not rotated. You can get around this by creating the Y axis title in a
> pixmap, reading an array of byte data from the pixmap, rotating the array
> using ROTATE, and TVing the rotated array next to your Y axis. This takes a
> bit of messing around, but the resulting graphics plots look *much* more
> professional than the default vector fonts.
And I thought I had a lot of patience for dealing with interface problems.
> (4) When creating widget programs, be very careful about using XSIZE and
> YSIZE keywords. I try to use them only for WIDGET_DRAW, WIDGET_LABEL, and
> WIDGET_BUTTON sizing.
>
> (5) Rely on the ROW, COLUMN, and alignment keywords when creating widget
> bases to position your widgets.
I tried staying away from [XY]Size for a long time. Now I find that it's
the only way to get a decent cross-platform look. I only rely on the
XSize, I don't think I've used YSize anywhere. Everything I use has Row
and Column keywords. As I mentioned earlier in this thread, I rely on the
Widget_Info(widget_id, /Geometry) call and my own widget size structure to
provide the info I need to get correctly sized widgets. The following URL
shows a very busy interface http://ww2.sd.cybernex.net/~mgs/IV_IAS_BB.html
with Mac and UNIX versions side by side. Well, it's the same except for an
overlapping hierarchy near the botton has been toggled. I haven't updated
the images in months and there has been a lot of development since then.
Maybe it's time to do that for both platforms and add in some additional
info about making the stuff work correctly.
> PS I've attached a Unix hardware font selection routine below - I'll be
> modifying it soon to work on PC and Mac.
Well, here's a version that runs on Mac and UNIX. It was tested a couple
years ago on a PC, but hasn't been run on a PC since. It could be extended
to include italics and additional sizes without too much of a headache.
Usage: Font_Struct = FontGen()
;########################################################### ################
; Author: Mike Schienle
; $Workfile: fontgen.pro $
; $Revision: 1.1 $
; Orig Date: 96-12-17
; $Modtime: Wed Oct 01 10:26:18 1997 $
;########################################################### ################
FUNCTION FontGen, PROP=prop, MONO=mono, SYMBOL=symbol
IF (N_Elements(prop) EQ 0L) THEN $
prop = 'times'
IF (N_Elements(mono) EQ 0L) THEN $
mono = 'courier'
IF (N_Elements(symbol) EQ 0L) THEN $
symbol = 'symbol'
; get Operating System info
IF (!Version.OS_Family EQ 'unix') THEN BEGIN
; We're using UNIX
; specify the names of proportional and monospace fonts
asFontName = ['-*-' + prop + '-', $
'-*-' + mono + '-', $
'-*-' + symbol + '-']
; specify font weights
asFontWeight = ['medium-', 'bold-']
; specify "extras" - string completers
asFontExtra = ['r-*-*-', '-*']
ENDIF ELSE BEGIN
; Non-UNIX (Mac, Windows)
; specify the names of proportional and monospace fonts
asFontName = [prop + '*', mono + '*', symbol + '*']
; specify font weights
asFontWeight = ['', 'bold*']
; specify "extras" - string completers
asFontExtra = ['', '']
ENDELSE
; font strings
; UNIX style
; -adobe-times-medium-r-normal--12-120-75-75-p-64-iso8859-1
; Mac/PC Style
; times*bold*18, times*18
; font sizes
asFontSize = ['10', '12', '18', '24']
; abbreviated font wieghts
asFontWAbbr = ['m', 'b']
; create a structure of font names, proportional and monospace
sCmdFont = 'mFont = {'
FOR fs = 0, (n_elements(asFontSize) - 1) DO $
FOR fw = 0, (n_elements(asFontWeight) - 1) DO $
sCmdFont = sCmdFont + $
'prop' + asFontSize(fs) + asFontWAbbr(fw) + ':"' + $
asFontName(0) + asFontWeight(fw) + asFontExtra(0) + $
asFontSize(fs) + asFontExtra(1) + '", ' + $
'mono' + asFontSize(fs) + asFontWAbbr(fw) + ':"' + $
asFontName(1) + asFontWeight(fw) + asFontExtra(0) + $
asFontSize(fs) + asFontExtra(1) + '", ' + $
'symbol' + asFontSize(fs) + asFontWAbbr(fw) + ':"' + $
asFontName(2) + asFontWeight(fw) + asFontExtra(0) + $
asFontSize(fs) + asFontExtra(1) + '", '
sCmdFont = StrMid(sCmdFont, 0, StrLen(sCmdFont) - 2) + '}'
; example follows - Mac/PC version
; mFont = {prop10m:"times*10", mono10m:"courier*10", $
; prop10b:"times*bold*10", mono10b:"courier*bold*10", $
; ...
; prop24m:"times*24", mono24m:"courier*24", $
; prop24b:"times*bold*24", mono24b:"courier*bold*24"}
status = Execute(sCmdFont)
; return the font structure
Return, mFont
END
--
Mike Schienle Interactive Visuals
mgs@sd.cybernex.net http://ww2.sd.cybernex.net/~mgs/
|
|
|