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

Home » Public Forums » archive » Why the font is smaller in the IDLgrBuffer ?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Why the font is smaller in the IDLgrBuffer ? [message #65337] Fri, 27 February 2009 07:50 Go to next message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
I've a simple question...

I've an IDLgrView with some IDLgrTexts using a certain IDLgrFont and I
convert all of that to an IDLgrImage using an IDLgrBuffer.
The Buffer has the same dimensions of the View and I use the Draw and
Read methods.

On the result, the font of all texts is modified and smaller than the
original.
Why ?
How can I do to preserve the same font size ?


Thanks,
Bernat
Re: Why the font is smaller in the IDLgrBuffer ? [message #65414 is a reply to message #65337] Sat, 28 February 2009 02:59 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
bernat schrieb:
> LOOL !!!!
> Thank you so much ! It's nice to take part of this group...
>
> Now, all works fine !
>

LOOL != LOL ?
Re: Why the font is smaller in the IDLgrBuffer ? [message #65416 is a reply to message #65337] Fri, 27 February 2009 13:19 Go to previous message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
LOOL !!!!
Thank you so much ! It's nice to take part of this group...

Now, all works fine !
Re: Why the font is smaller in the IDLgrBuffer ? [message #65417 is a reply to message #65337] Fri, 27 February 2009 13:05 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
bernat wrote:
> Hi Rick,
>
> I wrote a small routine to aproximate the font size in the buffer to
> the original font size.
> It's a crazy solution. See below...
>
> With your idea all results more easy.
> The only thing to do is set the RESOLUTION property on the
> IDLgrBuffer. Like that:
> resolution=[1d/!D.X_PX_CM,1d/!D.Y_PX_CM]
> oBuffer->SetProperty, RESOLUTION=resolution)
>
> The problem is that !D.XY_PX_CM only returns the approximate number of
> pixels per centimeter in the X and Y directions so the font size
> changes a little bit beacause the resolution is not exact.
>
> There is another way to get the DPI ?
>
> Thanks,
>
> Bernat
>
> ;----------------------------------------------------------- -------------------------
>
> PRO TEST_BUFFER_FONT, font_size, dimensions, $ ;;input
> final_font_size ;;output
>
> tt=SYSTIME(/SEC)
>
> oView=OBJ_NEW('IDlgrView', VIEWPLANE_RECT=[0,0,dimensions
> [0],dimensions[1]])
> oModel=OBJ_NEW('IDLgrModel')
> oModel->SetProperty, /DEPTH_WRITE_DISABLE
> oView->Add, oModel
>
> buff_font=OBJ_NEW('IDLgrFont', 'Helvetica', SIZE=font_size, THICK=2)
> buff_text=OBJ_NEW('IDLgrText', STRING='null text', FONT=buff_font,
> RECOMPUTE_DIMENSIONS=2)
> oModel->Add, buff_text
>
> oBuffer=OBJ_NEW('IDLgrBuffer', DIMENSIONS=dimensions)
> oBuffer->Draw, oView
>
> buff_text_dim=oBuffer->GetTextDimensions(buff_text)
>
> count=1.
> WHILE buff_text_dim[1] LT font_size DO BEGIN
> buff_font->SetProperty, SIZE=font_size+count
> oBuffer->Draw, oView
> buff_text_dim=oBuffer->GetTextDimensions(buff_text)
> count=count+1.
> ENDWHILE
>
> PRINT, 'Font size / size after buffer ', font_size, buff_text_dim[1]
>
> final_font_size=font_size+count
>
> OBJ_DESTROY, [oView, oModel, oBuffer, buff_font, buff_text]
>
> PRINT, 'TEST_BUFER_FONT TIME ', SYSTIME(/SEC)-tt
> END

Try:

IDL> minfo = obj_new('IDLsysMonitorInfo')
IDL> print, minfo->getResolutions()
0.026458333 0.026478617
0.026458333 0.026478617
IDL> obj_destroy, minfo

Mike
--
www.michaelgalloy.com
Associate Research Scientist
Tech-X Corporation
Re: Why the font is smaller in the IDLgrBuffer ? [message #65419 is a reply to message #65337] Fri, 27 February 2009 12:41 Go to previous message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
Hi Rick,

I wrote a small routine to aproximate the font size in the buffer to
the original font size.
It's a crazy solution. See below...

With your idea all results more easy.
The only thing to do is set the RESOLUTION property on the
IDLgrBuffer. Like that:
resolution=[1d/!D.X_PX_CM,1d/!D.Y_PX_CM]
oBuffer->SetProperty, RESOLUTION=resolution)

The problem is that !D.XY_PX_CM only returns the approximate number of
pixels per centimeter in the X and Y directions so the font size
changes a little bit beacause the resolution is not exact.

There is another way to get the DPI ?

Thanks,

Bernat

;----------------------------------------------------------- -------------------------

PRO TEST_BUFFER_FONT, font_size, dimensions, $ ;;input
final_font_size ;;output

tt=SYSTIME(/SEC)

oView=OBJ_NEW('IDlgrView', VIEWPLANE_RECT=[0,0,dimensions
[0],dimensions[1]])
oModel=OBJ_NEW('IDLgrModel')
oModel->SetProperty, /DEPTH_WRITE_DISABLE
oView->Add, oModel

buff_font=OBJ_NEW('IDLgrFont', 'Helvetica', SIZE=font_size, THICK=2)
buff_text=OBJ_NEW('IDLgrText', STRING='null text', FONT=buff_font,
RECOMPUTE_DIMENSIONS=2)
oModel->Add, buff_text

oBuffer=OBJ_NEW('IDLgrBuffer', DIMENSIONS=dimensions)
oBuffer->Draw, oView

buff_text_dim=oBuffer->GetTextDimensions(buff_text)

count=1.
WHILE buff_text_dim[1] LT font_size DO BEGIN
buff_font->SetProperty, SIZE=font_size+count
oBuffer->Draw, oView
buff_text_dim=oBuffer->GetTextDimensions(buff_text)
count=count+1.
ENDWHILE

PRINT, 'Font size / size after buffer ', font_size, buff_text_dim[1]

final_font_size=font_size+count

OBJ_DESTROY, [oView, oModel, oBuffer, buff_font, buff_text]

PRINT, 'TEST_BUFER_FONT TIME ', SYSTIME(/SEC)-tt
END
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: 1e38 limit?
Next Topic: Getting IDL 6.0 to work under Vista

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

Current Time: Wed Oct 08 19:13:29 PDT 2025

Total time taken to generate the page: 0.00477 seconds