+/*Internal function: queries a text tag for the value of a given style hint */
+static gint
+query_tag(GtkTextTag *tag, glui32 hint)
+{
+ gint intval;
+ GObject *objval;
+ GdkColor *colval;
+
+ g_return_val_if_fail(tag != NULL, 0);
+
+ ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key);
+
+ switch(hint) {
+ case stylehint_Indentation:
+ g_object_get(tag, "left_margin", &intval, NULL);
+ return intval/5;
+ break;
+
+ case stylehint_ParaIndentation:
+ g_object_get(tag, "indent", &intval, NULL);
+ return intval/5;
+ break;
+
+ case stylehint_Justification:
+ g_object_get(tag, "justification", &intval, NULL);
+ switch(intval) {
+ case GTK_JUSTIFY_LEFT: return stylehint_just_LeftFlush; break;
+ case GTK_JUSTIFY_FILL: return stylehint_just_LeftRight; break;
+ case GTK_JUSTIFY_CENTER: return stylehint_just_Centered; break;
+ case GTK_JUSTIFY_RIGHT: return stylehint_just_RightFlush; break;
+ default:
+ WARNING("Unknown justification");
+ return stylehint_just_LeftFlush;
+ }
+ break;
+
+ case stylehint_Weight:
+ g_object_get(tag, "weight", &intval, NULL);
+ switch(intval) {
+ case PANGO_WEIGHT_LIGHT: return -1; break;
+ case PANGO_WEIGHT_NORMAL: return 0; break;
+ case PANGO_WEIGHT_BOLD: return 1; break;
+ default: WARNING("Unknown font weight"); return 0;
+ }
+ break;
+
+ case stylehint_Size:
+ g_object_get(tag, "size", &intval, NULL);
+ return (intval/2)-14;
+ break;
+
+ case stylehint_Oblique:
+ g_object_get(tag, "style", &intval , NULL);
+ return intval == PANGO_STYLE_ITALIC ? 1 : 0;
+ break;
+
+ case stylehint_Proportional:
+ g_object_get(tag, "font-desc", &objval, NULL);
+ return objval == (GObject *)glk_data->monospace_font_desc ? 0 : 1;
+ break;
+
+ case stylehint_TextColor:
+ g_object_get(tag, "foreground-gdk", &colval, NULL);
+ return color_parse_gdk(colval);
+ break;
+
+ case stylehint_BackColor:
+ g_object_get(tag, "background-gdk", &colval, NULL);
+ return color_parse_gdk(colval);
+ break;
+
+ case stylehint_ReverseColor:
+ /* FIXME: implement this */
+ return 0;
+ break;
+
+ default:
+ WARNING("Unknown style hint");
+ }
+
+ return 0;
+}