From 124c11b99a9bb77625d3ba2b600804b280d510e3 Mon Sep 17 00:00:00 2001 From: Hans Petter Jansson Date: Tue, 4 Feb 2003 21:03:28 +0000 Subject: Use PangoLayout to draw text. 2003-02-04 Hans Petter Jansson * gui/e-meeting-time-sel-item.c (e_meeting_time_selector_item_paint_day_top): Use PangoLayout to draw text. svn path=/trunk/; revision=19743 --- calendar/gui/e-meeting-time-sel-item.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/e-meeting-time-sel-item.c b/calendar/gui/e-meeting-time-sel-item.c index 7476ff694a..c41ac87409 100644 --- a/calendar/gui/e-meeting-time-sel-item.c +++ b/calendar/gui/e-meeting-time-sel-item.c @@ -408,16 +408,17 @@ e_meeting_time_selector_item_paint_day_top (EMeetingTimeSelectorItem *mts_item, { EMeetingTimeSelector *mts; GdkGC *gc; - GdkFont *font; gint y, grid_x; gchar buffer[128], *format; gint hour, hour_x, hour_y; GdkRectangle clip_rect; + PangoLayout *layout; mts = mts_item->mts; gc = mts_item->main_gc; gdk_gc_set_foreground (gc, &mts->grid_color); + layout = gtk_widget_create_pango_layout (GTK_WIDGET (mts), NULL); /* Draw the horizontal lines. */ y = mts->row_height - 1 - scroll_y; @@ -430,7 +431,6 @@ e_meeting_time_selector_item_paint_day_top (EMeetingTimeSelectorItem *mts_item, y += mts->row_height; gdk_draw_line (drawable, gc, x, y, x + mts->day_width - 1, y); - /* Draw the vertical grid lines. */ for (grid_x = mts->col_width - 1; grid_x < mts->day_width - mts->col_width; @@ -446,7 +446,6 @@ e_meeting_time_selector_item_paint_day_top (EMeetingTimeSelectorItem *mts_item, /* Draw the date. Set a clipping rectangle so we don't draw over the next day. */ - font = gtk_style_get_font (gtk_widget_get_style (GTK_WIDGET (mts))); if (mts->date_format == E_MEETING_TIME_SELECTOR_DATE_FULL) /* This is a strftime() format string %A = full weekday name, %B = full month name, %d = month day, %Y = full year. */ @@ -467,27 +466,33 @@ e_meeting_time_selector_item_paint_day_top (EMeetingTimeSelectorItem *mts_item, clip_rect.width = mts->day_width - 2; clip_rect.height = mts->row_height - 2; gdk_gc_set_clip_rectangle (gc, &clip_rect); - gdk_draw_string (drawable, font, gc, - x + 2, 4 + font->ascent - scroll_y, buffer); + pango_layout_set_text (layout, buffer, -1); + gdk_draw_layout (drawable, gc, + x + 2, + 4 - scroll_y, + layout); gdk_gc_set_clip_rectangle (gc, NULL); /* Draw the hours. */ hour = mts->first_hour_shown; hour_x = x + 2; - hour_y = mts->row_height + 4 + font->ascent - scroll_y; + hour_y = mts->row_height + 4 - scroll_y; while (hour < mts->last_hour_shown) { if (calendar_config_get_24_hour_format ()) - gdk_draw_string (drawable, font, gc, - hour_x, hour_y, - EMeetingTimeSelectorHours[hour]); + pango_layout_set_text (layout, EMeetingTimeSelectorHours [hour], -1); else - gdk_draw_string (drawable, font, gc, - hour_x, hour_y, - EMeetingTimeSelectorHours12[hour]); + pango_layout_set_text (layout, EMeetingTimeSelectorHours12 [hour], -1); + + gdk_draw_layout (drawable, gc, + hour_x, + hour_y, + layout); hour += mts->zoomed_out ? 3 : 1; hour_x += mts->col_width; } + + g_object_unref (layout); } -- cgit v1.2.3