scorninpc / php-gtk3

GTK3 extension for PHP
https://andor.com.br/
GNU Lesser General Public License v3.0
114 stars 11 forks source link

implement get_size, get_pixel_size methods #150

Closed d47081 closed 2 months ago

d47081 commented 2 months ago

https://docs.gtk.org/Pango/method.Layout.get_size.html https://docs.gtk.org/Pango/method.Layout.get_pixel_size.html

<?php

Gtk::init();

$layout = new PangoLayout(
    (new GtkDrawingArea)->create_pango_context()
);

$layout->set_text('test', 4);

var_dump(
    $layout->get_size() // OK
);

var_dump(
    $layout->get_pixel_size() // OK
);
d47081 commented 2 months ago

implemented set_markup method by the way

https://docs.gtk.org/Pango/method.Layout.set_markup.html

<?php

Gtk::init();

$layout = new PangoLayout(
    (new GtkDrawingArea)->create_pango_context()
);

$layout->set_markup('<tt>test</tt>', 13); // OK

var_dump(
    $layout->get_size() // OK
);

var_dump(
    $layout->get_pixel_size() // OK
);