Re: [Vala] Pango.Context.list_families



Thanks to your help I have written sample code that shows the available
fonts in a TreeView widget. You can see it in my wiki, in the Pango
section: http://genie.webierta.skn1.com/wiki/pango


El 25/01/17 a las 15:24, Chris Daley escribió:
Hi there,

The list_families method takes an array as an out parameter. You need
to declare a FontFamily array and then pass it to the method like this:

// your existing code

fam: array of FontFamily
context.list_families(out fam)

With your existing code, it will return a zero length array. If you
want to get a list of all of the Font Families available to the
existing GDK screen, you can replace the line:

var context = new Pango.Context()

with

var context = Gdk.pango_context_get()
 
Hope this helps
Cheers
Chris D

2017-01-25 5:04 GMT+11:00 webierta gmail com
<mailto:webierta gmail com> <webierta gmail com
<mailto:webierta gmail com>>:

    Hello, I'm starting to use Genie with Pango + Gtk.

    I can not extract Pango.Context.list_families into an array of
    FontFamily

    My code:

        uses Gtk
        uses Pango

        init
            Gtk.init (ref args)
            var TestGtk = new Ventana()
            TestGtk.show_all()
            Gtk.main()

        class Ventana : Window

            init
                title = "Genie + Pango"
                set_default_size (250, 100)
                set_border_width(8)
                window_position = WindowPosition.CENTER
                destroy.connect(Gtk.main_quit)

                var sw = new Gtk.ScrolledWindow(null, null)
                sw.set_shadow_type (ShadowType.ETCHED_IN)
                sw.set_policy(PolicyType.AUTOMATIC, PolicyType.AUTOMATIC)

                var context = new Pango.Context()

                // context.list_families    ???

                // fam: array of FontFamily  ???

    Thank you
    _______________________________________________
    vala-list mailing list
    vala-list gnome org <mailto:vala-list gnome org>
    https://mail.gnome.org/mailman/listinfo/vala-list
    <https://mail.gnome.org/mailman/listinfo/vala-list>




-- 
Chris Daley
Pacific Northwest

e: chebizarro gmail com <mailto:chebizarro gmail com>
w: http://chrisdaley.biz
m: +1-971-703-9251
s: chebizarro
tw: chebizarro
tz: PDT




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]