[gnome-font-viewer] font-view: Support TTC fonts



commit 11d181cb5698a22664190fb829ae008b87243353
Author: Peng Wu <alexepico gmail com>
Date:   Mon Jan 25 17:56:52 2016 +0900

    font-view: Support TTC fonts
    
    https://bugzilla.gnome.org/show_bug.cgi?id=752005

 src/font-view.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/font-view.c b/src/font-view.c
index a150330..97fdc90 100644
--- a/src/font-view.c
+++ b/src/font-view.c
@@ -538,7 +538,8 @@ font_view_ensure_model (FontViewApplication *self)
 
 static void
 font_view_application_do_open (FontViewApplication *self,
-                               GFile *file)
+                               GFile *file,
+                               gint face_index)
 {
     GtkWidget *back_image;
     gchar *uri;
@@ -589,7 +590,7 @@ font_view_application_do_open (FontViewApplication *self,
     uri = g_file_get_uri (file);
 
     if (self->font_widget == NULL) {
-        self->font_widget = GTK_WIDGET (sushi_font_widget_new (uri, 0));
+        self->font_widget = GTK_WIDGET (sushi_font_widget_new (uri, face_index));
         gtk_container_add (GTK_CONTAINER (self->swin_preview), self->font_widget);
 
         g_signal_connect (self->font_widget, "loaded",
@@ -597,7 +598,7 @@ font_view_application_do_open (FontViewApplication *self,
         g_signal_connect (self->font_widget, "error",
                           G_CALLBACK (font_widget_error_cb), self);
     } else {
-        g_object_set (self->font_widget, "uri", uri, "face-index", 0, NULL);
+        g_object_set (self->font_widget, "uri", uri, "face-index", face_index, NULL);
         sushi_font_widget_load (SUSHI_FONT_WIDGET (self->font_widget));
     }
 
@@ -616,6 +617,7 @@ icon_view_release_cb (GtkWidget *widget,
     GtkTreePath *path;
     GtkTreeIter iter;
     gchar *font_path;
+    gint face_index;
     GFile *file;
 
     /* eat double/triple click events */
@@ -629,11 +631,12 @@ icon_view_release_cb (GtkWidget *widget,
         gtk_tree_model_get_iter (self->model, &iter, path)) {
         gtk_tree_model_get (self->model, &iter,
                             COLUMN_PATH, &font_path,
+                            COLUMN_FACE_INDEX, &face_index,
                             -1);
 
         if (font_path != NULL) {
             file = g_file_new_for_path (font_path);
-            font_view_application_do_open (self, file);
+            font_view_application_do_open (self, file, face_index);
             g_object_unref (file);
         }
         gtk_tree_path_free (path);
@@ -740,7 +743,7 @@ query_info_ready_cb (GObject *object,
         font_view_show_font_error (self, error->message);
         g_error_free (error);
     } else {
-        font_view_application_do_open (self, G_FILE (object));
+        font_view_application_do_open (self, G_FILE (object), 0);
     }
 
     g_clear_object (&info);


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