[gtk+/wip/matthiasc/font-variations] Improve the demo a bit



commit 05717c3791fa8ea4484aaa54fc6255d42d5f7eb4
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Sep 15 08:36:54 2017 -0400

    Improve the demo a bit
    
    Add another label showing the effective font description.
    This lets people learn the syntax for font variations.
    
    Also, make those labels monospace.

 demos/gtk-demo/font-features.ui |   21 +++++++++++++++++++++
 demos/gtk-demo/font_features.c  |    5 ++++-
 2 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/demos/gtk-demo/font-features.ui b/demos/gtk-demo/font-features.ui
index 467971b..94d712b 100644
--- a/demos/gtk-demo/font-features.ui
+++ b/demos/gtk-demo/font-features.ui
@@ -1675,6 +1675,27 @@
                 <property name="max-width-chars">50</property>
                 <property name="hexpand">1</property>
                 <property name="vexpand">1</property>
+                <style>
+                  <class name="monospace"/>
+                </style>
+              </object>
+            </child>
+            <child>
+              <object class="GtkLabel" id="description">
+                <property name="visible">1</property>
+                <property name="wrap">1</property>
+                <property name="margin-start">20</property>
+                <property name="margin-end">20</property>
+                <property name="margin-bottom">20</property>
+                <property name="xalign">0</property>
+                <property name="valign">end</property>
+                <property name="width-chars">50</property>
+                <property name="max-width-chars">50</property>
+                <property name="hexpand">1</property>
+                <property name="vexpand">0</property>
+                <style>
+                  <class name="monospace"/>
+                </style>
               </object>
             </child>
             <property name="hexpand">1</property>
diff --git a/demos/gtk-demo/font_features.c b/demos/gtk-demo/font_features.c
index a49e63a..39de3cb 100644
--- a/demos/gtk-demo/font_features.c
+++ b/demos/gtk-demo/font_features.c
@@ -21,6 +21,7 @@
 
 static GtkWidget *label;
 static GtkWidget *settings;
+static GtkWidget *description;
 static GtkWidget *font;
 static GtkWidget *script_lang;
 static GtkWidget *resetbutton;
@@ -76,6 +77,8 @@ update_display (void)
   add_font_variations (s);
   font_desc = g_string_free (s, FALSE);
 
+  gtk_label_set_text (GTK_LABEL (description), font_desc);
+
   s = g_string_new ("");
 
   has_feature = FALSE;
@@ -112,7 +115,6 @@ update_display (void)
 
   gtk_label_set_text (GTK_LABEL (settings), font_settings);
 
-
   if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (script_lang), &iter))
     {
       model = gtk_combo_box_get_model (GTK_COMBO_BOX (script_lang));
@@ -811,6 +813,7 @@ do_font_features (GtkWidget *do_widget)
       window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
       label = GTK_WIDGET (gtk_builder_get_object (builder, "label"));
       settings = GTK_WIDGET (gtk_builder_get_object (builder, "settings"));
+      description = GTK_WIDGET (gtk_builder_get_object (builder, "description"));
       resetbutton = GTK_WIDGET (gtk_builder_get_object (builder, "reset"));
       font = GTK_WIDGET (gtk_builder_get_object (builder, "font"));
       script_lang = GTK_WIDGET (gtk_builder_get_object (builder, "script_lang"));


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