[sugar] X fonts, and Cairo fonts
Marco Pesenti Gritti
mpg at redhat.com
Wed Mar 14 07:10:49 EDT 2007
On Wed, 2007-03-14 at 00:19 -0700, Don Hopkins wrote:
> The problem or misunderstanding I'm having with Python/Cairo/Pango is
> that it scales the fonts as it should according to the DPI, but the
> graphics coordinates I'm drawing in by default seem to be pixels instead
> of points (or that may be what I'm hallucinating). The bitmaps and
> shapes and line drawing come out much smaller on the olpc screen than on
> the big laptop screen (apparently being draw at 1:1 pixel resolution),
> while the text is about the same physical size on the each screen
> (apparently drawn in physical points, according to the screen's dpi).
>
Yeah pango font sizes are expressed in points. I think the Cairo xlib
surface defaults to pixels but... Cairo does user->device coordinates
transformation so adapting to the resolution (using points of whatever)
should be matter of setting a different matrix.
In Sugar we are doing points_to_pixels transformation explicitly, which
is a bit inconvenient but works. Eventually I want to fix HippoCanvas to
specify coordinates in points.
> > This is complicated somewhat because we're running in Xephyr in the
> > sugar-jhbuild environment, which I think throws some DPI calculations
> > off. I'm not entirely sure what the solution is here.
> >
> > But as far as I know, if you tell Pango to render a 12pt font on the XO,
> > it should come out the same physical size (ie, 1/6th of an inch) as on
> > your laptop, because that's what points are supposed to do.
> >
> > Dan
> >
> I've been lazily testing python code by just connecting to my regular
> X11 server instead of Xephyr. Maybe that's my problem. What advantages
> are there using Xephyr? Is it required to run the Sugar window manager
> and activity stuff? Is Xephyr configured to 200 dpi, to show how
> graphics will come out on the olpc screen? For developing
> Python/Cairo/Pango components that don't require the Sugar window
> manager, would it be ok not to use Xephyr, and just configure X's main
> screen to think it's 200dpi? Or is it important to test stuff running
> inside of Xephyr?
Xephyr is configured to whatever DPI your screen is. Simulate the OLPC
screen exactly is not viable at the moment, because Xephyr cannot scale
down the screen image. And anyway it seem sane to try and be resolution
independent (both dpi and actual screen size/ratio).
Marco
More information about the Sugar
mailing list