[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pango example
From: |
gregory benison |
Subject: |
pango example |
Date: |
Sun, 24 Jan 2010 11:42:45 -0800 |
>From the gnome-pango manual, version 2.16.1 --
"Some example code would be really nice here; I don't have any at the
moment. So send something to the guile-gnome list and be famous on the
interwebs!"
On that note - here is a short program (attached) making use of the
(gnome pango) capabilities.
One issue came up - the pango API defines a macro PANGO_SCALE, an
integer value needed for conversion between pixels and "pango units".
As far as I can tell, (gnome pango) does not export this value or any
binding which does the conversion. The manual mentions
"<pango-glyph-unit>" but this symbol is not bound by (gnome pango).
An easy workaround is to just hardcode the value of PANGO_SCALE into
your scheme code, on the theory that PANGO_SCALE has never changed and
probably never will - but still, it would be nice to use the actual
value from the pango library.
One solution is to wrap a newer version of the pango library.
guile-gnome-platform-2.16.1 depends on pango-1.14 or later.
Pango-1.16 and later define a function pango_units_from_double() which
takes care of the PANGO_SCALE conversion. I tried regenerating
pango.defs from the latest pango (1.24). I had to apply the patch
below to get it to compile. In the resulting (gnome pango),
"pango-units-from-double" is bound and does the proper conversion.
diff --git a/gnome/overrides/pango.defs b/gnome/overrides/pango.defs
index 48c2c4c..54b24d6 100644
--- a/gnome/overrides/pango.defs
+++ b/gnome/overrides/pango.defs
@@ -174,6 +174,13 @@
(return-type "GSList*-of-PangoLayoutLine*")
)
+(define-method get_lines_readonly
+ (of-object "PangoLayout")
+ (c-name "pango_layout_get_lines_readonly")
+ (overrides "pango_layout_get_lines_readonly")
+ (return-type "GSList*-of-PangoLayoutLine*")
+)
+
(ignore "pango_attr_shape_new_with_data"
"pango_attr_iterator_get_font"
"pango_attr_list_filter"
pango-demo.scm
Description: Binary data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- pango example,
gregory benison <=