scorninpc / php-gtk3

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

implement set_spacing, get_spacing, set_line_spacing, get_line_spacing #152

Closed d47081 closed 4 months ago

d47081 commented 4 months ago

https://docs.gtk.org/Pango/method.Layout.set_spacing.html https://docs.gtk.org/Pango/method.Layout.get_spacing.html https://docs.gtk.org/Pango/method.Layout.set_line_spacing.html https://docs.gtk.org/Pango/method.Layout.get_line_spacing.html

<?php

Gtk::init();

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

$layout->set_spacing(1); // OK

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

$layout->set_line_spacing(1.5); // OK

var_dump(
    $layout->get_line_spacing() // OK
);
scorninpc commented 4 months ago

I know that is a ide auto format, but this is not nice hahaha

return pango_layout_get_line_spacing(
        PANGO_LAYOUT(
            instance
        )
    );

just do

return pango_layout_get_line_spacing(PANGO_LAYOUT(instance));

another thing, try to not return directly. Return to a var, and return the var. this can do things easly to maintain or cast if needed