+
+/* Internal function copying the attributes of a text tag to a pango attribute list */
+static void
+text_tag_to_attr_list(GtkTextTag *tag, PangoAttrList *list)
+{
+ gboolean set;
+ GdkColor *foreground, *background;
+ gchar *string;
+ PangoFontDescription *font_desc;
+ gboolean strikethrough;
+ PangoUnderline underline;
+
+ g_object_get(tag, "foreground-set", &set, "foreground-gdk", &foreground, NULL);
+ if(set) {
+ pango_attr_list_insert(
+ list,
+ pango_attr_foreground_new(foreground->red, foreground->green, foreground->blue)
+ );
+ }
+ g_object_get(tag, "background-set", &set, "background-gdk", &background, NULL);
+ if(set) {
+ pango_attr_list_insert(
+ list,
+ pango_attr_background_new(background->red, background->green, background->blue)
+ );
+ }
+ g_object_get(tag, "language-set", &set, "language", &string, NULL);
+ if(set) {
+ pango_attr_list_insert(
+ list,
+ pango_attr_language_new( pango_language_from_string(string) )
+ );
+ }
+
+ /* Font description updates the following properties simultaniously:
+ * family, style, weight, variant, stretch, size
+ */
+ g_object_get(tag, "font-desc", &font_desc, NULL);
+ pango_attr_list_insert(
+ list,
+ pango_attr_font_desc_new(font_desc)
+ );
+
+ g_object_get(tag, "strikethrough-set", &set, "strikethrough", &strikethrough, NULL);
+ if(set) {
+ pango_attr_list_insert(
+ list,
+ pango_attr_strikethrough_new(strikethrough)
+ );
+ }
+ g_object_get(tag, "underline-set", &set, "underline", &underline, NULL);
+ if(set) {
+ pango_attr_list_insert(
+ list,
+ pango_attr_underline_new(underline)
+ );
+ }
+}