[Gambas-user] Draw.Text adapted to DrawingArea ?

Benoit Minisini gambas at ...1...
Mon Feb 14 15:18:45 CET 2005


On Monday 14 February 2005 15:11, Eilert wrote:
> Ah Laurent, I think I didn't explain clear enough what I want. Let me
> say it this way:
>
> When I start my preview, I call a function that recalculates millimeters
> into screen pixels. The DrawingArea has to be adjusted in measures of
> screen pixels. My little function take the Desktop.Resolution and
> computes the necessary number of pixels to let the DrawingArea as wide
> and as long as necessary for an A4 page.
>
> The problem is that it miscalculates a bit (maybe 10 %) because
> "Desktop.Resolution" says something like 76, and it would be 82 to make
> a "real" A4 sheet (I compared it on the screen).
>
> So everything appears somewhat smaller than A4. No problem, BUT WITH FONTS:
>
> Fonts are sized in pts, i. e. points, and not screen pixels. The
> function behind this in Qt recalculates my "Courier 12" into the
> necessary number of screen pixels for a page with Desktop.Resolution 76,
> not 82. So on my somewhat smaller page, all fonts appear slightly too big.
>
> What I am looking for is an easy way to rescale the fonts to a size
> which fits to the scale of my DrawingArea, maybe something like a
> pts-to-screen-pixel ratio.
>
> Rolf
>

Font has its own resolution settings, that is used only when displaying on a 
screen (not on a printer).

I mean there is a Font.Resolution property that can be different from 
Desktop.Resolution. By default, Font.Resolution = 96. But you can change it 
if you need.

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list