aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-19 00:49:42 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-19 00:49:42 -0400
commitce218291ff3f32d262a35c8e67d789f65cbe9476 (patch)
tree8c188a78ad54e9f8fcacf3cd3478935793350109
parentf06801d704848e64856a3cb6b7ad0f4612d086ad (diff)
downloadrunes-ce218291ff3f32d262a35c8e67d789f65cbe9476.tar.gz
runes-ce218291ff3f32d262a35c8e67d789f65cbe9476.zip
restore bold and italic functionality
-rw-r--r--display.c27
-rw-r--r--term.h2
2 files changed, 17 insertions, 12 deletions
diff --git a/display.c b/display.c
index ebc4e22..507242c 100644
--- a/display.c
+++ b/display.c
@@ -66,6 +66,7 @@ void runes_display_set_window_size(RunesTerm *t)
}
else {
t->layout = pango_cairo_create_layout(t->cr);
+ pango_layout_set_attributes(t->layout, pango_attr_list_new());
}
pango_layout_set_font_description(
t->layout, pango_font_description_from_string(t->font_name));
@@ -267,38 +268,44 @@ void runes_display_reset_text_attributes(RunesTerm *t)
void runes_display_set_bold(RunesTerm *t)
{
- t->font_bold = 1;
- runes_display_recalculate_font_metrics(t);
+ PangoAttrList *attrs;
+
+ attrs = pango_layout_get_attributes(t->layout);
+ pango_attr_list_change(attrs, pango_attr_weight_new(PANGO_WEIGHT_BOLD));
}
void runes_display_reset_bold(RunesTerm *t)
{
- t->font_bold = 0;
- runes_display_recalculate_font_metrics(t);
+ PangoAttrList *attrs;
+
+ attrs = pango_layout_get_attributes(t->layout);
+ pango_attr_list_change(attrs, pango_attr_weight_new(PANGO_WEIGHT_NORMAL));
}
void runes_display_set_italic(RunesTerm *t)
{
- t->font_italic = 1;
- runes_display_recalculate_font_metrics(t);
+ PangoAttrList *attrs;
+
+ attrs = pango_layout_get_attributes(t->layout);
+ pango_attr_list_change(attrs, pango_attr_style_new(PANGO_STYLE_ITALIC));
}
void runes_display_reset_italic(RunesTerm *t)
{
- t->font_italic = 0;
- runes_display_recalculate_font_metrics(t);
+ PangoAttrList *attrs;
+
+ attrs = pango_layout_get_attributes(t->layout);
+ pango_attr_list_change(attrs, pango_attr_style_new(PANGO_STYLE_NORMAL));
}
void runes_display_set_underline(RunesTerm *t)
{
t->font_underline = 1;
- runes_display_recalculate_font_metrics(t);
}
void runes_display_reset_underline(RunesTerm *t)
{
t->font_underline = 0;
- runes_display_recalculate_font_metrics(t);
}
void runes_display_set_fg_color(RunesTerm *t, cairo_pattern_t *color)
diff --git a/term.h b/term.h
index 224103d..15b144f 100644
--- a/term.h
+++ b/term.h
@@ -33,8 +33,6 @@ struct runes_term {
char *font_name;
PangoLayout *layout;
- char font_italic;
- char font_bold;
char font_underline;
char hide_cursor;