diff options
author | 2010-08-11 20:59:59 +0200 | |
---|---|---|
committer | 2010-08-11 20:59:59 +0200 | |
commit | 36b14449d71b14e29358560894d6ed94d7adedc1 (patch) | |
tree | ea802b8817c3984e3b6cc6c8058f95e5f6df861c | |
parent | f4bea1b47ad7cf1a1e1c1cecaf47d78583abcf64 (diff) |
fixed bold font text drawing bug
-rw-r--r-- | plugins/gtkui/drawing.h | 3 | ||||
-rw-r--r-- | plugins/gtkui/gdkdrawing.c | 8 | ||||
-rw-r--r-- | plugins/gtkui/plcommon.c | 3 |
3 files changed, 14 insertions, 0 deletions
diff --git a/plugins/gtkui/drawing.h b/plugins/gtkui/drawing.h index 82ab55c3..e8c7e99d 100644 --- a/plugins/gtkui/drawing.h +++ b/plugins/gtkui/drawing.h @@ -66,6 +66,9 @@ void draw_init_font_bold (void); void +draw_init_font_normal (void); + +void draw_text (float x, float y, int width, int align, const char *text); void diff --git a/plugins/gtkui/gdkdrawing.c b/plugins/gtkui/gdkdrawing.c index b914b70b..27174fa7 100644 --- a/plugins/gtkui/gdkdrawing.c +++ b/plugins/gtkui/gdkdrawing.c @@ -92,6 +92,7 @@ draw_rect (float x, float y, float w, float h, int fill) { } static GtkStyle *font_style = NULL; +static PangoWeight font_weight = PANGO_WEIGHT_NORMAL; void draw_init_font (GtkStyle *new_font_style) { @@ -111,6 +112,7 @@ draw_init_font (GtkStyle *new_font_style) { pangolayout = pango_layout_new (pangoctx); pango_layout_set_ellipsize (pangolayout, PANGO_ELLIPSIZE_END); PangoFontDescription *desc = font_style->font_desc; + font_weight = pango_font_description_get_weight (desc); pango_layout_set_font_description (pangolayout, desc); pango_ready = 1; } @@ -128,6 +130,12 @@ draw_init_font_bold (void) { pango_font_description_free(desc); } +void +draw_init_font_normal (void) { + pango_font_description_set_weight (font_style->font_desc, font_weight); + pango_layout_set_font_description (pangolayout, font_style->font_desc); +} + float draw_get_font_size (void) { diff --git a/plugins/gtkui/plcommon.c b/plugins/gtkui/plcommon.c index 3a8249e5..02b41a87 100644 --- a/plugins/gtkui/plcommon.c +++ b/plugins/gtkui/plcommon.c @@ -183,6 +183,9 @@ void draw_column_data (DdbListview *listview, GdkDrawable *drawable, DdbListview else { draw_text (x + 5, y + height/2 - draw_get_font_size ()/2 - 2, cwidth-10, 0, text); } + if (gtkui_embolden_current_track && it && it == playing_track) { + draw_init_font_normal (); + } } if (playing_track) { deadbeef->pl_item_unref (playing_track); |