PangoFontDescription::set_size
| From: | Tom Rogers | Date: | Sun, 11 Dec 2005 08:26:08 +0000 |
| Subject: | PangoFontDescription::set_size | ||
| Groups: | php.gtk.dev | ||
| Request: | Send a blank email to php-gtk-dev+get-2101@lists.php.net to get a copy of this message | ||
Hi
Been playing with pango and suggest a small change to
PangoFontDescription::set_size();
Pango is expecting the size in pango_units.
You can put in the constructor string:
$fontdescription = new PangoFontDescription("Ariel 30");
when you use $fontdescription->set_size(30); the resulting font size
is 0.29296875
The patch to pango.overriodes will multiply the size by PANGO_SCALE
making the 2 methods match.
I hope that makes sense :)
I still haven't worked out how to make it find the Ariel font but
thats another story.
--
Tom
RCS file: /repository/php-gtk/ext/gtk+/pango.overrides,v retrieving revision 1.7 diff -u -w -b -r1.7 pango.overrides --- pango.overrides 31 Jul 2005 10:14:44 -0000 1.7 +++ pango.overrides 11 Dec 2005 08:13:26 -0000 @@ -70,3 +70,26 @@ ink.height, logical.x, logical.y, logical.width, logical.height); } + +%% +add-arginfo PangoFontDescription set_size +static +ZEND_BEGIN_ARG_INFO_EX(ARGINFO_NAME, 0, 0, 0) + ZEND_ARG_INFO(0, size) +ZEND_END_ARG_INFO(); + +%% +override pango_font_description_set_size +PHP_METHOD +{ + + long size; + + NOT_STATIC_METHOD(); + + if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "i", &size)) + return; + + pango_font_description_set_size((PangoFontDescription *)PHPG_GBOXED(this_ptr), (gint)size * PANGO_SCALE); + +}
RCS file: /repository/php-gtk/ext/gtk+/pango.overrides,v retrieving revision 1.7 diff -u -w -b -r1.7 pango.overrides --- pango.overrides 31 Jul 2005 10:14:44 -0000 1.7 +++ pango.overrides 11 Dec 2005 08:13:26 -0000 @@ -70,3 +70,26 @@ ink.height, logical.x, logical.y, logical.width, logical.height); } + +%% +add-arginfo PangoFontDescription set_size +static +ZEND_BEGIN_ARG_INFO_EX(ARGINFO_NAME, 0, 0, 0) + ZEND_ARG_INFO(0, size) +ZEND_END_ARG_INFO(); + +%% +override pango_font_description_set_size +PHP_METHOD +{ + + long size; + + NOT_STATIC_METHOD(); + + if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "i", &size)) + return; + + pango_font_description_set_size((PangoFontDescription *)PHPG_GBOXED(this_ptr), (gint)size * PANGO_SCALE); + +}