#include <stdio.h>
#include <string.h>
+#include <math.h>
#include "chimara-glk-private.h"
#include "glk.h"
#include "style.h"
_COPY_FLAG (invisible_set);
_COPY_FLAG (editable_set);
_COPY_FLAG (language_set);
+ _COPY_FLAG (scale_set);
#undef _COPY_FLAG
/* Copy the data that was added manually */
tag = gtk_text_tag_new("header");
//g_object_set(tag, "font-desc", default_font_desc, "size-points", 18.0, "weight", PANGO_WEIGHT_BOLD, NULL);
- g_object_set(tag, "size-points", 18.0, "weight", PANGO_WEIGHT_BOLD, NULL);
+ g_object_set(tag, "weight", PANGO_WEIGHT_BOLD, NULL);
g_hash_table_insert(default_text_buffer_styles, "header", tag);
tag = gtk_text_tag_new("subheader");
//g_object_set(tag, "font-desc", default_font_desc, "size-points", 14.0, "weight", PANGO_WEIGHT_BOLD, NULL);
- g_object_set(tag, "size-points", 14.0, "weight", PANGO_WEIGHT_BOLD, NULL);
+ g_object_set(tag, "weight", PANGO_WEIGHT_BOLD, NULL);
g_hash_table_insert(default_text_buffer_styles, "subheader", tag);
tag = gtk_text_tag_new("alert");
break;
case stylehint_Size:
- g_object_set(tag_object, "size", 14+(2*val), "size-set", TRUE, NULL);
+ {
+ gdouble scale = PANGO_SCALE_MEDIUM;
+ switch(val) {
+ case -3: scale = PANGO_SCALE_XX_SMALL; break;
+ case -2: scale = PANGO_SCALE_X_SMALL; break;
+ case -1: scale = PANGO_SCALE_SMALL; break;
+ case 0: scale = PANGO_SCALE_MEDIUM; break;
+ case 1: scale = PANGO_SCALE_LARGE; break;
+ case 2: scale = PANGO_SCALE_X_LARGE; break;
+ case 3: scale = PANGO_SCALE_XX_LARGE; break;
+ default:
+ /* We follow Pango's convention of having each magnification
+ step be a scaling of 1.2 */
+ scale = pow(1.2, (double)val);
+ }
+ g_printerr("Setting tag to %f\n", scale);
+ g_object_set(tag_object, "scale", scale, "scale-set", TRUE, NULL);
+ }
break;
case stylehint_Oblique:
gchar *font_family;
GtkTextTag *font_tag = g_hash_table_lookup(
wintype == wintype_TextBuffer? glk_data->styles->text_buffer : glk_data->styles->text_grid,
- val? "normal" : "preformatted");
+ val? "default" : "preformatted");
g_object_get(font_tag, "family", &font_family, NULL);
g_object_set(tag_object, "family", font_family, "family-set", TRUE, NULL);
g_free(font_family);
query_tag(GtkTextTag *tag, glui32 wintype, glui32 hint)
{
gint intval;
+ gdouble doubleval;
GdkColor *colval;
g_return_val_if_fail(tag != NULL, 0);
}
case stylehint_Size:
- g_object_get(tag, "size", &intval, NULL);
- return (intval/2)-14;
+ g_object_get(tag, "scale", &doubleval, NULL);
+ return (gint)round(log(doubleval) / log(1.2));
case stylehint_Oblique:
g_object_get(tag, "style", &intval , NULL);