[gnome-font-viewer/wip/ewlsh/gtk4] Format




commit 9516075c51a774153ad0c1ea5b57f257b5409a12
Author: Evan Welsh <contact evanwelsh com>
Date:   Sun Jan 9 20:10:51 2022 -0800

    Format

 .clang-format           |   16 +
 src/font-model.c        |  204 +++++----
 src/font-model.h        |   32 +-
 src/font-view.c         |  692 ++++++++++++++--------------
 src/sushi-font-loader.c |  161 ++++---
 src/sushi-font-loader.h |    3 +-
 src/sushi-font-widget.c | 1140 +++++++++++++++++++++++------------------------
 src/sushi-font-widget.h |    7 +-
 8 files changed, 1160 insertions(+), 1095 deletions(-)
---
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..3b0dc9d
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,16 @@
+UseTab: false
+IndentWidth: 4
+BreakBeforeBraces: Linux
+SpaceBeforeParens: Always
+SpacesInContainerLiterals: true
+AllowShortIfStatementsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: All
+IndentCaseLabels: false
+ColumnLimit: 80
+SpaceAfterCStyleCast: true
+AlignAfterOpenBracket: Align
+BinPackParameters: false
+BinPackArguments: true
+AlignConsecutiveDeclarations: false
+PointerAlignment: Right
+AllowShortEnumsOnASingleLine: true
\ No newline at end of file
diff --git a/src/font-model.c b/src/font-model.c
index 33b6f21..761c02e 100644
--- a/src/font-model.c
+++ b/src/font-model.c
@@ -1,5 +1,5 @@
 /* -*- mode: C; c-basic-offset: 4 -*-
- * gnome-font-view: 
+ * gnome-font-view:
  *
  * Copyright (C) 2012 Cosimo Cecchi <cosimoc gnome org>
  *
@@ -7,7 +7,7 @@
  *
  * fontilus - a collection of font utilities for GNOME
  * Copyright (C) 2002-2003  James Henstridge <james daa com au>
- * 
+ *
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -24,18 +24,17 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <ft2build.h>
 #include <gio/gio.h>
 #include <gtk/gtk.h>
 #include <pango/pango.h>
-#include <ft2build.h>
 #include FT_FREETYPE_H
 #include <fontconfig/fontconfig.h>
 
 #include "font-model.h"
 #include "sushi-font-loader.h"
 
-struct _FontViewModel
-{
+struct _FontViewModel {
     GObject parent_instance;
 
     /* list of fonts in fontconfig database */
@@ -53,8 +52,7 @@ struct _FontViewModel
 
 G_DEFINE_TYPE (FontViewModel, font_view_model, G_TYPE_OBJECT)
 
-struct _FontViewModelItem
-{
+struct _FontViewModelItem {
     GObject parent_instance;
 
     gchar *font_name;
@@ -92,15 +90,15 @@ font_view_model_item_init (FontViewModelItem *self)
 static FontViewModelItem *
 font_view_model_item_new (const gchar *font_name,
                           const gchar *font_preview_text,
-                          const PangoFontDescription* font_description,
-                          GFile       *file,
-                          int          face_index)
+                          const PangoFontDescription *font_description,
+                          GFile *file,
+                          int face_index)
 {
     FontViewModelItem *item = g_object_new (FONT_VIEW_TYPE_MODEL_ITEM, NULL);
 
     item->font_name = g_strdup (font_name);
     item->font_preview_text = g_strdup (font_preview_text);
-    item->font_description =  pango_font_description_copy(font_description);
+    item->font_description = pango_font_description_copy (font_description);
     item->file = g_object_ref (file);
     item->face_index = face_index;
 
@@ -119,7 +117,7 @@ font_view_model_item_get_font_preview_text (FontViewModelItem *self)
     return self->font_preview_text;
 }
 
-const PangoFontDescription*
+const PangoFontDescription *
 font_view_model_item_get_font_description (FontViewModelItem *self)
 {
     return self->font_description;
@@ -138,8 +136,7 @@ font_view_model_item_get_face_index (FontViewModelItem *self)
 }
 
 gboolean
-font_view_model_has_face (FontViewModel *self,
-                          FT_Face face)
+font_view_model_has_face (FontViewModel *self, FT_Face face)
 {
     guint n_items;
     gint idx;
@@ -149,7 +146,8 @@ font_view_model_has_face (FontViewModel *self,
     match_name = sushi_get_font_name (face, TRUE);
 
     for (idx = 0; idx < n_items; idx++) {
-        FontViewModelItem *item = g_list_model_get_item (G_LIST_MODEL (self->model), idx);
+        FontViewModelItem *item =
+            g_list_model_get_item (G_LIST_MODEL (self->model), idx);
 
         if (g_strcmp0 (item->font_name, match_name) == 0)
             return TRUE;
@@ -164,84 +162,123 @@ font_infos_loaded (GObject *source_object,
                    gpointer user_data)
 {
     FontViewModel *self = FONT_VIEW_MODEL (source_object);
-    g_autoptr(GPtrArray) items = g_task_propagate_pointer (G_TASK (result), NULL);
+    g_autoptr (GPtrArray) items =
+        g_task_propagate_pointer (G_TASK (result), NULL);
 
     g_list_store_splice (self->model, 0, 0, items->pdata, items->len);
 }
 
-static const gchar* weight_to_name(int weight) {
+static const gchar *
+weight_to_name (int weight)
+{
     switch (weight) {
-        case FC_WEIGHT_THIN: return "Thin";
-        case FC_WEIGHT_EXTRALIGHT: return "Extralight";
-        case FC_WEIGHT_LIGHT: return "Light";
-        case FC_WEIGHT_SEMILIGHT: return "Semilight";
-        case FC_WEIGHT_BOOK: return "Book";
-        case FC_WEIGHT_REGULAR: return "Regular";
-        case FC_WEIGHT_MEDIUM: return "Medium";
-        case FC_WEIGHT_SEMIBOLD: return "Semibold";
-        case FC_WEIGHT_BOLD: return "Bold";
-        case FC_WEIGHT_EXTRABOLD: return "Extrabold";
-        case FC_WEIGHT_HEAVY: return "Heavy";
-        case FC_WEIGHT_EXTRABLACK: return "Extrablack";
+    case FC_WEIGHT_THIN:
+        return "Thin";
+    case FC_WEIGHT_EXTRALIGHT:
+        return "Extralight";
+    case FC_WEIGHT_LIGHT:
+        return "Light";
+    case FC_WEIGHT_SEMILIGHT:
+        return "Semilight";
+    case FC_WEIGHT_BOOK:
+        return "Book";
+    case FC_WEIGHT_REGULAR:
+        return "Regular";
+    case FC_WEIGHT_MEDIUM:
+        return "Medium";
+    case FC_WEIGHT_SEMIBOLD:
+        return "Semibold";
+    case FC_WEIGHT_BOLD:
+        return "Bold";
+    case FC_WEIGHT_EXTRABOLD:
+        return "Extrabold";
+    case FC_WEIGHT_HEAVY:
+        return "Heavy";
+    case FC_WEIGHT_EXTRABLACK:
+        return "Extrablack";
     }
 
     return NULL;
 }
 
-static const PangoWeight fc_weight_to_pango_weight(int weight) {
+static const PangoWeight
+fc_weight_to_pango_weight (int weight)
+{
     switch (weight) {
-        case FC_WEIGHT_THIN: return PANGO_WEIGHT_THIN;
-        case FC_WEIGHT_EXTRALIGHT: return PANGO_WEIGHT_ULTRALIGHT;
-        case FC_WEIGHT_LIGHT: return PANGO_WEIGHT_LIGHT;
-        case FC_WEIGHT_SEMILIGHT: return PANGO_WEIGHT_SEMILIGHT;
-        case FC_WEIGHT_BOOK: return PANGO_WEIGHT_BOOK;
-        case FC_WEIGHT_REGULAR: return PANGO_WEIGHT_NORMAL;
-        case FC_WEIGHT_MEDIUM: return PANGO_WEIGHT_MEDIUM;
-        case FC_WEIGHT_SEMIBOLD: return PANGO_WEIGHT_SEMIBOLD;
-        case FC_WEIGHT_BOLD: return PANGO_WEIGHT_BOLD;
-        case FC_WEIGHT_EXTRABOLD: return PANGO_WEIGHT_ULTRABOLD;
-        case FC_WEIGHT_HEAVY: return PANGO_WEIGHT_HEAVY;
-        case FC_WEIGHT_EXTRABLACK: return PANGO_WEIGHT_ULTRAHEAVY;
+    case FC_WEIGHT_THIN:
+        return PANGO_WEIGHT_THIN;
+    case FC_WEIGHT_EXTRALIGHT:
+        return PANGO_WEIGHT_ULTRALIGHT;
+    case FC_WEIGHT_LIGHT:
+        return PANGO_WEIGHT_LIGHT;
+    case FC_WEIGHT_SEMILIGHT:
+        return PANGO_WEIGHT_SEMILIGHT;
+    case FC_WEIGHT_BOOK:
+        return PANGO_WEIGHT_BOOK;
+    case FC_WEIGHT_REGULAR:
+        return PANGO_WEIGHT_NORMAL;
+    case FC_WEIGHT_MEDIUM:
+        return PANGO_WEIGHT_MEDIUM;
+    case FC_WEIGHT_SEMIBOLD:
+        return PANGO_WEIGHT_SEMIBOLD;
+    case FC_WEIGHT_BOLD:
+        return PANGO_WEIGHT_BOLD;
+    case FC_WEIGHT_EXTRABOLD:
+        return PANGO_WEIGHT_ULTRABOLD;
+    case FC_WEIGHT_HEAVY:
+        return PANGO_WEIGHT_HEAVY;
+    case FC_WEIGHT_EXTRABLACK:
+        return PANGO_WEIGHT_ULTRAHEAVY;
     }
 
     return PANGO_WEIGHT_NORMAL;
 }
 
-static const gchar* slant_to_name(int slant) {
+static const gchar *
+slant_to_name (int slant)
+{
     switch (slant) {
-        case FC_SLANT_ROMAN: return NULL;
-        case FC_SLANT_ITALIC: return "Italic";
-        case FC_SLANT_OBLIQUE: return "Oblique";
+    case FC_SLANT_ROMAN:
+        return NULL;
+    case FC_SLANT_ITALIC:
+        return "Italic";
+    case FC_SLANT_OBLIQUE:
+        return "Oblique";
     }
 
     return NULL;
 }
 
 static gchar *
-build_font_name (const char *style_name, const char *family_name, int slant, int weight, gboolean short_form)
+build_font_name (const char *style_name,
+                 const char *family_name,
+                 int slant,
+                 int weight,
+                 gboolean short_form)
 {
-   const char* style_name_x = style_name;
-   const gchar* slant_name = slant_to_name(slant);
-   const gchar* weight_name = weight_to_name(weight);
+    const char *style_name_x = style_name;
+    const gchar *slant_name = slant_to_name (slant);
+    const gchar *weight_name = weight_to_name (weight);
 
     if (style_name_x == NULL) {
         if (slant_name != NULL && weight_name == NULL)
-            style_name_x = g_strdup_printf("%s", slant_name);
+            style_name_x = g_strdup_printf ("%s", slant_name);
         else if (slant_name == NULL && weight_name != NULL)
-            style_name_x = g_strdup_printf("%s", weight_name);
+            style_name_x = g_strdup_printf ("%s", weight_name);
         else if (slant_name != NULL && weight_name != NULL)
-            style_name_x = g_strdup_printf("%s %s", weight_name, slant_name);
+            style_name_x = g_strdup_printf ("%s %s", weight_name, slant_name);
     }
 
-  if (family_name == NULL) {
-    /* Use an empty string as the last fallback */
-    return g_strdup ("");
-  }
+    if (family_name == NULL) {
+        /* Use an empty string as the last fallback */
+        return g_strdup ("");
+    }
 
-  if (style_name_x == NULL || (short_form && g_strcmp0 (style_name_x, "Regular") == 0))
-    return g_strdup (family_name);
+    if (style_name_x == NULL ||
+        (short_form && g_strcmp0 (style_name_x, "Regular") == 0))
+        return g_strdup (family_name);
 
-  return g_strconcat (family_name, ", ", style_name_x, NULL);
+    return g_strconcat (family_name, ", ", style_name_x, NULL);
 }
 
 static void
@@ -251,7 +288,7 @@ load_font_infos (GTask *task,
                  GCancellable *cancellable)
 {
     FontViewModel *self = FONT_VIEW_MODEL (source_object);
-    g_autoptr(GPtrArray) items = NULL;
+    g_autoptr (GPtrArray) items = NULL;
     gint i, n_fonts;
 
     n_fonts = self->font_list->nfont;
@@ -262,30 +299,30 @@ load_font_infos (GTask *task,
         FcChar8 *path, *family, *style;
         int index, slant, weight;
         g_autofree gchar *font_name = NULL;
-        g_autoptr(GFile) file = NULL;
+        g_autoptr (GFile) file = NULL;
 
         if (g_task_return_error_if_cancelled (task))
             return;
 
         g_mutex_lock (&self->font_list_mutex);
-        FcPattern* font = self->font_list->fonts[i];
+        FcPattern *font = self->font_list->fonts[i];
         FcPatternGetString (font, FC_FILE, 0, &path);
         FcPatternGetInteger (font, FC_INDEX, 0, &index);
         g_autofree gchar *style_name = NULL;
         g_autofree gchar *family_name = NULL;
-        FcResult result = FcPatternGetString(font, FC_FAMILY, 0, &family);
+        FcResult result = FcPatternGetString (font, FC_FAMILY, 0, &family);
         if (result == FcResultMatch) {
-            family_name = g_strdup((const gchar*) family);
+            family_name = g_strdup ((const gchar *) family);
         }
-        result = FcPatternGetString(font, FC_STYLE, 0, &style);
+        result = FcPatternGetString (font, FC_STYLE, 0, &style);
         if (result == FcResultMatch) {
-            style_name = g_strdup((const gchar*) style);
+            style_name = g_strdup ((const gchar *) style);
         }
-        result = FcPatternGetInteger(font, FC_SLANT, 0, &slant);
+        result = FcPatternGetInteger (font, FC_SLANT, 0, &slant);
         if (result != FcResultMatch) {
             slant = -1;
         }
-        result = FcPatternGetInteger(font, FC_WEIGHT, 0, &weight);
+        result = FcPatternGetInteger (font, FC_WEIGHT, 0, &weight);
         if (result != FcResultMatch) {
             weight = -1;
         }
@@ -293,21 +330,24 @@ load_font_infos (GTask *task,
 
         file = g_file_new_for_path ((const gchar *) path);
 
-        font_name = build_font_name(style_name, family_name, slant, weight, TRUE);
+        font_name =
+            build_font_name (style_name, family_name, slant, weight, TRUE);
         if (!font_name)
             continue;
-        
+
         // TODO: Support scripts which don't contain "Aa"
-        const char* font_preview_text = g_strdup ("Aa");
+        const char *font_preview_text = g_strdup ("Aa");
 
-        PangoFontDescription* font_description = pango_font_description_new();
+        PangoFontDescription *font_description = pango_font_description_new ();
 
-        pango_font_description_set_family(font_description, family_name);
-        pango_font_description_set_weight(font_description, fc_weight_to_pango_weight(weight));
+        pango_font_description_set_family (font_description, family_name);
+        pango_font_description_set_weight (font_description,
+                                           fc_weight_to_pango_weight (weight));
         // TODO: Support italics
-        pango_font_description_set_style(font_description, PANGO_STYLE_NORMAL);
+        pango_font_description_set_style (font_description, PANGO_STYLE_NORMAL);
 
-        item = font_view_model_item_new (font_name, font_preview_text, font_description, file, index);
+        item = font_view_model_item_new (font_name, font_preview_text,
+                                         font_description, file, index);
         g_ptr_array_add (items, item);
     }
 
@@ -320,10 +360,10 @@ ensure_font_list (FontViewModel *self)
 {
     FcPattern *pat;
     FcObjectSet *os;
-    g_autoptr(GTask) task = NULL;
+    g_autoptr (GTask) task = NULL;
 
     /* always reinitialize the font database */
-    if (!FcInitReinitialize())
+    if (!FcInitReinitialize ())
         return;
 
     g_cancellable_cancel (self->cancellable);
@@ -332,7 +372,8 @@ ensure_font_list (FontViewModel *self)
     g_list_store_remove_all (self->model);
 
     pat = FcPatternCreate ();
-    os = FcObjectSetBuild (FC_FILE, FC_INDEX, FC_FAMILY, FC_WEIGHT, FC_SLANT, NULL);
+    os = FcObjectSetBuild (FC_FILE, FC_INDEX, FC_FAMILY, FC_WEIGHT, FC_SLANT,
+                           NULL);
 
     g_mutex_lock (&self->font_list_mutex);
 
@@ -373,8 +414,7 @@ schedule_update_font_list (FontViewModel *self)
     if (self->font_list_idle_id != 0)
         return;
 
-    self->font_list_idle_id =
-        g_idle_add (ensure_font_list_idle, self);
+    self->font_list_idle_id = g_idle_add (ensure_font_list_idle, self);
 }
 
 static void
diff --git a/src/font-model.h b/src/font-model.h
index e86d576..6b243b0 100644
--- a/src/font-model.h
+++ b/src/font-model.h
@@ -21,7 +21,7 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
+ */
 
 #ifndef __FONT_VIEW_MODEL_H__
 #define __FONT_VIEW_MODEL_H__
@@ -32,34 +32,32 @@
 G_BEGIN_DECLS
 
 typedef enum {
-  COLUMN_NAME,
-  COLUMN_PATH,
-  COLUMN_FACE_INDEX,
-  COLUMN_ICON,
-  NUM_COLUMNS
+    COLUMN_NAME,
+    COLUMN_PATH,
+    COLUMN_FACE_INDEX,
+    COLUMN_ICON,
+    NUM_COLUMNS
 } FontViewModelColumns;
 
 #define FONT_VIEW_TYPE_MODEL (font_view_model_get_type ())
-G_DECLARE_FINAL_TYPE (FontViewModel, font_view_model,
-                      FONT_VIEW, MODEL,
-                      GObject)
+G_DECLARE_FINAL_TYPE (FontViewModel, font_view_model, FONT_VIEW, MODEL, GObject)
 
-FontViewModel * font_view_model_new (void);
+FontViewModel *font_view_model_new (void);
 
-gboolean font_view_model_has_face (FontViewModel *self,
-                                   FT_Face face);
+gboolean font_view_model_has_face (FontViewModel *self, FT_Face face);
 GListModel *font_view_model_get_list_model (FontViewModel *self);
 
 #define FONT_VIEW_TYPE_MODEL_ITEM (font_view_model_item_get_type ())
-G_DECLARE_FINAL_TYPE (FontViewModelItem, font_view_model_item,
-                      FONT_VIEW, MODEL_ITEM,
-                      GObject)
+G_DECLARE_FINAL_TYPE (
+    FontViewModelItem, font_view_model_item, FONT_VIEW, MODEL_ITEM, GObject)
 
 gint font_view_model_item_get_face_index (FontViewModelItem *self);
 GFile *font_view_model_item_get_font_file (FontViewModelItem *self);
 const gchar *font_view_model_item_get_font_name (FontViewModelItem *self);
-const gchar *font_view_model_item_get_font_preview_text (FontViewModelItem *self);
-const PangoFontDescription *font_view_model_item_get_font_description (FontViewModelItem *self);
+const gchar *
+font_view_model_item_get_font_preview_text (FontViewModelItem *self);
+const PangoFontDescription *
+font_view_model_item_get_font_description (FontViewModelItem *self);
 
 G_END_DECLS
 
diff --git a/src/font-view.c b/src/font-view.c
index 224631b..706bc51 100644
--- a/src/font-view.c
+++ b/src/font-view.c
@@ -30,14 +30,14 @@
 #include FT_TRUETYPE_IDS_H
 #include FT_MULTIPLE_MASTERS_H
 #include <fontconfig/fontconfig.h>
-#include <gio/gio.h>
-#include <gtk/gtk.h>
 #include <gdk/gdk.h>
+#include <gio/gio.h>
 #include <glib/gi18n.h>
-#include <libadwaita-1/adwaita.h>
-#include <hb.h>
-#include <hb-ot.h>
+#include <gtk/gtk.h>
 #include <hb-ft.h>
+#include <hb-ot.h>
+#include <hb.h>
+#include <libadwaita-1/adwaita.h>
 
 #define GNOME_DESKTOP_USE_UNSTABLE_API
 #include <libgnome-desktop/gnome-desktop-thumbnail.h>
@@ -48,8 +48,10 @@
 #define FONT_VIEW_TYPE_APPLICATION (font_view_application_get_type ())
 #define FONT_VIEW_ICON_NAME APPLICATION_ID
 
-G_DECLARE_FINAL_TYPE (FontViewApplication, font_view_application,
-                      FONT_VIEW, APPLICATION,
+G_DECLARE_FINAL_TYPE (FontViewApplication,
+                      font_view_application,
+                      FONT_VIEW,
+                      APPLICATION,
                       GtkApplication)
 
 struct _FontViewApplication {
@@ -74,8 +76,8 @@ struct _FontViewApplication {
     GtkWidget *search_toggle;
     GtkWidget *menu_button;
 
-    GtkFilter* filter;
-    GtkSorter* sorter;
+    GtkFilter *filter;
+    GtkSorter *sorter;
 
     FontViewModel *model;
 
@@ -84,12 +86,12 @@ struct _FontViewApplication {
     GCancellable *cancellable;
 };
 
-G_DEFINE_TYPE (FontViewApplication, font_view_application,
+G_DEFINE_TYPE (FontViewApplication,
+               font_view_application,
                GTK_TYPE_APPLICATION);
 
-G_DECLARE_FINAL_TYPE (FontViewItem, font_view_item,
-                      FONT_VIEW, ITEM,
-                      GtkFlowBoxChild);
+G_DECLARE_FINAL_TYPE (
+    FontViewItem, font_view_item, FONT_VIEW, ITEM, GtkFlowBoxChild);
 
 struct _FontViewItem {
     GtkFlowBoxChild parent;
@@ -101,7 +103,8 @@ struct _FontViewItem {
 };
 
 #define FONT_VIEW_TYPE_ITEM (font_view_item_get_type ())
-// TODO: Perhaps this should be a GtkWidget with a layout, but this was easier to map for now.
+// TODO: Perhaps this should be a GtkWidget with a layout, but this was easier
+// to map for now.
 G_DEFINE_TYPE (FontViewItem, font_view_item, GTK_TYPE_BOX)
 
 static void
@@ -125,32 +128,32 @@ font_view_item_class_init (FontViewItemClass *klass)
 static void
 font_view_item_init (FontViewItem *self)
 {
-    gtk_orientable_set_orientation(GTK_ORIENTABLE(self), GTK_ORIENTATION_VERTICAL);
-    gtk_box_set_spacing(GTK_BOX(self), 6);
+    gtk_orientable_set_orientation (GTK_ORIENTABLE (self),
+                                    GTK_ORIENTATION_VERTICAL);
+    gtk_box_set_spacing (GTK_BOX (self), 6);
 
-    self->font_preview = gtk_label_new(NULL);
-    gtk_widget_add_css_class(self->font_preview, "font-preview");
+    self->font_preview = gtk_label_new (NULL);
+    gtk_widget_add_css_class (self->font_preview, "font-preview");
     gtk_widget_set_margin_start (self->font_preview, 6);
     gtk_widget_set_margin_end (self->font_preview, 6);
     gtk_widget_set_halign (self->font_preview, GTK_ALIGN_CENTER);
-    gtk_box_append (GTK_BOX(self), self->font_preview);
+    gtk_box_append (GTK_BOX (self), self->font_preview);
 
     self->label = gtk_label_new (NULL);
     gtk_widget_set_halign (self->label, GTK_ALIGN_CENTER);
     // TODO: Adapt to GTK4
-    //gtk_label_set_line_wrap (GTK_LABEL (self->label), TRUE);
-    //gtk_label_set_line_wrap_mode (GTK_LABEL (self->label), PANGO_WRAP_WORD_CHAR);
+    // gtk_label_set_line_wrap (GTK_LABEL (self->label), TRUE);
+    // gtk_label_set_line_wrap_mode (GTK_LABEL (self->label),
+    // PANGO_WRAP_WORD_CHAR);
     gtk_label_set_max_width_chars (GTK_LABEL (self->label), 18);
     gtk_label_set_justify (GTK_LABEL (self->label), GTK_JUSTIFY_CENTER);
-    gtk_box_append (GTK_BOX(self), self->label);
+    gtk_box_append (GTK_BOX (self), self->label);
 }
 
-#define ATTRIBUTES_FOR_CREATING_THUMBNAIL \
-    G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE"," \
-    G_FILE_ATTRIBUTE_TIME_MODIFIED
-#define ATTRIBUTES_FOR_EXISTING_THUMBNAIL \
-    G_FILE_ATTRIBUTE_THUMBNAIL_PATH"," \
-    G_FILE_ATTRIBUTE_THUMBNAILING_FAILED
+#define ATTRIBUTES_FOR_CREATING_THUMBNAIL                                      \
+    G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "," G_FILE_ATTRIBUTE_TIME_MODIFIED
+#define ATTRIBUTES_FOR_EXISTING_THUMBNAIL                                      \
+    G_FILE_ATTRIBUTE_THUMBNAIL_PATH "," G_FILE_ATTRIBUTE_THUMBNAILING_FAILED
 
 static GtkWidget *
 font_view_item_new ()
@@ -160,24 +163,27 @@ font_view_item_new ()
     return GTK_WIDGET (view_item);
 }
 
-static void font_view_item_bind(FontViewItem *self, FontViewModelItem *item)
+static void
+font_view_item_bind (FontViewItem *self, FontViewModelItem *item)
 {
     gtk_label_set_text (GTK_LABEL (self->label),
                         font_view_model_item_get_font_name (item));
     gtk_label_set_text (GTK_LABEL (self->font_preview),
-                        font_view_model_item_get_font_preview_text(item));
-    
-    PangoAttrList* list = pango_attr_list_new();              
-    PangoAttribute* attr = pango_attr_font_desc_new(font_view_model_item_get_font_description(item));
-    pango_attr_list_insert(list, attr);
-    gtk_label_set_attributes(GTK_LABEL (self->font_preview),list);                
+                        font_view_model_item_get_font_preview_text (item));
+
+    PangoAttrList *list = pango_attr_list_new ();
+    PangoAttribute *attr = pango_attr_font_desc_new (
+        font_view_model_item_get_font_description (item));
+    pango_attr_list_insert (list, attr);
+    gtk_label_set_attributes (GTK_LABEL (self->font_preview), list);
 }
 
-static void font_view_item_unbind(FontViewItem *self)
+static void
+font_view_item_unbind (FontViewItem *self)
 {
     gtk_label_set_text (GTK_LABEL (self->label), NULL);
-    gtk_label_set_text(GTK_LABEL(self->font_preview), NULL);
-    gtk_label_set_attributes(GTK_LABEL(self->font_preview), NULL);
+    gtk_label_set_text (GTK_LABEL (self->font_preview), NULL);
+    gtk_label_set_attributes (GTK_LABEL (self->font_preview), NULL);
 
     g_cancellable_cancel (self->thumbnail_cancellable);
     g_clear_object (&self->thumbnail_cancellable);
@@ -195,25 +201,23 @@ _print_version_and_exit (const gchar *option_name,
                          gpointer data,
                          GError **error)
 {
-    g_print("%s %s\n", _("GNOME Fonts"), VERSION);
+    g_print ("%s %s\n", _ ("GNOME Fonts"), VERSION);
     exit (EXIT_SUCCESS);
     return TRUE;
 }
 
-static const GOptionEntry goption_options[] =
-{
-    { "version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
-      _print_version_and_exit, N_("Show the application's version"), NULL},
-    { NULL }
-};
+static const GOptionEntry goption_options[] = {
+    {"version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
+     _print_version_and_exit, N_ ("Show the application's version"), NULL},
+    {NULL}};
 
 #define WHITESPACE_CHARS "\f \t"
 
 static void
 strip_whitespace (gchar **original)
 {
-    g_auto(GStrv) split = NULL;
-    g_autoptr(GString) reassembled = NULL;
+    g_auto (GStrv) split = NULL;
+    g_autoptr (GString) reassembled = NULL;
     const gchar *str;
     gint idx, n_stripped;
     size_t len;
@@ -271,18 +275,19 @@ add_row (GtkBox *list,
     GtkWidget *name_w, *label;
     int i;
     const char *p;
-    GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
+    GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
     name_w = gtk_label_new (name);
-    gtk_style_context_add_class (gtk_widget_get_style_context (name_w), "dim-label");
+    gtk_style_context_add_class (gtk_widget_get_style_context (name_w),
+                                 "dim-label");
     gtk_widget_set_halign (name_w, GTK_ALIGN_END);
     gtk_widget_set_valign (name_w, GTK_ALIGN_START);
 
-    gtk_box_append(GTK_BOX(hbox), name_w);
+    gtk_box_append (GTK_BOX (hbox), name_w);
 
     label = gtk_label_new (value);
     gtk_widget_set_halign (label, GTK_ALIGN_START);
     gtk_widget_set_valign (label, GTK_ALIGN_START);
-    gtk_label_set_selectable (GTK_LABEL(label), TRUE);
+    gtk_label_set_selectable (GTK_LABEL (label), TRUE);
 
     gtk_label_set_xalign (GTK_LABEL (label), 0.0);
 
@@ -305,29 +310,27 @@ add_row (GtkBox *list,
         }
     }
 
-    gtk_box_append(GTK_BOX(hbox), label);
-    gtk_box_append(list, hbox);
+    gtk_box_append (GTK_BOX (hbox), label);
+    gtk_box_append (list, hbox);
 }
 
-#define FixedToFloat(f) (((float)(f))/65536.0)
+#define FixedToFloat(f) (((float) (f)) / 65536.0)
 
 static char *
 describe_axis (FT_Var_Axis *ax)
 {
-  /* Translators, this string is used to display information about
-   * a 'font variation axis'. The %s gets replaced with the name
-   * of the axis, for example 'Width'. The three %g get replaced
-   * with the minimum, maximum and default values for the axis.
-   */
-  return g_strdup_printf (_("%s %g — %g, default %g"), ax->name,
-                          FixedToFloat (ax->minimum),
-                          FixedToFloat (ax->maximum),
-                          FixedToFloat (ax->def));
+    /* Translators, this string is used to display information about
+     * a 'font variation axis'. The %s gets replaced with the name
+     * of the axis, for example 'Width'. The three %g get replaced
+     * with the minimum, maximum and default values for the axis.
+     */
+    return g_strdup_printf (_ ("%s %g — %g, default %g"), ax->name,
+                            FixedToFloat (ax->minimum),
+                            FixedToFloat (ax->maximum), FixedToFloat (ax->def));
 }
 
 static char *
-get_sfnt_name (FT_Face face,
-               guint id)
+get_sfnt_name (FT_Face face, guint id)
 {
     guint count, i;
 
@@ -343,12 +346,12 @@ get_sfnt_name (FT_Face face,
 
         /* only handle the unicode names for US langid */
         if (!(sname.platform_id == TT_PLATFORM_MICROSOFT &&
-            sname.encoding_id == TT_MS_ID_UNICODE_CS &&
-            sname.language_id == TT_MS_LANGID_ENGLISH_UNITED_STATES))
+              sname.encoding_id == TT_MS_ID_UNICODE_CS &&
+              sname.language_id == TT_MS_LANGID_ENGLISH_UNITED_STATES))
             continue;
 
-        return g_convert ((gchar *)sname.string, sname.string_len,
-                          "UTF-8", "UTF-16BE", NULL, NULL, NULL);
+        return g_convert ((gchar *) sname.string, sname.string_len, "UTF-8",
+                          "UTF-16BE", NULL, NULL, NULL);
     }
     return NULL;
 }
@@ -360,14 +363,11 @@ get_sfnt_name (FT_Face face,
 static gboolean
 is_valid_subfamily_id (guint id)
 {
-  return id == 2 || id == 17 || (255 < id && id < 32768);
+    return id == 2 || id == 17 || (255 < id && id < 32768);
 }
 
 static void
-describe_instance (FT_Face face,
-                   FT_Var_Named_Style *ns,
-                   int pos,
-                   GString *s)
+describe_instance (FT_Face face, FT_Var_Named_Style *ns, int pos, GString *s)
 {
     g_autofree char *str = NULL;
 
@@ -375,7 +375,7 @@ describe_instance (FT_Face face,
         str = get_sfnt_name (face, ns->strid);
 
     if (str == NULL)
-        str = g_strdup_printf (_("Instance %d"), pos);
+        str = g_strdup_printf (_ ("Instance %d"), pos);
 
     if (s->len > 0)
         g_string_append (s, ", ");
@@ -387,7 +387,7 @@ describe_instance (FT_Face face,
 static char *
 get_features (FT_Face face)
 {
-    g_autoptr(GString) s = NULL;
+    g_autoptr (GString) s = NULL;
     hb_font_t *hb_font;
     int i, j, k;
 
@@ -395,7 +395,7 @@ get_features (FT_Face face)
 
     hb_font = hb_ft_font_create (face, NULL);
     if (hb_font) {
-        hb_tag_t tables[2] = { HB_OT_TAG_GSUB, HB_OT_TAG_GPOS };
+        hb_tag_t tables[2] = {HB_OT_TAG_GSUB, HB_OT_TAG_GPOS};
         hb_face_t *hb_face;
 
         hb_face = hb_font_get_face (hb_font);
@@ -406,20 +406,20 @@ get_features (FT_Face face)
             unsigned int script_index = 0;
             unsigned int lang_index = HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX;
 
-            hb_ot_layout_language_get_feature_tags (hb_face,
-                                                    tables[i],
-                                                    script_index,
-                                                    lang_index,
-                                                    0,
-                                                    &count,
-                                                    features);
+            hb_ot_layout_language_get_feature_tags (hb_face, tables[i],
+                                                    script_index, lang_index, 0,
+                                                    &count, features);
             for (j = 0; j < count; j++) {
                 for (k = 0; k < G_N_ELEMENTS (open_type_layout_features); k++) {
                     if (open_type_layout_features[k].tag == features[j]) {
                         if (s->len > 0)
-                            /* Translators, this seperates the list of Layout Features. */
-                            g_string_append (s, C_("OpenType layout", ", "));
-                        g_string_append (s, g_dpgettext2 (NULL, "OpenType layout", 
open_type_layout_features[k].name));
+                            /* Translators, this seperates the list of Layout
+                             * Features. */
+                            g_string_append (s, C_ ("OpenType layout", ", "));
+                        g_string_append (
+                            s,
+                            g_dpgettext2 (NULL, "OpenType layout",
+                                          open_type_layout_features[k].name));
                         break;
                     }
                 }
@@ -434,37 +434,37 @@ get_features (FT_Face face)
 }
 
 static void
-populate_grid (FontViewApplication *self,
-               GtkBox *grid,
-               FT_Face face)
+populate_grid (FontViewApplication *self, GtkBox *grid, FT_Face face)
 {
     g_autoptr (GFileInfo) info = NULL;
     g_autofree gchar *path = NULL;
     PS_FontInfoRec ps_info;
 
-    add_row (grid, _("Name"), face->family_name, FALSE);
+    add_row (grid, _ ("Name"), face->family_name, FALSE);
 
     path = g_file_get_path (self->font_file);
-    add_row (grid, _("Location"), path, FALSE);
+    add_row (grid, _ ("Location"), path, FALSE);
 
     if (face->style_name)
-        add_row (grid, _("Style"), face->style_name, FALSE);
+        add_row (grid, _ ("Style"), face->style_name, FALSE);
 
     info = g_file_query_info (self->font_file,
-                              G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
-                              G_FILE_ATTRIBUTE_STANDARD_SIZE,
-                              G_FILE_QUERY_INFO_NONE,
-                              NULL, NULL);
+                              G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE
+                              "," G_FILE_ATTRIBUTE_STANDARD_SIZE,
+                              G_FILE_QUERY_INFO_NONE, NULL, NULL);
 
     if (info != NULL) {
-        g_autofree gchar *s = g_content_type_get_description (g_file_info_get_content_type (info));
-        add_row (grid, _("Type"), s, FALSE);
+        g_autofree gchar *s = g_content_type_get_description (
+            g_file_info_get_content_type (info));
+        add_row (grid, _ ("Type"), s, FALSE);
     }
 
     if (FT_IS_SFNT (face)) {
         gint i, len;
-        g_autofree gchar *version = NULL, *copyright = NULL, *description = NULL;
-        g_autofree gchar *designer = NULL, *manufacturer = NULL, *license = NULL;
+        g_autofree gchar *version = NULL, *copyright = NULL,
+                         *description = NULL;
+        g_autofree gchar *designer = NULL, *manufacturer = NULL,
+                         *license = NULL;
 
         len = FT_Get_Sfnt_Name_Count (face);
         for (i = 0; i < len; i++) {
@@ -482,33 +482,39 @@ populate_grid (FontViewApplication *self,
             switch (sname.name_id) {
             case TT_NAME_ID_COPYRIGHT:
                 if (!copyright)
-                    copyright = g_convert ((gchar *)sname.string, sname.string_len,
-                                           "UTF-8", "UTF-16BE", NULL, NULL, NULL);
+                    copyright =
+                        g_convert ((gchar *) sname.string, sname.string_len,
+                                   "UTF-8", "UTF-16BE", NULL, NULL, NULL);
                 break;
             case TT_NAME_ID_VERSION_STRING:
                 if (!version)
-                    version = g_convert ((gchar *)sname.string, sname.string_len,
-                                         "UTF-8", "UTF-16BE", NULL, NULL, NULL);
+                    version =
+                        g_convert ((gchar *) sname.string, sname.string_len,
+                                   "UTF-8", "UTF-16BE", NULL, NULL, NULL);
                 break;
             case TT_NAME_ID_DESCRIPTION:
                 if (!description)
-                    description = g_convert ((gchar *)sname.string, sname.string_len,
-                                             "UTF-8", "UTF-16BE", NULL, NULL, NULL);
+                    description =
+                        g_convert ((gchar *) sname.string, sname.string_len,
+                                   "UTF-8", "UTF-16BE", NULL, NULL, NULL);
                 break;
             case TT_NAME_ID_MANUFACTURER:
                 if (!manufacturer)
-                    manufacturer = g_convert ((gchar *)sname.string, sname.string_len,
-                                              "UTF-8", "UTF-16BE", NULL, NULL, NULL);
+                    manufacturer =
+                        g_convert ((gchar *) sname.string, sname.string_len,
+                                   "UTF-8", "UTF-16BE", NULL, NULL, NULL);
                 break;
             case TT_NAME_ID_DESIGNER:
                 if (!designer)
-                    designer = g_convert ((gchar *)sname.string, sname.string_len,
-                                          "UTF-8", "UTF-16BE", NULL, NULL, NULL);
+                    designer =
+                        g_convert ((gchar *) sname.string, sname.string_len,
+                                   "UTF-8", "UTF-16BE", NULL, NULL, NULL);
                 break;
             case TT_NAME_ID_LICENSE:
                 if (!license)
-                    license = g_convert ((gchar *)sname.string, sname.string_len,
-                                         "UTF-8", "UTF-16BE", NULL, NULL, NULL);
+                    license =
+                        g_convert ((gchar *) sname.string, sname.string_len,
+                                   "UTF-8", "UTF-16BE", NULL, NULL, NULL);
                 break;
             default:
                 break;
@@ -516,172 +522,184 @@ populate_grid (FontViewApplication *self,
         }
         if (version) {
             strip_version (&version);
-            add_row (grid, _("Version"), version, FALSE);
+            add_row (grid, _ ("Version"), version, FALSE);
         }
         if (copyright) {
             strip_whitespace (&copyright);
-            add_row (grid, _("Copyright"), copyright, TRUE);
+            add_row (grid, _ ("Copyright"), copyright, TRUE);
         }
         if (description) {
             strip_whitespace (&description);
-            add_row (grid, _("Description"), description, TRUE);
+            add_row (grid, _ ("Description"), description, TRUE);
         }
         if (manufacturer) {
             strip_whitespace (&manufacturer);
-            add_row (grid, _("Manufacturer"), manufacturer, TRUE);
+            add_row (grid, _ ("Manufacturer"), manufacturer, TRUE);
         }
         if (designer) {
             strip_whitespace (&designer);
-            add_row (grid, _("Designer"), designer, TRUE);
+            add_row (grid, _ ("Designer"), designer, TRUE);
         }
         if (license) {
             strip_whitespace (&license);
-            add_row (grid, _("License"), license, TRUE);
+            add_row (grid, _ ("License"), license, TRUE);
         }
     } else if (FT_Get_PS_Font_Info (face, &ps_info) == 0) {
         if (ps_info.version && g_utf8_validate (ps_info.version, -1, NULL)) {
             g_autofree gchar *compressed = g_strcompress (ps_info.version);
             strip_version (&compressed);
-            add_row (grid, _("Version"), compressed, FALSE);
+            add_row (grid, _ ("Version"), compressed, FALSE);
         }
         if (ps_info.notice && g_utf8_validate (ps_info.notice, -1, NULL)) {
             g_autofree gchar *compressed = g_strcompress (ps_info.notice);
             strip_whitespace (&compressed);
-            add_row (grid, _("Copyright"), compressed, TRUE);
+            add_row (grid, _ ("Copyright"), compressed, TRUE);
         }
     }
 }
 
 static void
-populate_details (FontViewApplication *self,
-                  GtkBox *grid,
-                  FT_Face face)
+populate_details (FontViewApplication *self, GtkBox *grid, FT_Face face)
 {
     g_autofree gchar *glyph_count = NULL, *features = NULL;
     FT_MM_Var *ft_mm_var;
 
     glyph_count = g_strdup_printf ("%ld", face->num_glyphs);
-    add_row (grid, _("Glyph Count"), glyph_count, FALSE);
+    add_row (grid, _ ("Glyph Count"), glyph_count, FALSE);
 
-    add_row (grid, _("Color Glyphs"), FT_HAS_COLOR (face) ? _("yes") : _("no"), FALSE);
+    add_row (grid, _ ("Color Glyphs"),
+             FT_HAS_COLOR (face) ? _ ("yes") : _ ("no"), FALSE);
 
     features = get_features (face);
     if (features)
-        add_row (grid, _("Layout Features"), features, TRUE);
+        add_row (grid, _ ("Layout Features"), features, TRUE);
 
     if (FT_Get_MM_Var (face, &ft_mm_var) == 0) {
         int i;
         for (i = 0; i < ft_mm_var->num_axis; i++) {
             g_autofree gchar *s = describe_axis (&ft_mm_var->axis[i]);
-            add_row (grid, i == 0 ? _("Variation Axes") : "", s, FALSE);
+            add_row (grid, i == 0 ? _ ("Variation Axes") : "", s, FALSE);
         }
         {
-            g_autoptr(GString) str = g_string_new ("");
+            g_autoptr (GString) str = g_string_new ("");
             for (i = 0; i < ft_mm_var->num_namedstyles; i++)
                 describe_instance (face, &ft_mm_var->namedstyle[i], i, str);
 
-            add_row (grid, _("Named Styles"), str->str, TRUE);
+            add_row (grid, _ ("Named Styles"), str->str, TRUE);
         }
         free (ft_mm_var);
     }
 }
 
 static void
-install_button_refresh_appearance (FontViewApplication *self,
-                                   GError *error)
+install_button_refresh_appearance (FontViewApplication *self, GError *error)
 {
     FT_Face face;
     GtkStyleContext *context;
 
-    context = gtk_widget_get_style_context ((GtkWidget*) self->install_button);
+    context = gtk_widget_get_style_context (GTK_WIDGET (self->install_button));
 
     if (error != NULL) {
-        gtk_button_set_label(self->install_button, _("Failed"));
-        gtk_widget_set_sensitive ((GtkWidget*) self->install_button, FALSE);
+        gtk_button_set_label (self->install_button, _ ("Failed"));
+        gtk_widget_set_sensitive (GTK_WIDGET (self->install_button), FALSE);
         gtk_style_context_remove_class (context, "suggested-action");
     } else {
-        face = sushi_font_widget_get_ft_face (SUSHI_FONT_WIDGET (self->font_widget));
+        face = sushi_font_widget_get_ft_face (
+            SUSHI_FONT_WIDGET (self->font_widget));
 
         if (font_view_model_has_face (FONT_VIEW_MODEL (self->model), face)) {
-            gtk_button_set_label(self->install_button, _("Installed"));
-            gtk_widget_set_sensitive ((GtkWidget*) self->install_button, FALSE);
+            gtk_button_set_label (self->install_button, _ ("Installed"));
+            gtk_widget_set_sensitive (GTK_WIDGET (self->install_button), FALSE);
             gtk_style_context_remove_class (context, "suggested-action");
         } else if (self->cancellable != NULL) {
-            gtk_button_set_label(self->install_button, _("Installing"));
-            gtk_widget_set_sensitive ((GtkWidget*) self->install_button, FALSE);
+            gtk_button_set_label (self->install_button, _ ("Installing"));
+            gtk_widget_set_sensitive (GTK_WIDGET (self->install_button), FALSE);
         } else {
-            gtk_button_set_label(self->install_button, _("Install"));
-            gtk_widget_set_sensitive ((GtkWidget*) self->install_button, TRUE);
+            gtk_button_set_label (self->install_button, _ ("Install"));
+            gtk_widget_set_sensitive (GTK_WIDGET (self->install_button), TRUE);
             gtk_style_context_add_class (context, "suggested-action");
         }
     }
 }
 
-static char* font_name_closure(gpointer self) {
-    FontViewModelItem* item = FONT_VIEW_MODEL_ITEM(self);
+static char *
+font_name_closure (gpointer self)
+{
+    FontViewModelItem *item = FONT_VIEW_MODEL_ITEM (self);
 
-    return g_strdup(font_view_model_item_get_font_name(item));
+    return g_strdup (font_view_model_item_get_font_name (item));
 }
 
 static void
-font_item_setup(GtkSignalListItemFactory *self,
-               GtkListItem              *listitem,
-               gpointer                  user_data) {
-                   gtk_list_item_set_activatable(listitem, true);
-   gtk_list_item_set_child(listitem, font_view_item_new());
+font_item_setup (GtkSignalListItemFactory *self,
+                 GtkListItem *listitem,
+                 gpointer user_data)
+{
+    gtk_list_item_set_activatable (listitem, true);
+    gtk_list_item_set_child (listitem, font_view_item_new ());
 }
 
 static void
-font_item_bind(GtkSignalListItemFactory *self,
-               GtkListItem              *listitem,
-               gpointer                  user_data) {
-    FontViewModelItem* model_item = gtk_list_item_get_item(listitem);
-    FontViewItem* item = FONT_VIEW_ITEM(gtk_list_item_get_child(listitem));
-    font_view_item_bind(item, model_item);
+font_item_bind (GtkSignalListItemFactory *self,
+                GtkListItem *listitem,
+                gpointer user_data)
+{
+    FontViewModelItem *model_item = gtk_list_item_get_item (listitem);
+    FontViewItem *item = FONT_VIEW_ITEM (gtk_list_item_get_child (listitem));
+    font_view_item_bind (item, model_item);
 }
 
 static void
-font_item_unbind(GtkSignalListItemFactory *self,
-               GtkListItem              *listitem,
-               gpointer                  user_data) {
-    FontViewItem* item = FONT_VIEW_ITEM(gtk_list_item_get_child(listitem));
-    font_view_item_unbind(item);
+font_item_unbind (GtkSignalListItemFactory *self,
+                  GtkListItem *listitem,
+                  gpointer user_data)
+{
+    FontViewItem *item = FONT_VIEW_ITEM (gtk_list_item_get_child (listitem));
+    font_view_item_unbind (item);
 }
 
 static void
-font_item_teardown(GtkSignalListItemFactory *self,
-               GtkListItem              *listitem,
-               gpointer                  user_data) {
+font_item_teardown (GtkSignalListItemFactory *self,
+                    GtkListItem *listitem,
+                    gpointer user_data)
+{
 }
 
 static void
 font_view_create_grid_view (FontViewApplication *self)
 {
-    
+
     GListModel *list_model = font_view_model_get_list_model (self->model);
-    GtkFilter* filter = GTK_FILTER(
-        gtk_string_filter_new(
-            gtk_closure_expression_new(G_TYPE_STRING, 
-                g_cclosure_new(G_CALLBACK(font_name_closure), NULL, NULL), 0, NULL)));
+    GtkFilter *filter =
+        GTK_FILTER (gtk_string_filter_new (gtk_closure_expression_new (
+            G_TYPE_STRING,
+            g_cclosure_new (G_CALLBACK (font_name_closure), NULL, NULL), 0,
+            NULL)));
     self->filter = filter;
-    GtkSorter* sorter = GTK_SORTER(
-        gtk_string_sorter_new(
-            gtk_closure_expression_new(G_TYPE_STRING, 
-                g_cclosure_new(G_CALLBACK(font_name_closure), NULL, NULL), 0, NULL)));
+    GtkSorter *sorter =
+        GTK_SORTER (gtk_string_sorter_new (gtk_closure_expression_new (
+            G_TYPE_STRING,
+            g_cclosure_new (G_CALLBACK (font_name_closure), NULL, NULL), 0,
+            NULL)));
     self->sorter = sorter;
 
-    GtkSortListModel* sort_model = gtk_sort_list_model_new(list_model, sorter);
-    GtkFilterListModel* filter_model = gtk_filter_list_model_new(G_LIST_MODEL(sort_model), filter);
-    GtkListItemFactory* factory = gtk_signal_list_item_factory_new();
-    
-    g_signal_connect(factory, "setup",  G_CALLBACK(font_item_setup), NULL);
-    g_signal_connect(factory, "bind",  G_CALLBACK(font_item_bind), NULL);
-    g_signal_connect(factory, "unbind",  G_CALLBACK(font_item_unbind), NULL);
-    g_signal_connect(factory, "teardown", G_CALLBACK(font_item_teardown), NULL);
-    
-    GtkNoSelection* selection = gtk_no_selection_new (G_LIST_MODEL(filter_model));
-    self->grid_view = gtk_grid_view_new(GTK_SELECTION_MODEL(selection), factory);
-    gtk_grid_view_set_single_click_activate(GTK_GRID_VIEW(self->grid_view), true);
+    GtkSortListModel *sort_model = gtk_sort_list_model_new (list_model, sorter);
+    GtkFilterListModel *filter_model =
+        gtk_filter_list_model_new (G_LIST_MODEL (sort_model), filter);
+    GtkListItemFactory *factory = gtk_signal_list_item_factory_new ();
+
+    g_signal_connect (factory, "setup", G_CALLBACK (font_item_setup), NULL);
+    g_signal_connect (factory, "bind", G_CALLBACK (font_item_bind), NULL);
+    g_signal_connect (factory, "unbind", G_CALLBACK (font_item_unbind), NULL);
+    g_signal_connect (factory, "teardown", G_CALLBACK (font_item_teardown),
+                      NULL);
+
+    GtkNoSelection *selection =
+        gtk_no_selection_new (G_LIST_MODEL (filter_model));
+    self->grid_view =
+        gtk_grid_view_new (GTK_SELECTION_MODEL (selection), factory);
+    gtk_grid_view_set_single_click_activate (GTK_GRID_VIEW (self->grid_view),
+                                             true);
 }
 
 static void
@@ -705,32 +723,30 @@ font_view_show_error (FontViewApplication *self,
     GtkWidget *dialog;
 
     dialog = gtk_message_dialog_new (GTK_WINDOW (self->main_window),
-                                     GTK_DIALOG_MODAL,
-                                     GTK_MESSAGE_ERROR,
-                                     GTK_BUTTONS_CLOSE,
-                                     "%s",
-                                     primary_text);
-    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                                              "%s", secondary_text);
-    g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_unparent), NULL);
+                                     GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
+                                     GTK_BUTTONS_CLOSE, "%s", primary_text);
+    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s",
+                                              secondary_text);
+    g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_unparent),
+                      NULL);
     gtk_widget_show (dialog);
 }
 
 static void
-font_view_show_install_error (FontViewApplication *self,
-                              GError *error)
+font_view_show_install_error (FontViewApplication *self, GError *error)
 {
     install_button_refresh_appearance (self, error);
-    font_view_show_error (self, _("This font could not be installed."), error->message);
+    font_view_show_error (self, _ ("This font could not be installed."),
+                          error->message);
 }
 
 static void
-font_install_finished (GObject      *source_object,
+font_install_finished (GObject *source_object,
                        GAsyncResult *res,
-                       gpointer      user_data)
+                       gpointer user_data)
 {
     FontViewApplication *self = user_data;
-    g_autoptr(GError) err = NULL;
+    g_autoptr (GError) err = NULL;
 
     g_task_propagate_boolean (G_TASK (res), &err);
 
@@ -749,21 +765,19 @@ install_font_job (GTask *task,
     GFile *dest_location = user_data;
     FontViewApplication *self = FONT_VIEW_APPLICATION (source_object);
     g_autofree gchar *dest_basename = g_file_get_basename (self->font_file);
-    g_autoptr(GError) error = NULL;
+    g_autoptr (GError) error = NULL;
     gboolean created = FALSE;
     gint i = 0;
 
     while (!created) {
-        g_autofree gchar *dest_filename = (i == 0) ?
-            g_strdup (dest_basename) : g_strdup_printf ("%d%s", i, dest_basename);
-        g_autoptr(GFile) dest_file = g_file_get_child (dest_location, dest_filename);
+        g_autofree gchar *dest_filename =
+            (i == 0) ? g_strdup (dest_basename)
+                     : g_strdup_printf ("%d%s", i, dest_basename);
+        g_autoptr (GFile) dest_file =
+            g_file_get_child (dest_location, dest_filename);
 
-        created = g_file_copy (self->font_file,
-                               dest_file,
-                               G_FILE_COPY_NONE,
-                               cancellable,
-                               NULL, NULL,
-                               &error);
+        created = g_file_copy (self->font_file, dest_file, G_FILE_COPY_NONE,
+                               cancellable, NULL, NULL, &error);
 
         if (error != NULL) {
             if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
@@ -782,10 +796,9 @@ install_font_job (GTask *task,
 }
 
 static void
-font_view_install_font (FontViewApplication *self,
-                        GFile *dest_location)
+font_view_install_font (FontViewApplication *self, GFile *dest_location)
 {
-    g_autoptr(GTask) task = NULL;
+    g_autoptr (GTask) task = NULL;
 
     self->cancellable = g_cancellable_new ();
 
@@ -795,13 +808,13 @@ font_view_install_font (FontViewApplication *self,
 }
 
 static void
-install_button_clicked_cb (GtkButton *button,
-                           gpointer user_data)
+install_button_clicked_cb (GtkButton *button, gpointer user_data)
 {
     FontViewApplication *self = user_data;
-    g_autoptr(GError) err = NULL;
-    g_autoptr(GFile) home_prefix = NULL, xdg_prefix = NULL;
-    g_autoptr(GFile) xdg_location = NULL, home_location = NULL, dest_location = NULL;
+    g_autoptr (GError) err = NULL;
+    g_autoptr (GFile) home_prefix = NULL, xdg_prefix = NULL;
+    g_autoptr (GFile) xdg_location = NULL, home_location = NULL,
+                      dest_location = NULL;
     FcConfig *config;
     FcStrList *str_list;
     FcChar8 *path;
@@ -816,15 +829,14 @@ install_button_clicked_cb (GtkButton *button,
      * under the home directory.
      */
     while ((path = FcStrListNext (str_list)) != NULL) {
-        g_autoptr(GFile) file = g_file_new_for_path ((const gchar *) path);
+        g_autoptr (GFile) file = g_file_new_for_path ((const gchar *) path);
 
         if (g_file_has_prefix (file, xdg_prefix)) {
             xdg_location = g_steal_pointer (&file);
             break;
         }
 
-        if ((home_location == NULL) &&
-            g_file_has_prefix (file, home_prefix)) {
+        if ((home_location == NULL) && g_file_has_prefix (file, home_prefix)) {
             home_location = g_steal_pointer (&file);
             break;
         }
@@ -838,7 +850,8 @@ install_button_clicked_cb (GtkButton *button,
         dest_location = g_steal_pointer (&home_location);
 
     if (dest_location == NULL) {
-        g_warning ("Install failed: can't find any configured user font directory.");
+        g_warning (
+            "Install failed: can't find any configured user font directory.");
         return;
     }
 
@@ -856,10 +869,10 @@ install_button_clicked_cb (GtkButton *button,
 }
 
 static void
-font_view_show_font_error (FontViewApplication *self,
-                           GError *error)
+font_view_show_font_error (FontViewApplication *self, GError *error)
 {
-    font_view_show_error (self, _("This font could not be displayed."), error->message);
+    font_view_show_error (self, _ ("This font could not be displayed."),
+                          error->message);
 }
 
 static void
@@ -874,8 +887,7 @@ font_widget_error_cb (SushiFontWidget *font_widget,
 }
 
 static void
-font_widget_loaded_cb (SushiFontWidget *font_widget,
-                       gpointer user_data)
+font_widget_loaded_cb (SushiFontWidget *font_widget, gpointer user_data)
 {
     FontViewApplication *self = user_data;
     FT_Face face = sushi_font_widget_get_ft_face (font_widget);
@@ -888,28 +900,29 @@ font_widget_loaded_cb (SushiFontWidget *font_widget,
     self->font_file = g_file_new_for_uri (uri);
 
     if (face->family_name) {
-        GtkWidget* label = gtk_label_new(face->family_name);
+        GtkWidget *label = gtk_label_new (face->family_name);
         gtk_header_bar_set_title_widget (GTK_HEADER_BAR (self->header), label);
     } else {
         g_autofree gchar *basename = g_file_get_basename (self->font_file);
-        GtkWidget* label = gtk_label_new(basename);
+        GtkWidget *label = gtk_label_new (basename);
         gtk_header_bar_set_title_widget (GTK_HEADER_BAR (self->header), label);
     }
 
-    // gtk_header_bar_set_subtitle (GTK_HEADER_BAR (self->header), face->style_name);
+    // gtk_header_bar_set_subtitle (GTK_HEADER_BAR (self->header),
+    // face->style_name);
 
     install_button_refresh_appearance (self, NULL);
 }
 
 static void
-info_button_clicked_cb (GtkButton *button,
-                        gpointer user_data)
+info_button_clicked_cb (GtkButton *button, gpointer user_data)
 {
     FontViewApplication *self = user_data;
     GtkWidget *grid;
     // TODO:
     // GtkWidget *child;
-    FT_Face face = sushi_font_widget_get_ft_face (SUSHI_FONT_WIDGET (self->font_widget));
+    FT_Face face =
+        sushi_font_widget_get_ft_face (SUSHI_FONT_WIDGET (self->font_widget));
 
     if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) {
         gtk_stack_set_visible_child_name (GTK_STACK (self->stack), "preview");
@@ -920,19 +933,20 @@ info_button_clicked_cb (GtkButton *button,
         return;
 
     // TODO:
-    // child = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (self->swin_info));
-    // if (child)
+    // child = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW
+    // (self->swin_info)); if (child)
     //    gtk_widget_unparent (child);
 
     grid = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
-    gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL);
+    gtk_orientable_set_orientation (GTK_ORIENTABLE (grid),
+                                    GTK_ORIENTATION_VERTICAL);
     g_object_set (grid, "margin-start", 20, NULL);
     g_object_set (grid, "margin-end", 20, NULL);
     g_object_set (grid, "margin-top", 20, NULL);
     g_object_set (grid, "margin-bottom", 20, NULL);
 
-    populate_grid (self, GTK_BOX(grid), face);
-    populate_details (self, GTK_BOX(grid), face);
+    populate_grid (self, GTK_BOX (grid), face);
+    populate_details (self, GTK_BOX (grid), face);
     gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (self->swin_info), grid);
 
     gtk_stack_set_visible_child_name (GTK_STACK (self->stack), "info");
@@ -945,8 +959,9 @@ font_view_ensure_model (FontViewApplication *self)
         return;
 
     self->model = font_view_model_new ();
-    g_signal_connect (font_view_model_get_list_model (self->model), "items-changed",
-                      G_CALLBACK (font_model_items_changed_cb), self);
+    g_signal_connect (font_view_model_get_list_model (self->model),
+                      "items-changed", G_CALLBACK (font_model_items_changed_cb),
+                      self);
 }
 
 static void
@@ -960,25 +975,33 @@ font_view_application_do_open (FontViewApplication *self,
 
     /* add install button */
     if (self->install_button == NULL) {
-        g_autoptr(GtkSizeGroup) install_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
-        self->install_button = GTK_BUTTON(gtk_button_new ());
-        gtk_button_set_label(self->install_button, _("Install"));
-        gtk_widget_set_valign ((GtkWidget*) self->install_button, GTK_ALIGN_CENTER);
-        gtk_style_context_add_class (gtk_widget_get_style_context ((GtkWidget*) self->install_button),
-                                     "text-button");
-        gtk_header_bar_pack_end (GTK_HEADER_BAR (self->header), (GtkWidget*) self->install_button);
+        g_autoptr (GtkSizeGroup) install_size_group =
+            gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+
+        self->install_button = GTK_BUTTON (gtk_button_new ());
+        gtk_button_set_label (self->install_button, _ ("Install"));
+        gtk_widget_set_valign (GTK_WIDGET (self->install_button),
+                               GTK_ALIGN_CENTER);
+        gtk_style_context_add_class (
+            gtk_widget_get_style_context (GTK_WIDGET (self->install_button)),
+            "text-button");
+        gtk_header_bar_pack_end (GTK_HEADER_BAR (self->header),
+                                 GTK_WIDGET (self->install_button));
 
         g_signal_connect (self->install_button, "clicked",
                           G_CALLBACK (install_button_clicked_cb), self);
     }
 
     if (self->info_button == NULL) {
-        self->info_button = GTK_TOGGLE_BUTTON(gtk_toggle_button_new_with_label (_("Info")));
-        gtk_widget_set_valign ((GtkWidget*) self->info_button, GTK_ALIGN_CENTER);
-        gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET(self->info_button)),
-                                     "text-button");
-        gtk_header_bar_pack_end (GTK_HEADER_BAR (self->header), GTK_WIDGET(self->info_button));
+        self->info_button =
+            GTK_TOGGLE_BUTTON (gtk_toggle_button_new_with_label (_ ("Info")));
+        gtk_widget_set_valign (GTK_WIDGET (self->info_button),
+                               GTK_ALIGN_CENTER);
+        gtk_style_context_add_class (
+            gtk_widget_get_style_context (GTK_WIDGET (self->info_button)),
+            "text-button");
+        gtk_header_bar_pack_end (GTK_HEADER_BAR (self->header),
+                                 GTK_WIDGET (self->info_button));
 
         g_signal_connect (self->info_button, "toggled",
                           G_CALLBACK (info_button_clicked_cb), self);
@@ -986,14 +1009,17 @@ font_view_application_do_open (FontViewApplication *self,
 
     if (self->back_button == NULL) {
         self->back_button = gtk_button_new ();
-        gtk_button_set_icon_name (GTK_BUTTON (self->back_button), "go-previous-symbolic");
-        gtk_widget_set_tooltip_text (self->back_button, _("Back"));
+        gtk_button_set_icon_name (GTK_BUTTON (self->back_button),
+                                  "go-previous-symbolic");
+        gtk_widget_set_tooltip_text (self->back_button, _ ("Back"));
         gtk_widget_set_valign (self->back_button, GTK_ALIGN_CENTER);
-        gtk_style_context_add_class (gtk_widget_get_style_context (self->back_button),
-                                     "image-button");
-        gtk_header_bar_pack_start (GTK_HEADER_BAR (self->header), self->back_button);
+        gtk_style_context_add_class (
+            gtk_widget_get_style_context (self->back_button), "image-button");
+        gtk_header_bar_pack_start (GTK_HEADER_BAR (self->header),
+                                   self->back_button);
 
-        gtk_actionable_set_action_name (GTK_ACTIONABLE (self->back_button), "app.back");
+        gtk_actionable_set_action_name (GTK_ACTIONABLE (self->back_button),
+                                        "app.back");
     }
 
     gtk_widget_hide (self->search_toggle);
@@ -1004,18 +1030,23 @@ font_view_application_do_open (FontViewApplication *self,
     if (self->font_widget == NULL) {
         GtkWidget *viewport;
 
-        self->font_widget = GTK_WIDGET (sushi_font_widget_new (uri, face_index));
-        gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (self->swin_preview), self->font_widget);
+        self->font_widget =
+            GTK_WIDGET (sushi_font_widget_new (uri, face_index));
+        gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (self->swin_preview),
+                                       self->font_widget);
         viewport = gtk_widget_get_parent (self->font_widget);
-        gtk_scrollable_set_hscroll_policy (GTK_SCROLLABLE (viewport), GTK_SCROLL_NATURAL);
-        gtk_scrollable_set_vscroll_policy (GTK_SCROLLABLE (viewport), GTK_SCROLL_NATURAL);
+        gtk_scrollable_set_hscroll_policy (GTK_SCROLLABLE (viewport),
+                                           GTK_SCROLL_NATURAL);
+        gtk_scrollable_set_vscroll_policy (GTK_SCROLLABLE (viewport),
+                                           GTK_SCROLL_NATURAL);
 
         g_signal_connect (self->font_widget, "loaded",
                           G_CALLBACK (font_widget_loaded_cb), 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", face_index, NULL);
+        g_object_set (self->font_widget, "uri", uri, "face-index", face_index,
+                      NULL);
         sushi_font_widget_load (SUSHI_FONT_WIDGET (self->font_widget));
     }
 
@@ -1025,12 +1056,13 @@ font_view_application_do_open (FontViewApplication *self,
 
 static void
 view_child_activated_cb (GtkGridView *grid_view,
-                         guint        position,
-                         gpointer     user_data)
+                         guint position,
+                         gpointer user_data)
 {
     FontViewApplication *self = user_data;
-    GtkSelectionModel* model = gtk_grid_view_get_model(grid_view);
-    FontViewModelItem *item = FONT_VIEW_MODEL_ITEM (g_list_model_get_item(G_LIST_MODEL(model), position));
+    GtkSelectionModel *model = gtk_grid_view_get_model (grid_view);
+    FontViewModelItem *item = FONT_VIEW_MODEL_ITEM (
+        g_list_model_get_item (G_LIST_MODEL (model), position));
     GFile *font_file;
     gint face_index;
 
@@ -1049,12 +1081,12 @@ font_view_application_do_overview (FontViewApplication *self)
     g_clear_pointer (&self->back_button, gtk_widget_unparent);
 
     if (self->info_button) {
-        gtk_widget_unparent(GTK_WIDGET(self->info_button));
+        gtk_widget_unparent (GTK_WIDGET (self->info_button));
         self->info_button = NULL;
     }
 
     if (self->install_button) {
-        gtk_widget_unparent (GTK_WIDGET(self->install_button));
+        gtk_widget_unparent (GTK_WIDGET (self->install_button));
         self->install_button = NULL;
     }
 
@@ -1062,41 +1094,39 @@ font_view_application_do_overview (FontViewApplication *self)
     gtk_widget_show (self->menu_button);
 
     font_view_ensure_model (self);
-    GtkWidget* title_label = gtk_label_new(_("All Fonts"));
-    gtk_header_bar_set_title_widget (GTK_HEADER_BAR (self->header), title_label);
+    GtkWidget *title_label = gtk_label_new (_ ("All Fonts"));
+    gtk_header_bar_set_title_widget (GTK_HEADER_BAR (self->header),
+                                     title_label);
     // TODO: GTK4 - Setup subtitle
     // gtk_header_bar_set_subtitle (GTK_HEADER_BAR (self->header), NULL);
 
     if (self->grid_view == NULL) {
         GtkWidget *grid_view;
 
-        font_view_create_grid_view(self);
+        font_view_create_grid_view (self);
         grid_view = self->grid_view;
-        
+
         g_object_set (grid_view,
                       //  "column-spacing", VIEW_COLUMN_SPACING,
                       // TODO: Set all margins
-                      "margin-start", VIEW_MARGIN,
-                      "vexpand", TRUE,
-                      NULL);
+                      "margin-start", VIEW_MARGIN, "vexpand", TRUE, NULL);
 
         // TODO: Activate might not be correct/setup correctly
         g_signal_connect (grid_view, "activate",
                           G_CALLBACK (view_child_activated_cb), self);
-        gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (self->swin_view), grid_view);  
+        gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (self->swin_view),
+                                       grid_view);
     }
 
     gtk_stack_set_visible_child_name (GTK_STACK (self->stack), "overview");
 }
 
 static void
-query_info_ready_cb (GObject *object,
-                     GAsyncResult *res,
-                     gpointer user_data)
+query_info_ready_cb (GObject *object, GAsyncResult *res, gpointer user_data)
 {
     FontViewApplication *self = user_data;
-    g_autoptr(GError) error = NULL;
-    g_autoptr(GFileInfo) info = NULL;
+    g_autoptr (GError) error = NULL;
+    g_autoptr (GFileInfo) info = NULL;
 
     ensure_window (self);
     g_application_release (G_APPLICATION (self));
@@ -1120,26 +1150,23 @@ font_view_application_open (GApplication *application,
 
     g_application_hold (application);
     g_file_query_info_async (files[0], G_FILE_ATTRIBUTE_STANDARD_NAME,
-                             G_FILE_QUERY_INFO_NONE,
-                             G_PRIORITY_DEFAULT, NULL,
+                             G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, NULL,
                              query_info_ready_cb, self);
 }
 
 static void
-action_quit (GSimpleAction *action,
-             GVariant *parameter,
-             gpointer user_data)
+action_quit (GSimpleAction *action, GVariant *parameter, gpointer user_data)
 {
     FontViewApplication *self = user_data;
-    gtk_window_destroy (GTK_WINDOW(self->main_window));
+    gtk_window_destroy (GTK_WINDOW (self->main_window));
 }
 
 static void
-action_about (GSimpleAction *action,
-              GVariant *parameter,
-              gpointer user_data)
+action_about (GSimpleAction *action, GVariant *parameter, gpointer user_data)
 {
     FontViewApplication *self = user_data;
+
+    // clang-format off
     const gchar *authors[] = {
         "Cosimo Cecchi",
         "James Henstridge",
@@ -1157,63 +1184,63 @@ action_about (GSimpleAction *action,
                            "license-type", GTK_LICENSE_GPL_2_0,
                            "wrap-license", TRUE,
                            NULL);
-
+    // clang-format on
 }
 
 static void
-action_back (GSimpleAction *action,
-             GVariant      *parameter,
-             gpointer       user_data)
+action_back (GSimpleAction *action, GVariant *parameter, gpointer user_data)
 {
     FontViewApplication *self = user_data;
     font_view_application_do_overview (self);
 }
 
 static GActionEntry action_entries[] = {
-    { "about", action_about, NULL, NULL, NULL },
-    { "back", action_back, NULL, NULL, NULL },
-    { "quit", action_quit, NULL, NULL, NULL }
-};
+    {"about", action_about, NULL, NULL, NULL},
+    {"back", action_back, NULL, NULL, NULL},
+    {"quit", action_quit, NULL, NULL, NULL}};
 
 static void
-search_text_changed (GtkEntry *entry,
-                     FontViewApplication *self)
+search_text_changed (GtkEntry *entry, FontViewApplication *self)
 {
-    const char* search = gtk_editable_get_text (GTK_EDITABLE (self->search_entry));
+    const char *search =
+        gtk_editable_get_text (GTK_EDITABLE (self->search_entry));
 
-    if (search == NULL || g_strcmp0(search, "") == 0) {
-        gtk_string_filter_set_search(GTK_STRING_FILTER(self->filter), NULL);
+    if (search == NULL || g_strcmp0 (search, "") == 0) {
+        gtk_string_filter_set_search (GTK_STRING_FILTER (self->filter), NULL);
         return;
     }
 
-    gtk_string_filter_set_search(GTK_STRING_FILTER(self->filter), g_strdup(search));
+    gtk_string_filter_set_search (GTK_STRING_FILTER (self->filter),
+                                  g_strdup (search));
 }
 
 static void
 ensure_window (FontViewApplication *self)
 {
-    g_autoptr(GtkBuilder) builder = NULL;
+    g_autoptr (GtkBuilder) builder = NULL;
     GtkWidget *swin, *box, *image;
-    GtkApplicationWindow* window;
+    GtkApplicationWindow *window;
     GMenuModel *menu;
 
     if (self->main_window)
         return;
 
-    self->main_window = window = GTK_APPLICATION_WINDOW(gtk_application_window_new (GTK_APPLICATION (self)));
+    self->main_window = window = GTK_APPLICATION_WINDOW (
+        gtk_application_window_new (GTK_APPLICATION (self)));
     gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
     gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
     gtk_window_set_icon_name (GTK_WINDOW (window), FONT_VIEW_ICON_NAME);
 
     self->header = gtk_header_bar_new ();
-    gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self->header)),
-                                 "titlebar");
+    gtk_style_context_add_class (
+        gtk_widget_get_style_context (GTK_WIDGET (self->header)), "titlebar");
 
     self->main_grid = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
     gtk_window_set_child (GTK_WINDOW (self->main_window), self->main_grid);
 
     self->stack = gtk_stack_new ();
-    gtk_stack_set_transition_type (GTK_STACK (self->stack), GTK_STACK_TRANSITION_TYPE_CROSSFADE);
+    gtk_stack_set_transition_type (GTK_STACK (self->stack),
+                                   GTK_STACK_TRANSITION_TYPE_CROSSFADE);
     gtk_box_append (GTK_BOX (self->main_grid), self->stack);
     gtk_widget_set_hexpand (self->stack, TRUE);
     gtk_widget_set_vexpand (self->stack, TRUE);
@@ -1222,29 +1249,35 @@ ensure_window (FontViewApplication *self)
     gtk_stack_add_named (GTK_STACK (self->stack), box, "overview");
 
     builder = gtk_builder_new ();
-    gtk_builder_add_from_resource (builder, "/org/gnome/font-viewer/font-view-app-menu.ui", NULL);
+    gtk_builder_add_from_resource (
+        builder, "/org/gnome/font-viewer/font-view-app-menu.ui", NULL);
     menu = G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu"));
 
     self->menu_button = gtk_menu_button_new ();
-    gtk_menu_button_set_icon_name (GTK_MENU_BUTTON (self->menu_button), "open-menu-symbolic");
+    gtk_menu_button_set_icon_name (GTK_MENU_BUTTON (self->menu_button),
+                                   "open-menu-symbolic");
     gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (self->menu_button), menu);
 
     gtk_header_bar_pack_end (GTK_HEADER_BAR (self->header), self->menu_button);
 
     self->search_bar = gtk_search_bar_new ();
     gtk_box_append (GTK_BOX (box), self->search_bar);
-    gtk_search_bar_set_key_capture_widget(GTK_SEARCH_BAR(self->search_bar), GTK_WIDGET(window));
+    gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (self->search_bar),
+                                           GTK_WIDGET (window));
     self->search_entry = gtk_search_entry_new ();
-    gtk_search_bar_set_child (GTK_SEARCH_BAR (self->search_bar), self->search_entry);
+    gtk_search_bar_set_child (GTK_SEARCH_BAR (self->search_bar),
+                              self->search_entry);
     self->search_toggle = gtk_toggle_button_new ();
     image = gtk_image_new_from_icon_name ("edit-find-symbolic");
-    gtk_button_set_child(GTK_BUTTON(self->search_toggle), image);
-    gtk_header_bar_pack_end (GTK_HEADER_BAR (self->header), self->search_toggle);
+    gtk_button_set_child (GTK_BUTTON (self->search_toggle), image);
+    gtk_header_bar_pack_end (GTK_HEADER_BAR (self->header),
+                             self->search_toggle);
     g_object_bind_property (self->search_bar, "search-mode-enabled",
                             self->search_toggle, "active",
                             G_BINDING_BIDIRECTIONAL);
 
-    g_signal_connect (self->search_entry, "search-changed", G_CALLBACK (search_text_changed), self);
+    g_signal_connect (self->search_entry, "search-changed",
+                      G_CALLBACK (search_text_changed), self);
 
     self->swin_view = swin = gtk_scrolled_window_new ();
     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin),
@@ -1261,8 +1294,9 @@ ensure_window (FontViewApplication *self)
                                     GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
     gtk_stack_add_named (GTK_STACK (self->stack), swin, "info");
 
-gtk_window_set_titlebar(GTK_WINDOW(window), GTK_HEADER_BAR(self->header));
-    gtk_window_present(GTK_WINDOW(window));
+    gtk_window_set_titlebar (GTK_WINDOW (window),
+                             GTK_HEADER_BAR (self->header));
+    gtk_window_present (GTK_WINDOW (window));
 }
 
 static void
@@ -1270,7 +1304,8 @@ font_view_application_startup (GApplication *application)
 {
     FontViewApplication *self = FONT_VIEW_APPLICATION (application);
 
-    G_APPLICATION_CLASS (font_view_application_parent_class)->startup (application);
+    G_APPLICATION_CLASS (font_view_application_parent_class)
+        ->startup (application);
 
     adw_init ();
 
@@ -1280,10 +1315,9 @@ font_view_application_startup (GApplication *application)
     g_action_map_add_action_entries (G_ACTION_MAP (self), action_entries,
                                      G_N_ELEMENTS (action_entries), self);
 
-    const gchar *back_accels[] = { "<Alt>Left", NULL };
+    const gchar *back_accels[] = {"<Alt>Left", NULL};
     gtk_application_set_accels_for_action (GTK_APPLICATION (application),
-                                           "app.back",
-                                           back_accels);
+                                           "app.back", back_accels);
 }
 
 static void
@@ -1331,17 +1365,15 @@ font_view_application_class_init (FontViewApplicationClass *klass)
 static GApplication *
 font_view_application_new (void)
 {
-    return g_object_new (FONT_VIEW_TYPE_APPLICATION,
-                         "application-id", APPLICATION_ID,
-                         "flags", G_APPLICATION_HANDLES_OPEN,
+    return g_object_new (FONT_VIEW_TYPE_APPLICATION, "application-id",
+                         APPLICATION_ID, "flags", G_APPLICATION_HANDLES_OPEN,
                          NULL);
 }
 
 int
-main (int argc,
-      char **argv)
+main (int argc, char **argv)
 {
-    g_autoptr(GApplication) app = NULL;
+    g_autoptr (GApplication) app = NULL;
     gint retval;
 
     bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
diff --git a/src/sushi-font-loader.c b/src/sushi-font-loader.c
index df28c1a..cd83249 100644
--- a/src/sushi-font-loader.c
+++ b/src/sushi-font-loader.c
@@ -25,19 +25,19 @@
 
 #include "sushi-font-loader.h"
 
-#include <stdlib.h>
 #include <ft2build.h>
+#include <stdlib.h>
 #include FT_FREETYPE_H
 
 #include <gio/gio.h>
 
 typedef struct {
-  FT_Library library;
-  FT_Long face_index;
-  GFile *file;
+    FT_Library library;
+    FT_Long face_index;
+    GFile *file;
 
-  gchar *face_contents;
-  gsize face_length;
+    gchar *face_contents;
+    gsize face_length;
 } FontLoadJob;
 
 static FontLoadJob *
@@ -47,22 +47,22 @@ font_load_job_new (FT_Library library,
                    GAsyncReadyCallback callback,
                    gpointer user_data)
 {
-  FontLoadJob *job = g_slice_new0 (FontLoadJob);
+    FontLoadJob *job = g_slice_new0 (FontLoadJob);
 
-  job->library = library;
-  job->face_index = (FT_Long) face_index;
-  job->file = g_file_new_for_uri (uri);
+    job->library = library;
+    job->face_index = (FT_Long) face_index;
+    job->file = g_file_new_for_uri (uri);
 
-  return job;
+    return job;
 }
 
 static void
 font_load_job_free (FontLoadJob *job)
 {
-  g_clear_object (&job->file);
-  g_free (job->face_contents);
+    g_clear_object (&job->file);
+    g_free (job->face_contents);
 
-  g_slice_free (FontLoadJob, job);
+    g_slice_free (FontLoadJob, job);
 }
 
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (FontLoadJob, font_load_job_free)
@@ -70,62 +70,56 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (FontLoadJob, font_load_job_free)
 static void
 face_data_finalizer (void *object)
 {
-  FT_Face face = object;
-  g_clear_object (&face->generic.data);
+    FT_Face face = object;
+    g_clear_object (&face->generic.data);
 }
 
 static FT_Face
-create_face_from_contents (FontLoadJob *job,
-                           gchar **contents,
-                           GError **error)
+create_face_from_contents (FontLoadJob *job, gchar **contents, GError **error)
 {
-  FT_Error ft_error;
-  FT_Face retval;
-
-  ft_error = FT_New_Memory_Face (job->library,
-                                 (const FT_Byte *) job->face_contents,
-                                 (FT_Long) job->face_length,
-                                 job->face_index,
-                                 &retval);
-
-  if (ft_error != 0) {
-    g_autofree gchar *uri = g_file_get_uri (job->file);
-    g_set_error (error, G_IO_ERROR, 0,
-                 "Unable to read the font face file '%s'", uri);
-    return NULL;
-  }
-
-  retval->generic.data = g_object_ref (job->file);
-  retval->generic.finalizer = face_data_finalizer;
-
-  *contents = g_steal_pointer (&job->face_contents);
-  return retval;
+    FT_Error ft_error;
+    FT_Face retval;
+
+    ft_error = FT_New_Memory_Face (
+        job->library, (const FT_Byte *) job->face_contents,
+        (FT_Long) job->face_length, job->face_index, &retval);
+
+    if (ft_error != 0) {
+        g_autofree gchar *uri = g_file_get_uri (job->file);
+        g_set_error (error, G_IO_ERROR, 0,
+                     "Unable to read the font face file '%s'", uri);
+        return NULL;
+    }
+
+    retval->generic.data = g_object_ref (job->file);
+    retval->generic.finalizer = face_data_finalizer;
+
+    *contents = g_steal_pointer (&job->face_contents);
+    return retval;
 }
 
 static gboolean
-font_load_job_do_load (FontLoadJob *job,
-                       GError **error)
+font_load_job_do_load (FontLoadJob *job, GError **error)
 {
-  return g_file_load_contents (job->file, NULL,
-                               &job->face_contents, &job->face_length,
-                               NULL, error);
+    return g_file_load_contents (job->file, NULL, &job->face_contents,
+                                 &job->face_length, NULL, error);
 }
 
 static void
 font_load_job (GTask *task,
-              gpointer source_object,
-              gpointer user_data,
+               gpointer source_object,
+               gpointer user_data,
                GCancellable *cancellable)
 {
-  FontLoadJob *job = user_data;
-  g_autoptr(GError) error = NULL;
+    FontLoadJob *job = user_data;
+    g_autoptr (GError) error = NULL;
 
-  font_load_job_do_load (job, &error);
+    font_load_job_do_load (job, &error);
 
-  if (error != NULL)
-    g_task_return_error (task, g_steal_pointer (&error));
-  else
-    g_task_return_boolean (task, TRUE);
+    if (error != NULL)
+        g_task_return_error (task, g_steal_pointer (&error));
+    else
+        g_task_return_boolean (task, TRUE);
 }
 
 /**
@@ -139,11 +133,12 @@ sushi_new_ft_face_from_uri (FT_Library library,
                             gchar **contents,
                             GError **error)
 {
-  g_autoptr(FontLoadJob) job = font_load_job_new (library, uri, face_index, NULL, NULL);
-  if (!font_load_job_do_load (job, error))
-    return NULL;
+    g_autoptr (FontLoadJob) job =
+        font_load_job_new (library, uri, face_index, NULL, NULL);
+    if (!font_load_job_do_load (job, error))
+        return NULL;
 
-  return create_face_from_contents (job, contents, error);
+    return create_face_from_contents (job, contents, error);
 }
 
 /**
@@ -157,11 +152,12 @@ sushi_new_ft_face_from_uri_async (FT_Library library,
                                   GAsyncReadyCallback callback,
                                   gpointer user_data)
 {
-  FontLoadJob *job = font_load_job_new (library, uri, face_index, callback, user_data);
-  g_autoptr(GTask) task = g_task_new (NULL, NULL, callback, user_data);
+    FontLoadJob *job =
+        font_load_job_new (library, uri, face_index, callback, user_data);
+    g_autoptr (GTask) task = g_task_new (NULL, NULL, callback, user_data);
 
-  g_task_set_task_data (task, job, (GDestroyNotify) font_load_job_free);
-  g_task_run_in_thread (task, font_load_job);
+    g_task_set_task_data (task, job, (GDestroyNotify) font_load_job_free);
+    g_task_run_in_thread (task, font_load_job);
 }
 
 /**
@@ -173,14 +169,14 @@ sushi_new_ft_face_from_uri_finish (GAsyncResult *result,
                                    gchar **contents,
                                    GError **error)
 {
-  FontLoadJob *job;
+    FontLoadJob *job;
 
-  if (!g_task_propagate_boolean (G_TASK (result), error))
-    return NULL;
+    if (!g_task_propagate_boolean (G_TASK (result), error))
+        return NULL;
 
-  job = g_task_get_task_data (G_TASK (result));
+    job = g_task_get_task_data (G_TASK (result));
 
-  return create_face_from_contents (job, contents, error);
+    return create_face_from_contents (job, contents, error);
 }
 
 /**
@@ -188,25 +184,24 @@ sushi_new_ft_face_from_uri_finish (GAsyncResult *result,
  *
  */
 gchar *
-sushi_get_font_name (FT_Face face,
-                     gboolean short_form)
+sushi_get_font_name (FT_Face face, gboolean short_form)
 {
-  const char *style_name = face->style_name;
-  const char *family_name = face->family_name;
+    const char *style_name = face->style_name;
+    const char *family_name = face->family_name;
 
-  if (family_name == NULL) {
-    /* Try to get the basename of the file this was loaded from */
-    GFile *file = face->generic.data;
-    if (G_IS_FILE (file))
-      return g_file_get_basename (file);
+    if (family_name == NULL) {
+        /* Try to get the basename of the file this was loaded from */
+        GFile *file = face->generic.data;
+        if (G_IS_FILE (file))
+            return g_file_get_basename (file);
 
-    /* Use an empty string as the last fallback */
-    return g_strdup ("");
-  }
+        /* Use an empty string as the last fallback */
+        return g_strdup ("");
+    }
 
-  if (style_name == NULL ||
-      (short_form && g_strcmp0 (style_name, "Regular") == 0))
-    return g_strdup (family_name);
+    if (style_name == NULL ||
+        (short_form && g_strcmp0 (style_name, "Regular") == 0))
+        return g_strdup (family_name);
 
-  return g_strconcat (family_name, ", ", style_name, NULL);
+    return g_strconcat (family_name, ", ", style_name, NULL);
 }
diff --git a/src/sushi-font-loader.h b/src/sushi-font-loader.h
index b078e4a..2039c46 100644
--- a/src/sushi-font-loader.h
+++ b/src/sushi-font-loader.h
@@ -46,7 +46,6 @@ FT_Face sushi_new_ft_face_from_uri_finish (GAsyncResult *result,
                                            gchar **contents,
                                            GError **error);
 
-gchar * sushi_get_font_name (FT_Face face,
-                             gboolean short_form);
+gchar *sushi_get_font_name (FT_Face face, gboolean short_form);
 
 #endif /* __SUSHI_FONT_LOADER_H__ */
diff --git a/src/sushi-font-widget.c b/src/sushi-font-widget.c
index eeff810..ed7e25d 100644
--- a/src/sushi-font-widget.c
+++ b/src/sushi-font-widget.c
@@ -31,39 +31,35 @@
 #include <hb-glib.h>
 #include <math.h>
 
-enum {
-  PROP_URI = 1,
-  PROP_FACE_INDEX,
-  NUM_PROPERTIES
-};
+enum { PROP_URI = 1, PROP_FACE_INDEX, NUM_PROPERTIES };
 
-enum {
-  LOADED,
-  ERROR,
-  NUM_SIGNALS
-};
+enum { LOADED, ERROR, NUM_SIGNALS };
 
 struct _SushiFontWidget {
-  GtkDrawingArea parent_instance;
+    GtkDrawingArea parent_instance;
 
-  gchar *uri;
-  gint face_index;
+    gchar *uri;
+    gint face_index;
 
-  FT_Library library;
-  FT_Face face;
-  gchar *face_contents;
+    FT_Library library;
+    FT_Face face;
+    gchar *face_contents;
 
-  const gchar *lowercase_text;
-  const gchar *uppercase_text;
-  const gchar *punctuation_text;
+    const gchar *lowercase_text;
+    const gchar *uppercase_text;
+    const gchar *punctuation_text;
 
-  gchar *sample_string;
+    gchar *sample_string;
 
-  gchar *font_name;
+    gchar *font_name;
 };
 
-static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
-static guint signals[NUM_SIGNALS] = { 0, };
+static GParamSpec *properties[NUM_PROPERTIES] = {
+    NULL,
+};
+static guint signals[NUM_SIGNALS] = {
+    0,
+};
 
 G_DEFINE_TYPE (SushiFontWidget, sushi_font_widget, GTK_TYPE_DRAWING_AREA)
 
@@ -81,104 +77,108 @@ text_to_glyphs (cairo_t *cr,
                 cairo_glyph_t **glyphs,
                 int *num_glyphs)
 {
-  PangoAttribute *fallback_attr;
-  PangoAttrList *attr_list;
-  PangoContext *context;
-  PangoDirection base_dir;
-  GList *items;
-  GList *visual_items;
-  FT_Face ft_face;
-  hb_font_t *hb_font;
-  gdouble x = 0, y = 0;
-  gint i;
-  gdouble x_scale, y_scale;
-
-  *num_glyphs = 0;
-  *glyphs = NULL;
-
-  base_dir = pango_find_base_dir (text, -1);
-
-  cairo_scaled_font_t *cr_font = cairo_get_scaled_font (cr);
-  ft_face = cairo_ft_scaled_font_lock_face (cr_font);
-  hb_font = hb_ft_font_create (ft_face, NULL);
-
-  cairo_surface_t *target = cairo_get_target (cr);
-  cairo_surface_get_device_scale (target, &x_scale, &y_scale);
-
-  /* We abuse pango itemazation to split text into script and direction
-   * runs, since we use our fonts directly no through pango, we don't
-   * bother changing the default font, but we disable font fallback as
-   * pango will split runs at font change */
-  context = pango_cairo_create_context (cr);
-  attr_list = pango_attr_list_new ();
-  fallback_attr = pango_attr_fallback_new (FALSE);
-  pango_attr_list_insert (attr_list, fallback_attr);
-  items = pango_itemize_with_base_dir (context, base_dir,
-                                       text, 0, strlen (text),
-                                       attr_list, NULL);
-  g_object_unref (context);
-  pango_attr_list_unref (attr_list);
-
-  /* reorder the items in the visual order */
-  visual_items = pango_reorder_items (items);
-
-  while (visual_items) {
-    PangoItem *item;
-    PangoAnalysis analysis;
-    hb_buffer_t *hb_buffer;
-    hb_glyph_info_t *hb_glyphs;
-    hb_glyph_position_t *hb_positions;
-    gint n;
-
-    item = visual_items->data;
-    analysis = item->analysis;
-
-    hb_buffer = hb_buffer_create ();
-    hb_buffer_add_utf8 (hb_buffer, text, -1, item->offset, item->length);
-    hb_buffer_set_script (hb_buffer, hb_glib_script_to_script (analysis.script));
-    hb_buffer_set_language (hb_buffer, hb_language_from_string (pango_language_to_string 
(analysis.language), -1));
-    hb_buffer_set_direction (hb_buffer, analysis.level % 2 ? HB_DIRECTION_RTL : HB_DIRECTION_LTR);
-
-    hb_shape (hb_font, hb_buffer, NULL, 0);
-
-    n = hb_buffer_get_length (hb_buffer);
-    hb_glyphs = hb_buffer_get_glyph_infos (hb_buffer, NULL);
-    hb_positions = hb_buffer_get_glyph_positions (hb_buffer, NULL);
-
-    *glyphs = g_renew (cairo_glyph_t, *glyphs, *num_glyphs + n);
-
-    for (i = 0; i < n; i++) {
-      (*glyphs)[*num_glyphs + i].index = hb_glyphs[i].codepoint;
-      (*glyphs)[*num_glyphs + i].x = x + (hb_positions[i].x_offset / (64. * x_scale));
-      (*glyphs)[*num_glyphs + i].y = y - (hb_positions[i].y_offset / (64. * y_scale));
-      x += (hb_positions[i].x_advance / (64. * x_scale));
-      y -= (hb_positions[i].y_advance / (64. * y_scale));
+    PangoAttribute *fallback_attr;
+    PangoAttrList *attr_list;
+    PangoContext *context;
+    PangoDirection base_dir;
+    GList *items;
+    GList *visual_items;
+    FT_Face ft_face;
+    hb_font_t *hb_font;
+    gdouble x = 0, y = 0;
+    gint i;
+    gdouble x_scale, y_scale;
+
+    *num_glyphs = 0;
+    *glyphs = NULL;
+
+    base_dir = pango_find_base_dir (text, -1);
+
+    cairo_scaled_font_t *cr_font = cairo_get_scaled_font (cr);
+    ft_face = cairo_ft_scaled_font_lock_face (cr_font);
+    hb_font = hb_ft_font_create (ft_face, NULL);
+
+    cairo_surface_t *target = cairo_get_target (cr);
+    cairo_surface_get_device_scale (target, &x_scale, &y_scale);
+
+    /* We abuse pango itemazation to split text into script and direction
+     * runs, since we use our fonts directly no through pango, we don't
+     * bother changing the default font, but we disable font fallback as
+     * pango will split runs at font change */
+    context = pango_cairo_create_context (cr);
+    attr_list = pango_attr_list_new ();
+    fallback_attr = pango_attr_fallback_new (FALSE);
+    pango_attr_list_insert (attr_list, fallback_attr);
+    items = pango_itemize_with_base_dir (context, base_dir, text, 0,
+                                         strlen (text), attr_list, NULL);
+    g_object_unref (context);
+    pango_attr_list_unref (attr_list);
+
+    /* reorder the items in the visual order */
+    visual_items = pango_reorder_items (items);
+
+    while (visual_items) {
+        PangoItem *item;
+        PangoAnalysis analysis;
+        hb_buffer_t *hb_buffer;
+        hb_glyph_info_t *hb_glyphs;
+        hb_glyph_position_t *hb_positions;
+        gint n;
+
+        item = visual_items->data;
+        analysis = item->analysis;
+
+        hb_buffer = hb_buffer_create ();
+        hb_buffer_add_utf8 (hb_buffer, text, -1, item->offset, item->length);
+        hb_buffer_set_script (hb_buffer,
+                              hb_glib_script_to_script (analysis.script));
+        hb_buffer_set_language (
+            hb_buffer, hb_language_from_string (
+                           pango_language_to_string (analysis.language), -1));
+        hb_buffer_set_direction (hb_buffer, analysis.level % 2
+                                                ? HB_DIRECTION_RTL
+                                                : HB_DIRECTION_LTR);
+
+        hb_shape (hb_font, hb_buffer, NULL, 0);
+
+        n = hb_buffer_get_length (hb_buffer);
+        hb_glyphs = hb_buffer_get_glyph_infos (hb_buffer, NULL);
+        hb_positions = hb_buffer_get_glyph_positions (hb_buffer, NULL);
+
+        *glyphs = g_renew (cairo_glyph_t, *glyphs, *num_glyphs + n);
+
+        for (i = 0; i < n; i++) {
+            (*glyphs)[*num_glyphs + i].index = hb_glyphs[i].codepoint;
+            (*glyphs)[*num_glyphs + i].x =
+                x + (hb_positions[i].x_offset / (64. * x_scale));
+            (*glyphs)[*num_glyphs + i].y =
+                y - (hb_positions[i].y_offset / (64. * y_scale));
+            x += (hb_positions[i].x_advance / (64. * x_scale));
+            y -= (hb_positions[i].y_advance / (64. * y_scale));
+        }
+
+        *num_glyphs += n;
+
+        hb_buffer_destroy (hb_buffer);
+
+        visual_items = visual_items->next;
     }
 
-    *num_glyphs += n;
-
-    hb_buffer_destroy (hb_buffer);
-
-    visual_items = visual_items->next;
-  }
-
-  g_list_free_full (visual_items, (GDestroyNotify) pango_item_free);
-  g_list_free_full (items, (GDestroyNotify) pango_item_free);
+    g_list_free_full (visual_items, (GDestroyNotify) pango_item_free);
+    g_list_free_full (items, (GDestroyNotify) pango_item_free);
 
-  hb_font_destroy (hb_font);
-  cairo_ft_scaled_font_unlock_face (cr_font);
+    hb_font_destroy (hb_font);
+    cairo_ft_scaled_font_unlock_face (cr_font);
 }
 
 static void
-text_extents (cairo_t *cr,
-              const char *text,
-              cairo_text_extents_t *extents)
+text_extents (cairo_t *cr, const char *text, cairo_text_extents_t *extents)
 {
-  g_autofree cairo_glyph_t *glyphs = NULL;
-  gint num_glyphs;
+    g_autofree cairo_glyph_t *glyphs = NULL;
+    gint num_glyphs;
 
-  text_to_glyphs (cr, text, &glyphs, &num_glyphs);
-  cairo_glyph_extents (cr, glyphs, num_glyphs, extents);
+    text_to_glyphs (cr, text, &glyphs, &num_glyphs);
+    cairo_glyph_extents (cr, glyphs, num_glyphs, extents);
 }
 
 /* adapted from gnome-utils:font-viewer/font-view.c
@@ -192,250 +192,250 @@ static void
 draw_string (SushiFontWidget *self,
              cairo_t *cr,
              GtkBorder padding,
-            const gchar *text,
-            gint *pos_y)
+             const gchar *text,
+             gint *pos_y)
 {
-  g_autofree cairo_glyph_t *glyphs = NULL;
-  cairo_font_extents_t font_extents;
-  cairo_text_extents_t extents;
-  GtkTextDirection text_dir;
-  gint pos_x;
-  gint num_glyphs;
-  gint i;
-
-  text_dir = gtk_widget_get_direction (GTK_WIDGET (self));
-
-  text_to_glyphs (cr, text, &glyphs, &num_glyphs);
-
-  cairo_font_extents (cr, &font_extents);
-  cairo_glyph_extents (cr, glyphs, num_glyphs, &extents);
-
-  if (pos_y != NULL)
-    *pos_y += font_extents.ascent + font_extents.descent +
-      extents.y_advance + LINE_SPACING / 2;
-  if (text_dir == GTK_TEXT_DIR_LTR)
-    pos_x = padding.left;
-  else {
-    pos_x = gtk_widget_get_allocated_width (GTK_WIDGET (self)) -
-      extents.x_advance - padding.right;
-  }
-
-  for (i = 0; i < num_glyphs; i++) {
-    glyphs[i].x += pos_x;
-    glyphs[i].y += *pos_y;
-  }
-
-  cairo_move_to (cr, pos_x, *pos_y);
-  cairo_show_glyphs (cr, glyphs, num_glyphs);
-
-  *pos_y += LINE_SPACING / 2;
+    g_autofree cairo_glyph_t *glyphs = NULL;
+    cairo_font_extents_t font_extents;
+    cairo_text_extents_t extents;
+    GtkTextDirection text_dir;
+    gint pos_x;
+    gint num_glyphs;
+    gint i;
+
+    text_dir = gtk_widget_get_direction (GTK_WIDGET (self));
+
+    text_to_glyphs (cr, text, &glyphs, &num_glyphs);
+
+    cairo_font_extents (cr, &font_extents);
+    cairo_glyph_extents (cr, glyphs, num_glyphs, &extents);
+
+    if (pos_y != NULL)
+        *pos_y += font_extents.ascent + font_extents.descent +
+                  extents.y_advance + LINE_SPACING / 2;
+    if (text_dir == GTK_TEXT_DIR_LTR)
+        pos_x = padding.left;
+    else {
+        pos_x = gtk_widget_get_allocated_width (GTK_WIDGET (self)) -
+                extents.x_advance - padding.right;
+    }
+
+    for (i = 0; i < num_glyphs; i++) {
+        glyphs[i].x += pos_x;
+        glyphs[i].y += *pos_y;
+    }
+
+    cairo_move_to (cr, pos_x, *pos_y);
+    cairo_show_glyphs (cr, glyphs, num_glyphs);
+
+    *pos_y += LINE_SPACING / 2;
 }
 
 static gboolean
-check_font_contain_text (FT_Face face,
-                         const gchar *text)
+check_font_contain_text (FT_Face face, const gchar *text)
 {
-  g_autofree gunichar *string = NULL;
-  glong len, idx;
+    g_autofree gunichar *string = NULL;
+    glong len, idx;
 
-  string = g_utf8_to_ucs4_fast (text, -1, &len);
-  for (idx = 0; idx < len; idx++) {
-    gunichar c = string[idx];
+    string = g_utf8_to_ucs4_fast (text, -1, &len);
+    for (idx = 0; idx < len; idx++) {
+        gunichar c = string[idx];
 
-    if (!FT_Get_Char_Index (face, c))
-      return FALSE;
-  }
+        if (!FT_Get_Char_Index (face, c))
+            return FALSE;
+    }
 
-  return TRUE;
+    return TRUE;
 }
 
 static gchar *
-build_charlist_for_face (FT_Face face,
-                         gint *length)
+build_charlist_for_face (FT_Face face, gint *length)
 {
-  g_autoptr(GString) string = NULL;
-  gulong c;
-  guint glyph;
-  gint total_chars = 0;
+    g_autoptr (GString) string = NULL;
+    gulong c;
+    guint glyph;
+    gint total_chars = 0;
 
-  string = g_string_new (NULL);
+    string = g_string_new (NULL);
 
-  c = FT_Get_First_Char (face, &glyph);
+    c = FT_Get_First_Char (face, &glyph);
 
-  while (glyph != 0) {
-    g_string_append_unichar (string, (gunichar) c);
-    c = FT_Get_Next_Char (face, c, &glyph);
-    total_chars++;
-  }
+    while (glyph != 0) {
+        g_string_append_unichar (string, (gunichar) c);
+        c = FT_Get_Next_Char (face, c, &glyph);
+        total_chars++;
+    }
 
-  if (length)
-    *length = total_chars;
+    if (length)
+        *length = total_chars;
 
-  return g_strdup (string->str);
+    return g_strdup (string->str);
 }
 
 static gchar *
-random_string_from_available_chars (FT_Face face,
-                                    gint n_chars)
+random_string_from_available_chars (FT_Face face, gint n_chars)
 {
-  g_autofree gchar *chars = NULL;
-  g_autoptr(GString) retval = NULL;
-  gint idx, rand, total_chars;
-  gchar *ptr, *end;
+    g_autofree gchar *chars = NULL;
+    g_autoptr (GString) retval = NULL;
+    gint idx, rand, total_chars;
+    gchar *ptr, *end;
 
-  idx = 0;
-  chars = build_charlist_for_face (face, &total_chars);
+    idx = 0;
+    chars = build_charlist_for_face (face, &total_chars);
 
-  if (total_chars == 0)
-    return NULL;
+    if (total_chars == 0)
+        return NULL;
 
-  if (total_chars <= n_chars)
-    return g_steal_pointer (&chars);
+    if (total_chars <= n_chars)
+        return g_steal_pointer (&chars);
 
-  retval = g_string_new (NULL);
+    retval = g_string_new (NULL);
 
-  while (idx < n_chars) {
-    rand = g_random_int_range (0, total_chars);
+    while (idx < n_chars) {
+        rand = g_random_int_range (0, total_chars);
 
-    ptr = g_utf8_offset_to_pointer (chars, rand);
-    end = g_utf8_find_next_char (ptr, NULL);
+        ptr = g_utf8_offset_to_pointer (chars, rand);
+        end = g_utf8_find_next_char (ptr, NULL);
 
-    g_string_append_len (retval, ptr, end - ptr);
-    idx++;
-  }
+        g_string_append_len (retval, ptr, end - ptr);
+        idx++;
+    }
 
-  return g_strdup (retval->str);
+    return g_strdup (retval->str);
 }
 
 static gboolean
 set_pango_sample_string (SushiFontWidget *self)
 {
-  const gchar *sample_string;
-  gboolean retval = FALSE;
+    const gchar *sample_string;
+    gboolean retval = FALSE;
 
-  sample_string = pango_language_get_sample_string (pango_language_from_string (NULL));
-  if (check_font_contain_text (self->face, sample_string))
-    retval = TRUE;
-
-  if (!retval) {
-    sample_string = pango_language_get_sample_string (pango_language_from_string ("C"));
+    sample_string =
+        pango_language_get_sample_string (pango_language_from_string (NULL));
     if (check_font_contain_text (self->face, sample_string))
-      retval = TRUE;
-  }
+        retval = TRUE;
 
-  g_clear_pointer (&self->sample_string, g_free);
+    if (!retval) {
+        sample_string =
+            pango_language_get_sample_string (pango_language_from_string ("C"));
+        if (check_font_contain_text (self->face, sample_string))
+            retval = TRUE;
+    }
 
-  if (retval)
-    self->sample_string = g_strdup (sample_string);
+    g_clear_pointer (&self->sample_string, g_free);
 
-  return retval;
+    if (retval)
+        self->sample_string = g_strdup (sample_string);
+
+    return retval;
 }
 
 static void
 select_best_charmap (SushiFontWidget *self)
 {
-  gchar *chars;
-  gint idx, n_chars;
+    gchar *chars;
+    gint idx, n_chars;
 
-  if (FT_Select_Charmap (self->face, FT_ENCODING_UNICODE) == 0)
-    return;
+    if (FT_Select_Charmap (self->face, FT_ENCODING_UNICODE) == 0)
+        return;
 
-  for (idx = 0; idx < self->face->num_charmaps; idx++) {
-    if (FT_Set_Charmap (self->face, self->face->charmaps[idx]) != 0)
-      continue;
+    for (idx = 0; idx < self->face->num_charmaps; idx++) {
+        if (FT_Set_Charmap (self->face, self->face->charmaps[idx]) != 0)
+            continue;
 
-    chars = build_charlist_for_face (self->face, &n_chars);
-    g_free (chars);
+        chars = build_charlist_for_face (self->face, &n_chars);
+        g_free (chars);
 
-    if (n_chars > 0)
-      break;
-  }
+        if (n_chars > 0)
+            break;
+    }
 }
 
 static void
 build_strings_for_face (SushiFontWidget *self)
 {
-  select_best_charmap (self);
-
-  /* if we don't have lowercase/uppercase/punctuation text in the face,
-   * we omit it directly, and render a random text below.
-   */
-  if (check_font_contain_text (self->face, lowercase_text_stock))
-    self->lowercase_text = lowercase_text_stock;
-  else
-    self->lowercase_text = NULL;
-
-  if (check_font_contain_text (self->face, uppercase_text_stock))
-    self->uppercase_text = uppercase_text_stock;
-  else
-    self->uppercase_text = NULL;
-
-  if (check_font_contain_text (self->face, punctuation_text_stock))
-    self->punctuation_text = punctuation_text_stock;
-  else
-    self->punctuation_text = NULL;
-
-  if (!set_pango_sample_string (self))
-    self->sample_string = random_string_from_available_chars (self->face, 36);
-
-  g_free (self->font_name);
-  self->font_name = sushi_get_font_name (self->face, FALSE);
+    select_best_charmap (self);
+
+    /* if we don't have lowercase/uppercase/punctuation text in the face,
+     * we omit it directly, and render a random text below.
+     */
+    if (check_font_contain_text (self->face, lowercase_text_stock))
+        self->lowercase_text = lowercase_text_stock;
+    else
+        self->lowercase_text = NULL;
+
+    if (check_font_contain_text (self->face, uppercase_text_stock))
+        self->uppercase_text = uppercase_text_stock;
+    else
+        self->uppercase_text = NULL;
+
+    if (check_font_contain_text (self->face, punctuation_text_stock))
+        self->punctuation_text = punctuation_text_stock;
+    else
+        self->punctuation_text = NULL;
+
+    if (!set_pango_sample_string (self))
+        self->sample_string =
+            random_string_from_available_chars (self->face, 36);
+
+    g_free (self->font_name);
+    self->font_name = sushi_get_font_name (self->face, FALSE);
 }
 
 static gint *
 build_sizes_table (FT_Face face,
-                  gint *n_sizes,
-                  gint *alpha_size,
+                   gint *n_sizes,
+                   gint *alpha_size,
                    gint *title_size)
 {
-  gint *sizes = NULL;
-  gint i;
-
-  /* work out what sizes to render */
-  if (FT_IS_SCALABLE (face)) {
-    *n_sizes = 14;
-    sizes = g_new (gint, *n_sizes);
-    sizes[0] = 8;
-    sizes[1] = 10;
-    sizes[2] = 12;
-    sizes[3] = 18;
-    sizes[4] = 24;
-    sizes[5] = 36;
-    sizes[6] = 48;
-    sizes[7] = 72;
-    sizes[8] = 96;
-    sizes[9] = 120;
-    sizes[10] = 144;
-    sizes[11] = 168;
-    sizes[12] = 192;
-    sizes[13] = 216;
-
-    *alpha_size = 24;
-    *title_size = 48;
-  } else {
-    gint alpha_diff = G_MAXINT;
-    gint title_diff = G_MAXINT;
-
-    /* use fixed sizes */
-    *n_sizes = face->num_fixed_sizes;
-    sizes = g_new (gint, *n_sizes);
-    *alpha_size = 0;
-
-    for (i = 0; i < face->num_fixed_sizes; i++) {
-      sizes[i] = face->available_sizes[i].height;
-
-      if ((gint) (abs (sizes[i] - 24)) < alpha_diff) {
-        alpha_diff = (gint) abs (sizes[i] - 24);
-        *alpha_size = sizes[i];
-      }
-      if ((gint) (abs (sizes[i] - 24)) < title_diff) {
-        title_diff = (gint) abs (sizes[i] - 24);
-        *title_size = sizes[i];
-      }
+    gint *sizes = NULL;
+    gint i;
+
+    /* work out what sizes to render */
+    if (FT_IS_SCALABLE (face)) {
+        *n_sizes = 14;
+        sizes = g_new (gint, *n_sizes);
+        sizes[0] = 8;
+        sizes[1] = 10;
+        sizes[2] = 12;
+        sizes[3] = 18;
+        sizes[4] = 24;
+        sizes[5] = 36;
+        sizes[6] = 48;
+        sizes[7] = 72;
+        sizes[8] = 96;
+        sizes[9] = 120;
+        sizes[10] = 144;
+        sizes[11] = 168;
+        sizes[12] = 192;
+        sizes[13] = 216;
+
+        *alpha_size = 24;
+        *title_size = 48;
+    } else {
+        gint alpha_diff = G_MAXINT;
+        gint title_diff = G_MAXINT;
+
+        /* use fixed sizes */
+        *n_sizes = face->num_fixed_sizes;
+        sizes = g_new (gint, *n_sizes);
+        *alpha_size = 0;
+
+        for (i = 0; i < face->num_fixed_sizes; i++) {
+            sizes[i] = face->available_sizes[i].height;
+
+            if ((gint) (abs (sizes[i] - 24)) < alpha_diff) {
+                alpha_diff = (gint) abs (sizes[i] - 24);
+                *alpha_size = sizes[i];
+            }
+            if ((gint) (abs (sizes[i] - 24)) < title_diff) {
+                title_diff = (gint) abs (sizes[i] - 24);
+                *title_size = sizes[i];
+            }
+        }
     }
-  }
 
-  return sizes;
+    return sizes;
 }
 
 static void
@@ -444,218 +444,222 @@ sushi_font_widget_size_request (GtkWidget *drawing_area,
                                 gint *height,
                                 gint *min_height)
 {
-  SushiFontWidget *self = SUSHI_FONT_WIDGET (drawing_area);
-  gint i, pixmap_width, pixmap_height;
-  cairo_text_extents_t extents;
-  cairo_font_extents_t font_extents;
-  cairo_font_face_t *font;
-  g_autofree gint *sizes = NULL;
-  gint n_sizes, alpha_size, title_size;
-  cairo_t *cr;
-  cairo_surface_t *surface;
-  FT_Face face = self->face;
-  GtkStyleContext *context;
-  GtkStateFlags state;
-  GtkBorder padding;
-
-  if (face == NULL) {
-    if (width != NULL)
-      *width = 1;
-    if (height != NULL)
-      *height = 1;
+    SushiFontWidget *self = SUSHI_FONT_WIDGET (drawing_area);
+    gint i, pixmap_width, pixmap_height;
+    cairo_text_extents_t extents;
+    cairo_font_extents_t font_extents;
+    cairo_font_face_t *font;
+    g_autofree gint *sizes = NULL;
+    gint n_sizes, alpha_size, title_size;
+    cairo_t *cr;
+    cairo_surface_t *surface;
+    FT_Face face = self->face;
+    GtkStyleContext *context;
+    GtkStateFlags state;
+    GtkBorder padding;
+
+    if (face == NULL) {
+        if (width != NULL)
+            *width = 1;
+        if (height != NULL)
+            *height = 1;
+        if (min_height != NULL)
+            *min_height = 1;
+
+        return;
+    }
+
     if (min_height != NULL)
-      *min_height = 1;
+        *min_height = -1;
 
-    return;
-  }
+    surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, SURFACE_SIZE,
+                                          SURFACE_SIZE);
+    cr = cairo_create (surface);
+    context = gtk_widget_get_style_context (drawing_area);
+    state = gtk_style_context_get_state (context);
+    gtk_style_context_get_padding (context, &padding);
 
-  if (min_height != NULL)
-    *min_height = -1;
+    sizes = build_sizes_table (face, &n_sizes, &alpha_size, &title_size);
 
-  surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
-                                        SURFACE_SIZE, SURFACE_SIZE);
-  cr = cairo_create (surface);
-  context = gtk_widget_get_style_context (drawing_area);
-  state = gtk_style_context_get_state (context);
-  gtk_style_context_get_padding (context, &padding);
+    /* calculate size of pixmap to use */
+    pixmap_width = padding.left + padding.right;
+    pixmap_height = padding.top + padding.bottom;
 
-  sizes = build_sizes_table (face, &n_sizes, &alpha_size, &title_size);
+    font = cairo_ft_font_face_create_for_ft_face (face, 0);
 
-  /* calculate size of pixmap to use */
-  pixmap_width = padding.left + padding.right;
-  pixmap_height = padding.top + padding.bottom;
+    if (check_font_contain_text (face, self->font_name))
+        cairo_set_font_face (cr, font);
+    else
+        cairo_set_font_face (cr, NULL);
 
-  font = cairo_ft_font_face_create_for_ft_face (face, 0);
+    cairo_set_font_size (cr, title_size);
+    cairo_font_extents (cr, &font_extents);
+    text_extents (cr, self->font_name, &extents);
+    pixmap_height += font_extents.ascent + font_extents.descent +
+                     extents.y_advance + LINE_SPACING;
+    pixmap_width =
+        MAX (pixmap_width, extents.width + padding.left + padding.right);
+
+    pixmap_height += SECTION_SPACING / 2;
 
-  if (check_font_contain_text (face, self->font_name))
     cairo_set_font_face (cr, font);
-  else
-    cairo_set_font_face (cr, NULL);
-
-  cairo_set_font_size (cr, title_size);
-  cairo_font_extents (cr, &font_extents);
-  text_extents (cr, self->font_name, &extents);
-  pixmap_height += font_extents.ascent + font_extents.descent +
-    extents.y_advance + LINE_SPACING;
-  pixmap_width = MAX (pixmap_width, extents.width + padding.left + padding.right);
-
-  pixmap_height += SECTION_SPACING / 2;
-
-  cairo_set_font_face (cr, font);
-  cairo_set_font_size (cr, alpha_size);
-  cairo_font_extents (cr, &font_extents);
-
-  if (self->lowercase_text != NULL) {
-    text_extents (cr, self->lowercase_text, &extents);
-    pixmap_height += font_extents.ascent + font_extents.descent + 
-      extents.y_advance + LINE_SPACING;
-    pixmap_width = MAX (pixmap_width, extents.width + padding.left + padding.right);
-  }
-
-  if (self->uppercase_text != NULL) {
-    text_extents (cr, self->uppercase_text, &extents);
-    pixmap_height += font_extents.ascent + font_extents.descent +
-      extents.y_advance + LINE_SPACING;
-    pixmap_width = MAX (pixmap_width, extents.width + padding.left + padding.right);
-  }
+    cairo_set_font_size (cr, alpha_size);
+    cairo_font_extents (cr, &font_extents);
+
+    if (self->lowercase_text != NULL) {
+        text_extents (cr, self->lowercase_text, &extents);
+        pixmap_height += font_extents.ascent + font_extents.descent +
+                         extents.y_advance + LINE_SPACING;
+        pixmap_width =
+            MAX (pixmap_width, extents.width + padding.left + padding.right);
+    }
 
-  if (self->punctuation_text != NULL) {
-    text_extents (cr, self->punctuation_text, &extents);
-    pixmap_height += font_extents.ascent + font_extents.descent +
-      extents.y_advance + LINE_SPACING;
-    pixmap_width = MAX (pixmap_width, extents.width + padding.left + padding.right);
-  }
+    if (self->uppercase_text != NULL) {
+        text_extents (cr, self->uppercase_text, &extents);
+        pixmap_height += font_extents.ascent + font_extents.descent +
+                         extents.y_advance + LINE_SPACING;
+        pixmap_width =
+            MAX (pixmap_width, extents.width + padding.left + padding.right);
+    }
 
-  if (self->sample_string != NULL) {
-    pixmap_height += SECTION_SPACING;
+    if (self->punctuation_text != NULL) {
+        text_extents (cr, self->punctuation_text, &extents);
+        pixmap_height += font_extents.ascent + font_extents.descent +
+                         extents.y_advance + LINE_SPACING;
+        pixmap_width =
+            MAX (pixmap_width, extents.width + padding.left + padding.right);
+    }
 
-    for (i = 0; i < n_sizes; i++) {
-      cairo_set_font_size (cr, sizes[i]);
-      cairo_font_extents (cr, &font_extents);
-      text_extents (cr, self->sample_string, &extents);
-      pixmap_height += font_extents.ascent + font_extents.descent +
-        extents.y_advance + LINE_SPACING;
-      pixmap_width = MAX (pixmap_width, extents.width + padding.left + padding.right);
-
-      if ((i == 7) && (min_height != NULL))
-        *min_height = pixmap_height;
+    if (self->sample_string != NULL) {
+        pixmap_height += SECTION_SPACING;
+
+        for (i = 0; i < n_sizes; i++) {
+            cairo_set_font_size (cr, sizes[i]);
+            cairo_font_extents (cr, &font_extents);
+            text_extents (cr, self->sample_string, &extents);
+            pixmap_height += font_extents.ascent + font_extents.descent +
+                             extents.y_advance + LINE_SPACING;
+            pixmap_width = MAX (pixmap_width,
+                                extents.width + padding.left + padding.right);
+
+            if ((i == 7) && (min_height != NULL))
+                *min_height = pixmap_height;
+        }
     }
-  }
 
-  pixmap_height += padding.bottom + SECTION_SPACING;
+    pixmap_height += padding.bottom + SECTION_SPACING;
 
-  if (min_height != NULL && *min_height == -1)
-    *min_height = pixmap_height;
+    if (min_height != NULL && *min_height == -1)
+        *min_height = pixmap_height;
 
-  if (width != NULL)
-    *width = pixmap_width;
+    if (width != NULL)
+        *width = pixmap_width;
 
-  if (height != NULL)
-    *height = pixmap_height;
+    if (height != NULL)
+        *height = pixmap_height;
 
-  cairo_destroy (cr);
-  cairo_font_face_destroy (font);
-  cairo_surface_destroy (surface);
+    cairo_destroy (cr);
+    cairo_font_face_destroy (font);
+    cairo_surface_destroy (surface);
 }
 
 static void
-sushi_font_widget_measure (GtkWidget      *widget,
-                           GtkOrientation  orientation,
-                           int             for_size,
-                           int            *minimum,
-                           int            *natural,
-                           int            *minimum_baseline,
-                           int            *natural_baseline)
+sushi_font_widget_measure (GtkWidget *widget,
+                           GtkOrientation orientation,
+                           int for_size,
+                           int *minimum,
+                           int *natural,
+                           int *minimum_baseline,
+                           int *natural_baseline)
 {
-  if (orientation == GTK_ORIENTATION_HORIZONTAL) {
-    sushi_font_widget_size_request (widget, &natural, NULL, NULL);
-    *minimum = 0;
-  } else {
-    sushi_font_widget_size_request (widget, NULL, &natural, &minimum);
-  }
+    if (orientation == GTK_ORIENTATION_HORIZONTAL) {
+        sushi_font_widget_size_request (widget, &natural, NULL, NULL);
+        *minimum = 0;
+    } else {
+        sushi_font_widget_size_request (widget, NULL, &natural, &minimum);
+    }
 }
 
 static void
-sushi_font_widget_snapshot (GtkWidget *drawing_area,
-                            GtkSnapshot *snapshot)
+sushi_font_widget_snapshot (GtkWidget *drawing_area, GtkSnapshot *snapshot)
 {
-  
-  SushiFontWidget *self = SUSHI_FONT_WIDGET (drawing_area);
-  g_autofree gint *sizes = NULL;
-  gint n_sizes, alpha_size, title_size, pos_y = 0, i;
-  cairo_font_face_t *font = NULL;
-  FT_Face face = self->face;
-  GtkStyleContext *context;
-  GdkRGBA color;
-  GtkBorder padding;
-  gint allocated_width, allocated_height;
 
-  if (face == NULL)
-    return;
+    SushiFontWidget *self = SUSHI_FONT_WIDGET (drawing_area);
+    g_autofree gint *sizes = NULL;
+    gint n_sizes, alpha_size, title_size, pos_y = 0, i;
+    cairo_font_face_t *font = NULL;
+    FT_Face face = self->face;
+    GtkStyleContext *context;
+    GdkRGBA color;
+    GtkBorder padding;
+    gint allocated_width, allocated_height;
 
-  context = gtk_widget_get_style_context (drawing_area);
+    if (face == NULL)
+        return;
 
-  allocated_width = gtk_widget_get_allocated_width (drawing_area);
-  allocated_height = gtk_widget_get_allocated_height (drawing_area);
+    context = gtk_widget_get_style_context (drawing_area);
 
-  graphene_rect_t* rect = graphene_rect_alloc();
-  graphene_rect_init(rect, 0, 0, allocated_width, allocated_height);
-    cairo_t* cr = gtk_snapshot_append_cairo (snapshot, rect);
-  gtk_render_background (context, cr,
-                         0, 0, allocated_width, allocated_height);
+    allocated_width = gtk_widget_get_allocated_width (drawing_area);
+    allocated_height = gtk_widget_get_allocated_height (drawing_area);
 
-  gtk_style_context_get_color (context, &color);
-  gtk_style_context_get_padding (context, &padding);
+    graphene_rect_t *rect = graphene_rect_alloc ();
+    graphene_rect_init (rect, 0, 0, allocated_width, allocated_height);
+    cairo_t *cr = gtk_snapshot_append_cairo (snapshot, rect);
+    gtk_render_background (context, cr, 0, 0, allocated_width,
+                           allocated_height);
 
-  gdk_cairo_set_source_rgba (cr, &color);
+    gtk_style_context_get_color (context, &color);
+    gtk_style_context_get_padding (context, &padding);
 
-  sizes = build_sizes_table (face, &n_sizes, &alpha_size, &title_size);
+    gdk_cairo_set_source_rgba (cr, &color);
 
-  font = cairo_ft_font_face_create_for_ft_face (face, 0);
+    sizes = build_sizes_table (face, &n_sizes, &alpha_size, &title_size);
 
-  /* draw text */
-  if (check_font_contain_text (face, self->font_name))
-    cairo_set_font_face (cr, font);
-  else
-    cairo_set_font_face (cr, NULL);
-
-  cairo_set_font_size (cr, title_size);
-  draw_string (self, cr, padding, self->font_name, &pos_y);
+    font = cairo_ft_font_face_create_for_ft_face (face, 0);
 
-  if (pos_y > allocated_height)
-    goto end;
+    /* draw text */
+    if (check_font_contain_text (face, self->font_name))
+        cairo_set_font_face (cr, font);
+    else
+        cairo_set_font_face (cr, NULL);
 
-  pos_y += SECTION_SPACING / 2;
-  cairo_set_font_face (cr, font);
-  cairo_set_font_size (cr, alpha_size);
+    cairo_set_font_size (cr, title_size);
+    draw_string (self, cr, padding, self->font_name, &pos_y);
 
-  if (self->lowercase_text != NULL)
-    draw_string (self, cr, padding, self->lowercase_text, &pos_y);
-  if (pos_y > allocated_height)
-    goto end;
+    if (pos_y > allocated_height)
+        goto end;
 
-  if (self->uppercase_text != NULL)
-    draw_string (self, cr, padding, self->uppercase_text, &pos_y);
-  if (pos_y > allocated_height)
-    goto end;
+    pos_y += SECTION_SPACING / 2;
+    cairo_set_font_face (cr, font);
+    cairo_set_font_size (cr, alpha_size);
 
-  if (self->punctuation_text != NULL)
-    draw_string (self, cr, padding, self->punctuation_text, &pos_y);
-  if (pos_y > allocated_height)
-    goto end;
+    if (self->lowercase_text != NULL)
+        draw_string (self, cr, padding, self->lowercase_text, &pos_y);
+    if (pos_y > allocated_height)
+        goto end;
 
-  pos_y += SECTION_SPACING;
+    if (self->uppercase_text != NULL)
+        draw_string (self, cr, padding, self->uppercase_text, &pos_y);
+    if (pos_y > allocated_height)
+        goto end;
 
-  for (i = 0; i < n_sizes; i++) {
-    cairo_set_font_size (cr, sizes[i]);
-    if (self->sample_string !=  NULL)
-      draw_string (self, cr, padding, self->sample_string, &pos_y);
+    if (self->punctuation_text != NULL)
+        draw_string (self, cr, padding, self->punctuation_text, &pos_y);
     if (pos_y > allocated_height)
-      break;
-  }
+        goto end;
+
+    pos_y += SECTION_SPACING;
+
+    for (i = 0; i < n_sizes; i++) {
+        cairo_set_font_size (cr, sizes[i]);
+        if (self->sample_string != NULL)
+            draw_string (self, cr, padding, self->sample_string, &pos_y);
+        if (pos_y > allocated_height)
+            break;
+    }
 
- end:
-  cairo_font_face_destroy (font);
+end:
+    cairo_font_face_destroy (font);
 }
 
 static void
@@ -663,171 +667,153 @@ font_face_async_ready_cb (GObject *object,
                           GAsyncResult *result,
                           gpointer user_data)
 {
-  SushiFontWidget *self = user_data;
-  g_autoptr(GError) error = NULL;
+    SushiFontWidget *self = user_data;
+    g_autoptr (GError) error = NULL;
 
-  self->face =
-    sushi_new_ft_face_from_uri_finish (result,
-                                       &self->face_contents,
-                                       &error);
+    self->face = sushi_new_ft_face_from_uri_finish (
+        result, &self->face_contents, &error);
 
-  if (error != NULL) {
-    g_signal_emit (self, signals[ERROR], 0, error);
-    g_print ("Can't load the font face: %s\n", error->message);
+    if (error != NULL) {
+        g_signal_emit (self, signals[ERROR], 0, error);
+        g_print ("Can't load the font face: %s\n", error->message);
 
-    return;
-  }
+        return;
+    }
 
-  build_strings_for_face (self);
+    build_strings_for_face (self);
 
-  gtk_widget_queue_resize (GTK_WIDGET (self));
-  g_signal_emit (self, signals[LOADED], 0);
+    gtk_widget_queue_resize (GTK_WIDGET (self));
+    g_signal_emit (self, signals[LOADED], 0);
 }
 
 void
 sushi_font_widget_load (SushiFontWidget *self)
 {
-  sushi_new_ft_face_from_uri_async (self->library,
-                                    self->uri,
-                                    self->face_index,
-                                    font_face_async_ready_cb,
-                                    self);
+    sushi_new_ft_face_from_uri_async (self->library, self->uri,
+                                      self->face_index,
+                                      font_face_async_ready_cb, self);
 }
 
 static void
 sushi_font_widget_init (SushiFontWidget *self)
 {
-  FT_Error err = FT_Init_FreeType (&self->library);
+    FT_Error err = FT_Init_FreeType (&self->library);
 
-  if (err != FT_Err_Ok)
-    g_error ("Unable to initialize FreeType");
+    if (err != FT_Err_Ok)
+        g_error ("Unable to initialize FreeType");
 }
 
 static void
 sushi_font_widget_get_property (GObject *object,
-                                guint       prop_id,
-                                GValue     *value,
+                                guint prop_id,
+                                GValue *value,
                                 GParamSpec *pspec)
 {
-  SushiFontWidget *self = SUSHI_FONT_WIDGET (object);
-
-  switch (prop_id) {
-  case PROP_URI:
-    g_value_set_string (value, self->uri);
-    break;
-  case PROP_FACE_INDEX:
-    g_value_set_int (value, self->face_index);
-    break;
-  default:
-    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-    break;
-  }
+    SushiFontWidget *self = SUSHI_FONT_WIDGET (object);
+
+    switch (prop_id) {
+    case PROP_URI:
+        g_value_set_string (value, self->uri);
+        break;
+    case PROP_FACE_INDEX:
+        g_value_set_int (value, self->face_index);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+    }
 }
 
 static void
 sushi_font_widget_set_property (GObject *object,
-                               guint       prop_id,
-                               const GValue *value,
-                               GParamSpec *pspec)
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
 {
-  SushiFontWidget *self = SUSHI_FONT_WIDGET (object);
-
-  switch (prop_id) {
-  case PROP_URI:
-    self->uri = g_value_dup_string (value);
-    break;
-  case PROP_FACE_INDEX:
-    self->face_index = g_value_get_int (value);
-    break;
-  default:
-    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-    break;
-  }
+    SushiFontWidget *self = SUSHI_FONT_WIDGET (object);
+
+    switch (prop_id) {
+    case PROP_URI:
+        self->uri = g_value_dup_string (value);
+        break;
+    case PROP_FACE_INDEX:
+        self->face_index = g_value_get_int (value);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+    }
 }
 
 static void
 sushi_font_widget_finalize (GObject *object)
 {
-  SushiFontWidget *self = SUSHI_FONT_WIDGET (object);
+    SushiFontWidget *self = SUSHI_FONT_WIDGET (object);
 
-  g_free (self->uri);
+    g_free (self->uri);
 
-  if (self->face != NULL) {
-    FT_Done_Face (self->face);
-    self->face = NULL;
-  }
+    if (self->face != NULL) {
+        FT_Done_Face (self->face);
+        self->face = NULL;
+    }
 
-  g_free (self->font_name);
-  g_free (self->sample_string);
-  g_free (self->face_contents);
+    g_free (self->font_name);
+    g_free (self->sample_string);
+    g_free (self->face_contents);
 
-  if (self->library != NULL) {
-    FT_Done_FreeType (self->library);
-    self->library = NULL;
-  }
+    if (self->library != NULL) {
+        FT_Done_FreeType (self->library);
+        self->library = NULL;
+    }
 
-  G_OBJECT_CLASS (sushi_font_widget_parent_class)->finalize (object);
+    G_OBJECT_CLASS (sushi_font_widget_parent_class)->finalize (object);
 }
 
 static void
 sushi_font_widget_constructed (GObject *object)
 {
-  SushiFontWidget *self = SUSHI_FONT_WIDGET (object);
+    SushiFontWidget *self = SUSHI_FONT_WIDGET (object);
 
-  sushi_font_widget_load (self);
+    sushi_font_widget_load (self);
 
-  G_OBJECT_CLASS (sushi_font_widget_parent_class)->constructed (object);
+    G_OBJECT_CLASS (sushi_font_widget_parent_class)->constructed (object);
 }
 
 static void
 sushi_font_widget_class_init (SushiFontWidgetClass *klass)
 {
-  GObjectClass *oclass = G_OBJECT_CLASS (klass);
-  GtkWidgetClass *wclass = GTK_WIDGET_CLASS (klass);
-
-  oclass->finalize = sushi_font_widget_finalize;
-  oclass->set_property = sushi_font_widget_set_property;
-  oclass->get_property = sushi_font_widget_get_property;
-  oclass->constructed = sushi_font_widget_constructed;
-
-  wclass->snapshot = sushi_font_widget_snapshot;
-  wclass->measure = sushi_font_widget_measure;
-
-  properties[PROP_URI] =
-    g_param_spec_string ("uri",
-                         "Uri", "Uri",
-                         NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
-  properties[PROP_FACE_INDEX] =
-    g_param_spec_int ("face-index",
-                      "Face index", "Face index",
-                      0, G_MAXINT,
-                      0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
-
-  signals[LOADED] =
-    g_signal_new ("loaded",
-                  G_TYPE_FROM_CLASS (klass),
-                  G_SIGNAL_RUN_FIRST,
-                  0, NULL, NULL,
-                  g_cclosure_marshal_VOID__VOID,
-                  G_TYPE_NONE, 0);
-  signals[ERROR] =
-    g_signal_new ("error",
-                  G_TYPE_FROM_CLASS (klass),
-                  G_SIGNAL_RUN_FIRST,
-                  0, NULL, NULL,
-                  g_cclosure_marshal_VOID__STRING,
-                  G_TYPE_NONE, 1, G_TYPE_ERROR);
-
-  g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
+    GObjectClass *oclass = G_OBJECT_CLASS (klass);
+    GtkWidgetClass *wclass = GTK_WIDGET_CLASS (klass);
+
+    oclass->finalize = sushi_font_widget_finalize;
+    oclass->set_property = sushi_font_widget_set_property;
+    oclass->get_property = sushi_font_widget_get_property;
+    oclass->constructed = sushi_font_widget_constructed;
+
+    wclass->snapshot = sushi_font_widget_snapshot;
+    wclass->measure = sushi_font_widget_measure;
+
+    properties[PROP_URI] = g_param_spec_string (
+        "uri", "Uri", "Uri", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
+    properties[PROP_FACE_INDEX] =
+        g_param_spec_int ("face-index", "Face index", "Face index", 0, G_MAXINT,
+                          0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
+
+    signals[LOADED] = g_signal_new (
+        "loaded", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
+        g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+    signals[ERROR] = g_signal_new (
+        "error", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
+        g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_ERROR);
+
+    g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
 }
 
 SushiFontWidget *
 sushi_font_widget_new (const gchar *uri, gint face_index)
 {
-  return g_object_new (SUSHI_TYPE_FONT_WIDGET,
-                       "uri", uri,
-                       "face-index", face_index,
-                       NULL);
+    return g_object_new (SUSHI_TYPE_FONT_WIDGET, "uri", uri, "face-index",
+                         face_index, NULL);
 }
 
 /**
@@ -837,11 +823,11 @@ sushi_font_widget_new (const gchar *uri, gint face_index)
 FT_Face
 sushi_font_widget_get_ft_face (SushiFontWidget *self)
 {
-  return self->face;
+    return self->face;
 }
 
 const gchar *
 sushi_font_widget_get_uri (SushiFontWidget *self)
 {
-  return self->uri;
+    return self->uri;
 }
diff --git a/src/sushi-font-widget.h b/src/sushi-font-widget.h
index 9c7b556..a78ed34 100644
--- a/src/sushi-font-widget.h
+++ b/src/sushi-font-widget.h
@@ -26,18 +26,17 @@
 #ifndef __SUSHI_FONT_WIDGET_H__
 #define __SUSHI_FONT_WIDGET_H__
 
+#include <cairo/cairo-ft.h>
 #include <glib-object.h>
 #include <gtk/gtk.h>
-#include <cairo/cairo-ft.h>
 #include <hb-ft.h>
 
 G_BEGIN_DECLS
 
 #define SUSHI_TYPE_FONT_WIDGET (sushi_font_widget_get_type ())
 
-G_DECLARE_FINAL_TYPE (SushiFontWidget, sushi_font_widget,
-                      SUSHI, FONT_WIDGET,
-                      GtkDrawingArea)
+G_DECLARE_FINAL_TYPE (
+    SushiFontWidget, sushi_font_widget, SUSHI, FONT_WIDGET, GtkDrawingArea)
 
 SushiFontWidget *sushi_font_widget_new (const gchar *uri, gint face_index);
 


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