y_width of xyouts [message #17449] |
Tue, 26 October 1999 00:00  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Hi,
I like to know exactly the y_width of a text in normal coordinates.
I have written a small routine which unfortunately don't run with all
devices set.
Any other ideas are welcome
I know already !D.Y_CH_SIZE but its only useful on some windows systems.
FUNCTION y_width,text,x_width=width,_extra=e
old_dev=!d.name
IF STRUPCASE(!version.os_family) EQ 'WINDOWS' THEN dev='win' ELSE
dev='x'
SET_PLOT,dev
WINDOW,/free,/pixmap,retain=0
WSET,!D.WINDOW
XYOUTS,0,0.5,text,/NORM,width=width,color=1,charthick=10,ali gnment=alignment,_extra=e
image=TVRD()
SET_PLOT,old_dev
!p.background=255
!p.color=0
dim=SIZE(image,/dim)
idx=WHERE(image EQ MAX(image))/dim[0]
y_width=(FLOAT(MAX(idx))-FLOAT(MIN(idx)))/FLOAT(dim(1))
WDELETE,!D.WINDOW
RETURN,y_width
END
|
|
|
Re: y_width of xyouts [message #17564 is a reply to message #17449] |
Thu, 28 October 1999 00:00  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
"Martin.Schultz@dkrz.de" wrote:
> In article <3815E4EF.93A13CA6@fz-juelich.de>,
> "R.Bauer" <R.Bauer@fz-juelich.de> writes:
>> Hi,
>>
>> I like to know exactly the y_width of a text in normal coordinates.
>> I have written a small routine which unfortunately don't run with all
>> devices set.
>>
>> Any other ideas are welcome
>>
>> I know already !D.Y_CH_SIZE but its only useful on some windows systems.
>>
> Hallo Reimar,
>
> I am not exactly sure why !D.Y_CH_Size shouldn't work on all devices.
> Here is a piece of code from my AxLabel routine which may help:
>
> ; Get y position for label
> ; Subtract one character size
> PY = !Y.Window[0]
> PYOFF = CONVERT_COORD(1,!D.Y_CH_SIZE*CHARSIZE,/DEVICE,/TO_NORMAL)
> PY = PY - 1.05*PYOFF[1]
>
> (it calculates the position for a label on the x axis by placing it
> below the axis with a 5% margin)
>
> Viele Gruesse,
> Martin
Hallo Martin,
hast Du Dich schon gut eingelebt?
I am not meaning that !D.Y_CH_Size don't work more I like to say it's not
exactly.
We found differences between aix and NT IDL.
If you try to get the height of one char or one line this will be quiet good
enough. But what's with
formulars or many lines with increments or exponents.
How did you determine the space between two lines?
Gruss
Reimar
|
|
|
Re: y_width of xyouts [message #17574 is a reply to message #17449] |
Thu, 28 October 1999 00:00  |
m218003
Messages: 56 Registered: August 1999
|
Member |
|
|
In article <3815E4EF.93A13CA6@fz-juelich.de>,
"R.Bauer" <R.Bauer@fz-juelich.de> writes:
> Hi,
>
> I like to know exactly the y_width of a text in normal coordinates.
> I have written a small routine which unfortunately don't run with all
> devices set.
>
> Any other ideas are welcome
>
> I know already !D.Y_CH_SIZE but its only useful on some windows systems.
>
Hallo Reimar,
I am not exactly sure why !D.Y_CH_Size shouldn't work on all devices.
Here is a piece of code from my AxLabel routine which may help:
; Get y position for label
; Subtract one character size
PY = !Y.Window
PYOFF = CONVERT_COORD(1,!D.Y_CH_SIZE*CHARSIZE,/DEVICE,/TO_NORMAL)
PY = PY - 1.05*PYOFF[1]
(it calculates the position for a label on the x axis by placing it
below the axis with a 5% margin)
Viele Gruesse,
Martin
--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
|
|
|