+ /* font family selector */
+ family_selector = hildon_touch_selector_new_text ();
+ gtk_box_pack_start (GTK_BOX (hbox), family_selector, TRUE, TRUE, 0);
+
+ pango_context_list_families (gtk_widget_get_pango_context (GTK_WIDGET (dialog)),
+ &families, &n_families);
+
+ filter_out_internal_fonts (families, &n_families);
+
+ qsort (families, n_families, sizeof(PangoFontFamily *), cmp_families);
+
+ for (index = 0; index < n_families; index++) {
+ const gchar *family = pango_font_family_get_name (families[index]);
+ hildon_touch_selector_insert_text (HILDON_TOUCH_SELECTOR (family_selector),
+ index, family);
+
+ if (strcmp (family, pango_font_description_get_family (font_desc)) == 0) {
+ hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (family_selector), 0,
+ index);
+ hildon_touch_selector_center_on_selected (HILDON_TOUCH_SELECTOR (family_selector));
+ }
+ }
+ g_free (families);
+
+ /* font style selector */
+ style_selector = hildon_touch_selector_new_text ();
+ gtk_box_pack_start (GTK_BOX (hbox), style_selector, TRUE, TRUE, 0);
+
+ index = 0;
+ while (index < FONT_STYLE_LAST) {
+ const gchar *style = g_strdup_printf ("%s", _(font_styles[index].name));
+ hildon_touch_selector_insert_text (HILDON_TOUCH_SELECTOR (style_selector),
+ font_styles[index].index, style);
+ index++;
+ }
+ pango_weight = pango_font_description_get_weight (font_desc);
+ pango_style = pango_font_description_get_style (font_desc);
+
+ if (pango_weight == PANGO_WEIGHT_NORMAL) {
+ if (pango_style == PANGO_STYLE_NORMAL) {
+ hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (style_selector), 0,
+ FONT_STYLE_REGULAR);
+ } else {
+ hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (style_selector), 0,
+ FONT_STYLE_ITALIC);
+ }
+ } else {
+ if (pango_style == PANGO_STYLE_NORMAL) {
+ hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (style_selector), 0,
+ FONT_STYLE_BOLD);
+ } else {
+ hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (style_selector), 0,
+ FONT_STYLE_ITALIC_BOLD);
+ }
+ }
+ hildon_touch_selector_center_on_selected (HILDON_TOUCH_SELECTOR (style_selector));
+
+ /* font size selector */
+ size_selector = hildon_touch_selector_new_text ();
+ gtk_box_pack_start (GTK_BOX (hbox), size_selector, TRUE, TRUE, 0);
+
+ index = 0;
+ while (font_sizes[index] != -1) {
+ const gchar *size = g_strdup_printf ("%d", font_sizes[index]);
+ hildon_touch_selector_insert_text (HILDON_TOUCH_SELECTOR (size_selector),
+ index, size);
+
+ if (font_sizes[index] == (pango_font_description_get_size (font_desc) / PANGO_SCALE)) {
+ hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (size_selector), 0,
+ index);
+ hildon_touch_selector_center_on_selected (HILDON_TOUCH_SELECTOR (size_selector));
+ }
+
+ index++;
+ }