/*
* This file is part of hildon-libs
*
- * Copyright (C) 2005 Nokia Corporation.
+ * Copyright (C) 2005, 2006 Nokia Corporation.
*
- * Contact: Luc Pionchon <luc.pionchon@nokia.com>
+ * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
+ * as published by the Free Software Foundation; version 2.1 of
+ * the License.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
#define _(String) dgettext(PACKAGE, String)
#define SUPERSCRIPT_RISE 3333
-#define SUBSCRIPT_LOW -3333
-#define ON_BIT 0x01
+#define SUBSCRIPT_LOW -3333
+#define ON_BIT 0x01
#define OFF_BIT 0x02
-#define REFERENCE_LINE "Reference: " /*localized string?*/
/*
* These are what we use as the standard font sizes, for the size list.
g_value_set_string(value,
pango_font_family_get_name(priv->families[i]));
else
- g_value_set_string(value, "Nokia Sans");
+ g_value_set_string(value, "Sans");
break;
case PROP_FAMILY_SET:
g_object_class_install_property(gobject_class, PROP_FAMILY,
g_param_spec_string("family",
"Font family", "String defines"
- " the font family", "Nokia Sans",
+ " the font family", "Sans",
G_PARAM_READWRITE));
g_object_class_install_property(gobject_class, PROP_FAMILY_SET,
GTK_RESPONSE_ACCEPT,
NULL);
- str = g_strconcat(REFERENCE_LINE, priv->preview_text, 0);
+ str = g_strconcat(_("ecdg_fi_preview_font_preview_reference"),
+ priv->preview_text, 0);
preview_label = gtk_label_new(str);
gtk_label_set_line_wrap(GTK_LABEL(preview_label), TRUE);
/*Set the font*/
list = hildon_font_selection_dialog_create_attrlist(fontsel,
- strlen(REFERENCE_LINE),
+ strlen(_("ecdg_fi_preview_font_preview_reference")),
strlen(priv->preview_text));
g_object_get(G_OBJECT(fontsel), "family", &str, "family-set",
if(family_set)
{
attr = pango_attr_family_new(str);
- add_preview_text_attr(list, attr, 0, strlen(REFERENCE_LINE));
+ add_preview_text_attr(list, attr, 0, strlen(_("ecdg_fi_preview_font_preview_reference")));
}
g_free(str);
if(size_set)
{
attr = pango_attr_size_new(size * PANGO_SCALE);
- add_preview_text_attr(list, attr, 0, strlen(REFERENCE_LINE));
+ add_preview_text_attr(list, attr, 0, strlen(_("ecdg_fi_preview_font_preview_reference")));
}
gtk_label_set_attributes(GTK_LABEL(preview_label), list);
gtk_widget_destroy(preview_dialog);
}
+
+static gboolean is_internal_font(const gchar * name){
+ return strcmp(name, "DeviceSymbols") == 0
+ || strcmp(name, "Nokia Smiley" ) == 0
+ || strcmp(name, "Nokia Sans" ) == 0
+ || strcmp(name, "Nokia Sans Cn") == 0;
+}
+
+static void filter_out_internal_fonts(PangoFontFamily **families, int *n_families){
+ int i;
+ int n; /* counts valid fonts */
+ const gchar * name = NULL;
+
+ for(i = 0, n = 0; i < *n_families; i++){
+
+ name = pango_font_family_get_name(families[i]);
+
+ if(!is_internal_font(name)){
+
+ if(i!=n){ /* there are filtered out families */
+ families[n] = families[i]; /* shift the current family */
+ }
+
+ n++; /* count one more valid */
+ }
+ }/* foreach font family */
+
+ *n_families = n;
+}
+
+
static void
hildon_font_selection_dialog_show_available_fonts(HildonFontSelectionDialog
*fontsel)
(GTK_WIDGET(fontsel)), &priv->families,
&priv->n_families);
+ filter_out_internal_fonts(priv->families, &priv->n_families);
+
qsort(priv->families, priv->n_families, sizeof(PangoFontFamily *),
cmp_families);