comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » widget_programming
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: widget_programming [message #15711 is a reply to message #15663] Fri, 04 June 1999 00:00 Go to previous messageGo to previous message
rivers is currently offline  rivers
Messages: 228
Registered: March 1991
Senior Member
In article <MPG.11beddbd77f6ed409897cb@news.frii.com>, davidf@dfanning.com
> (David Fanning) writes:
>
> Perhaps this article will generate some other ideas
> we can use. I'll collect them and post them on my
> web page. My main problem is that I don't have all these
> machines, so when a problem develops I solve it and
> forget to write the solution down. :-(
>
> (I'm also vaguely remembering a Mark Rivers function
> that helped get nice fonts in a machine-independent
> fashion. Mark, are you reading. Haven't heard from
> you in a while.)

I'm still here!

Here is the function I use to get useable and reasonably similar fonts on Motif,
(e.g. Unix and VMS) and Windows NT machines. You use the function as in the
following examples:
font = get_font_name(/helvetica, /large, /bold)
font = get_font_name(/courier, size=3)

Sorry I haven't even written a standard documentation header!

Using this function I am able to write widget applications which look very
similar on Windows and Motif. I have used it a lot on Sun, Digital Unix, VMS,
and Windows NT, less so on SGI, HP and Linux.

************************************************************
function get_font_name, $
helvetica=helvetica, times=times, courier=courier, $
tiny=tiny, small=small, medium=medium, large=large, huge=huge, $
size=size, $
bold=bold, italic=italic, $
dpi75=dpi75, dpi100=dpi100

; Returns the name of the font with the specified characteristics

; This routine should know more about the Mac. Right now it only works well on
; Windows and Motif

if (!version.os_family eq 'Windows') then begin
font = ''
if keyword_set(helvetica) then font = font + 'Helvetica' else $
if keyword_set(times) then font = font + 'Times' else $
if keyword_set(courier) then font = font + 'Courier New' else $
font = font + 'MS San Serif'

if keyword_set(bold) then font = font + '*Bold'
if keyword_set(italic) then font = font + '*Italic'
if keyword_set(tiny) then size=0
if keyword_set(small) then size=1
if keyword_set(medium) then size=2
if keyword_set(large) then size=3
if keyword_set(huge) then size=4
if (n_elements(size) eq 0) then size=2
font_size_strings = ['12', '14', '16', '18', '20']
size = (size > 0) < (n_elements(font_size_strings)-1)
font = font + '*' + font_size_strings(size)
return, font
endif else if (!version.os_family eq 'Mac') then begin
font='Helvetica'
return, font
endif else begin ; Assume Motif
font = '-adobe-'
if keyword_set(helvetica) then font = font + 'helvetica-' else $
if keyword_set(times) then font = font + 'times-' else $
if keyword_set(courier) then font = font + 'courier-' else $
font = font + 'helvetica-'

if keyword_set(bold) then font = $
font + 'bold-' else font = font + 'medium-'
if keyword_set(italic) then font = font + 'o-' else font = font + 'r-'
font = font + 'normal--*-'

if keyword_set(tiny) then size=0
if keyword_set(small) then size=1
if keyword_set(medium) then size=2
if keyword_set(large) then size=3
if keyword_set(huge) then size=4
if (n_elements(size) eq 0) then size=2
font_size_strings = ['80-', '100-', '120-', '140-', '180-']
size = (size > 0) < (n_elements(font_size_strings)-1)
font = font + font_size_strings(size)

if keyword_set(dpi100) then font = font + '100-100-' else $
if keyword_set(dpi75) then font = font + '75-75-' else $
font = font + '*-*-'
font = font + '*-*-iso8859-1'
return, font
endelse

end

____________________________________________________________
Mark Rivers (773) 702-2279 (office)
CARS (773) 702-9951 (secretary)
Univ. of Chicago (773) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars.uchicago.edu (e-mail)

or:
Argonne National Laboratory (630) 252-0422 (office)
Building 434A (630) 252-0405 (lab)
9700 South Cass Avenue (630) 252-1713 (beamline)
Argonne, IL 60439 (630) 252-0443 (FAX)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL and Dual Processor PC's
Next Topic: the dreaded issue: colors

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:35:33 PDT 2025

Total time taken to generate the page: 0.00200 seconds