diff options
author | Hans Petter Jansson <hpj@ximian.com> | 2003-04-02 11:08:29 +0800 |
---|---|---|
committer | Hans Petter <hansp@src.gnome.org> | 2003-04-02 11:08:29 +0800 |
commit | c8e1c20b8a6b5ba84785ef63fcb4c2f4224dd0bc (patch) | |
tree | a665be846430589993d9cf01e7d0151d3f121df1 /calendar/gui/weekday-picker.c | |
parent | 9f06cc49809acd03ce9367d6851f9f217bd33d27 (diff) | |
download | gsoc2013-evolution-c8e1c20b8a6b5ba84785ef63fcb4c2f4224dd0bc.tar.gz gsoc2013-evolution-c8e1c20b8a6b5ba84785ef63fcb4c2f4224dd0bc.tar.zst gsoc2013-evolution-c8e1c20b8a6b5ba84785ef63fcb4c2f4224dd0bc.zip |
Nuke GdkFont and use Pango's font measuring.
2003-04-01 Hans Petter Jansson <hpj@ximian.com>
* gui/e-day-view-main-item.c (e_day_view_main_item_draw):
Nuke GdkFont and use Pango's font measuring.
* gui/e-day-view-time-itme.c (e_day_view_time_item_get_column_width)
(e_day_view_time_item_draw): Ditto.
* gui/e-day-view-top-item.c (e_day_view_top_item_draw)
(e_day_view_top_item_draw_long_event): Ditto.
* gui/e-day-view.c (e_day_view_style_set)
(e_day_view_recalc_cell_sizes)
(e_day_view_reshape_long_event)
(e_day_view_update_top_canvas_drag)
(e_day_view_update_main_canvas_drag): Ditto.
* gui/e-meeting-time-sel.c (e_meeting_time_selector_style_set)
(e_meeting_time_selector_recalc_date_form): Ditto.
* gui/e-week-view-event-item.c (e_week_view_draw_time): Ditto.
* gui/e-week-view-main-item.c (e_week_view_main_item_draw_day):
Ditto.
* gui/e-week-view-titles-item.c (e_week_view_titles_item_draw):
Ditto.
* gui/e-week-view.c (e_week_view_style_set)
(e_week_view_recalc_cell_sizes)
(e_week_view_reshape_event_span): Ditto.
* gui/weekday-picker.c (weekday_picker_style_set): Ditto.
svn path=/trunk/; revision=20627
Diffstat (limited to 'calendar/gui/weekday-picker.c')
-rw-r--r-- | calendar/gui/weekday-picker.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/calendar/gui/weekday-picker.c b/calendar/gui/weekday-picker.c index 67e4a12ea2..fb77a2236f 100644 --- a/calendar/gui/weekday-picker.c +++ b/calendar/gui/weekday-picker.c @@ -362,17 +362,26 @@ weekday_picker_style_set (GtkWidget *widget, GtkStyle *previous_style) { WeekdayPicker *wp; WeekdayPickerPrivate *priv; - GdkFont *font; int max_width; const char *str; int i, len; + PangoFontDescription *font_desc; + PangoContext *pango_context; + PangoFontMetrics *font_metrics; + PangoLayout *layout; wp = WEEKDAY_PICKER (widget); priv = wp->priv; - font = gtk_style_get_font (gtk_widget_get_style (widget)); - priv->font_ascent = font->ascent; - priv->font_descent = font->descent; + /* Set up Pango prerequisites */ + font_desc = gtk_widget_get_style (widget)->font_desc; + pango_context = gtk_widget_get_pango_context (widget); + font_metrics = pango_context_get_metrics (pango_context, font_desc, + pango_context_get_language (pango_context)); + layout = pango_layout_new (pango_context); + + priv->font_ascent = PANGO_PIXELS (pango_font_metrics_get_ascent (font_metrics)); + priv->font_descent = PANGO_PIXELS (pango_font_metrics_get_descent (font_metrics)); max_width = 0; @@ -382,7 +391,9 @@ weekday_picker_style_set (GtkWidget *widget, GtkStyle *previous_style) for (i = 0; i < len; i++) { int w; - w = gdk_char_measure (font, str[i]); + pango_layout_set_text (layout, str + i, 1); + pango_layout_get_pixel_size (layout, &w, NULL); + if (w > max_width) max_width = w; } @@ -390,6 +401,7 @@ weekday_picker_style_set (GtkWidget *widget, GtkStyle *previous_style) priv->max_letter_width = max_width; configure_items (wp); + g_object_unref (layout); if (GTK_WIDGET_CLASS (parent_class)->style_set) (* GTK_WIDGET_CLASS (parent_class)->style_set) (widget, previous_style); |