Alignment of baseline
- From: Lutz Gehlen <lrg_ml gmx net>
- To: gtk-i18n-list gnome org
- Subject: Alignment of baseline
- Date: Fri, 11 Jun 2010 10:04:21 +1200
Hello everybody,
I have a question about how to position text rendered using
PangoLayout and a Cairo backend. I am new to Pango (and pretty new
to Cairo as well), and I am unsure if I am doing the right thing. I
am essentially doing the following:
cairo_translate(cr, 10, 20);
layout = pango_cairo_create_layout(cr);
pango_layout_set_text(layout, "foo", -1);
If I am not mistaken this positions the topleft corner of the layout
at the given position (10, 20). However, I would like to have the
baseline at the given y position.
Therefore I subtract the value of pango_layout_get_baseline from the
desired y position. My unsureness lies with the transformation of
the return value of pango_layout_get_baseline into Cairo device
units. Currently, I am using the PANGO_PIXELS() macro to do that. It
seems to work, but I am still wondering if it is the right way to do
it and specifically if it will work on different Cairo surfaces,
with font sizes different from the default size and so on.
I would be very thankful for either a confirmation that I am doing
the right thing or a hint into the right direction.
Thank you very much for your help,
Lutz
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]