[Gambas-user] Where is Font.Resolution?

Rolf-Werner Eilert eilert-sprachen at ...221...
Thu Oct 9 09:21:46 CEST 2008


Benoit Minisini schrieb:
> On mercredi 08 octobre 2008, Rolf-Werner Eilert wrote:
>> Another question:
>>
>> In Gambas1, there was Font.Resolution. I used it for scaling things. In
>> Gambas2, it doesn't exist anymore.
>>
>> Is there a replacement?
>>
>> Regards
>>
>> Rolf
>>
> 
> Desktop.Resolution (more logical name)
> 

Are you sure this was the same? Font.Resolution had a completely 
different description:

--------------
STATIC PROPERTY Resolution AS Integer


Returns or sets the resolution used for transforming font size from 
points to screen pixel sizes. By default, font size is based on a 96 DPI 
resolution.
Gambas use this property so that a given font size will always display 
the same whatever the real screen resolution is.


--------------

In the printing engine I programmed in Gambas1, the only chance to get 
pictures/images (such as firm logo etc.) printed correctly was to 
compute a graphical ratio like this:

'before starting to print, get graphical ratio

  grafikRatio = Desktop.Resolution / Font.Resolution

'then start printing, and when it's an image,
'compute the printing ratio for it and calculate
'the stretching values in percent (as they are given
'in the printing form)

     bild = image.Load(datei$)
     druckRatio = Printer.Resolution / Desktop.Resolution * grafikRatio
     breite = bild.Width
     hoehe = bild.Height
     breite = (breite / 100 * prozent) * druckRatio
     hoehe = (hoehe / 100 * prozent) * druckRatio
     Draw.Image(bild.Stretch(breite, hoehe), x1, y1)

Don't ask me about details, it's been a long time ago, but it used to 
run this way and had cost me a lot of brain pain at that time to develop 
  :-) I vaguely remember that otherwise the images turned out way too 
small or too large.

Now fyi, in Gambas2 I just replaced Font.Resolution by "96", and it runs 
as expected. The basic question now is, what does printing have to do 
with desktop resolution, and is there an easier way to achieve this in 
Gambas2?

Regards

Rolf




More information about the User mailing list