[goffice] Font Selector: new function go_font_sel_get_font_desc.



commit 61691a0e022f4f029237fee8e805cef65812d93f
Author: Morten Welinder <terra gnome org>
Date:   Thu Mar 14 12:45:19 2013 -0400

    Font Selector: new function go_font_sel_get_font_desc.

 ChangeLog                 |    1 +
 goffice/gtk/go-font-sel.c |   23 +++++++++++++++++++++++
 goffice/gtk/go-font-sel.h |    1 +
 3 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 235f93e..1018a6f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
        to FALSE.
        (go_font_sel_set_style): Make this public and use pango type args.
        (go_font_sel_set_sample_attributes): Handle super and subscript.
+       (go_font_sel_get_font_desc): New function.
 
        * goffice/gtk/goffice-gtk.c (go_gtk_widget_replace): New function.
 
diff --git a/goffice/gtk/go-font-sel.c b/goffice/gtk/go-font-sel.c
index 5b0d407..85c4173 100644
--- a/goffice/gtk/go-font-sel.c
+++ b/goffice/gtk/go-font-sel.c
@@ -686,3 +686,26 @@ go_font_sel_set_font (GOFontSel *gfs, GOFont const *font)
        go_font_sel_set_uline (gfs, font->underline);
        go_font_sel_set_color (gfs, font->color);
 }
+
+
+/**
+ * go_font_sel_get_font_desc:
+ * @fs: the font selector
+ *
+ * Returns: (transfer full): a description of the font set.
+ */
+PangoFontDescription *
+go_font_sel_get_font_desc (GOFontSel *fs)
+{
+       PangoAttrIterator *aiter;
+       PangoFontDescription *desc;
+
+       g_return_val_if_fail (GO_IS_FONT_SEL (fs), NULL);
+
+       aiter = pango_attr_list_get_iterator (fs->modifications);
+       desc = pango_font_description_new ();
+       pango_attr_iterator_get_font (aiter, desc, NULL, NULL);
+       pango_attr_iterator_destroy (aiter);
+
+       return desc;
+}
diff --git a/goffice/gtk/go-font-sel.h b/goffice/gtk/go-font-sel.h
index cf4f1f3..9c65423 100644
--- a/goffice/gtk/go-font-sel.h
+++ b/goffice/gtk/go-font-sel.h
@@ -45,6 +45,7 @@ void go_font_sel_set_size          (GOFontSel *fs, int size);
 void go_font_sel_set_style         (GOFontSel *fs,
                                    PangoWeight weight, PangoStyle style);
 
+PangoFontDescription *go_font_sel_get_font_desc (GOFontSel *fs);
 
 G_END_DECLS
 


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