diff options
author | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-07-20 16:24:31 +0800 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-07-20 16:24:31 +0800 |
commit | ee6d562880652864aa8da959ad4b127786a3fa3a (patch) | |
tree | bef9d8c14cdc23affa6f3c22f75675ab0f5f7c84 | |
parent | 35a3b3e69964df852a4a649336fe473a42da491c (diff) | |
download | gsoc2013-evolution-ee6d562880652864aa8da959ad4b127786a3fa3a.tar.gz gsoc2013-evolution-ee6d562880652864aa8da959ad4b127786a3fa3a.tar.zst gsoc2013-evolution-ee6d562880652864aa8da959ad4b127786a3fa3a.zip |
Added cairo font rendering to ECell and EText.
svn path=/trunk/; revision=32359
-rw-r--r-- | widgets/ChangeLog | 5 | ||||
-rw-r--r-- | widgets/table/ChangeLog | 6 | ||||
-rw-r--r-- | widgets/table/e-cell-text.c | 16 | ||||
-rw-r--r-- | widgets/text/e-text.c | 22 | ||||
-rw-r--r-- | widgets/text/e-text.h | 2 |
5 files changed, 44 insertions, 7 deletions
diff --git a/widgets/ChangeLog b/widgets/ChangeLog index e471895162..0c7836d905 100644 --- a/widgets/ChangeLog +++ b/widgets/ChangeLog @@ -1,3 +1,8 @@ +2006-07-05 Rajeev ramanathan <rajeevramanathan_2004@yaoo.co.in> + + * text/e-text.[ch]: Added code to render EText text + items with antialiasing, hinting and sub-pixel ordering with cairo. + 2006-07-18 Andre Klapper <a9016009@gmx.de> * e-timezone-dialog/e-timezone-dialog.glade: diff --git a/widgets/table/ChangeLog b/widgets/table/ChangeLog index caa0788c3d..2ce971ad46 100644 --- a/widgets/table/ChangeLog +++ b/widgets/table/ChangeLog @@ -1,3 +1,9 @@ +2006-07-05 Rajeev ramanathan <rajeevramanathan_2004@yaoo.co.in> + + * e-cell-text.c: (ect_unrealize), (build_layout), (ect_draw): Added + code to render ECell text items with antialiasing, hinting + and sub-pixel ordering with cairo. + 2006-07-18 BenoƮt Dejean <benoit@placenet.org> ** Fixes bug #333041 diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index 7ea8a54c98..fee7d04cfb 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -142,7 +142,6 @@ typedef struct { int xofs, yofs; /* This gets added to the x and y for the cell text. */ double ellipsis_width[2]; /* The width of the ellipsis. */ - } ECellTextView; struct _CellEdit { @@ -439,6 +438,7 @@ ect_unrealize (ECellView *ecv) if (parent_class->unrealize) (* parent_class->unrealize) (ecv); + } static void @@ -570,6 +570,8 @@ build_layout (ECellTextView *text_view, int row, const char *text, gint width) ECellText *ect = E_CELL_TEXT (ecell_view->ecell); PangoAttrList *attrs ; PangoLayout *layout; + PangoContext *context; + cairo_font_options_t *font_options; layout = gtk_widget_create_pango_layout (GTK_WIDGET (((GnomeCanvasItem *)ecell_view->e_table_item_view)->canvas), text); @@ -581,6 +583,13 @@ build_layout (ECellTextView *text_view, int row, const char *text, gint width) if (text_view->edit || width <= 0) return layout; + context = pango_layout_get_context (layout); + + font_options = get_font_options(); + pango_cairo_context_set_font_options (context, font_options); + cairo_font_options_destroy (font_options); + pango_layout_context_changed (layout); + if (ect->font_name) { PangoFontDescription *desc = NULL, *fixed_desc = NULL; @@ -632,7 +641,7 @@ build_layout (ECellTextView *text_view, int row, const char *text, gint width) default: break; } - + return layout; } @@ -733,10 +742,7 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable, selected = flags & E_CELL_SELECTED; if (selected) { - if (flags & E_CELL_FOCUSED) foreground = &canvas->style->fg [GTK_STATE_SELECTED]; - else - foreground = &canvas->style->fg [GTK_STATE_ACTIVE]; } else { foreground = &canvas->style->text [GTK_STATE_NORMAL]; diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index 75332cdd8a..de8afd5b8d 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -405,12 +405,30 @@ create_layout (EText *text) static void reset_layout (EText *text) { + GnomeCanvasItem *item = GNOME_CANVAS_ITEM (text); + cairo_font_options_t *font_options; + PangoContext *context; + if (text->layout == NULL) { create_layout (text); } else { - pango_layout_set_text (text->layout, text->text, -1); - reset_layout_attrs (text); + context = pango_layout_get_context (text->layout); + + font_options = get_font_options(); + pango_cairo_context_set_font_options (context, font_options); + cairo_font_options_destroy (font_options); + pango_layout_context_changed (text->layout); + + text->font_desc = pango_font_description_new (); + pango_font_description_set_size (text->font_desc, + pango_font_description_get_size ((GTK_WIDGET (item->canvas))->style->font_desc)); + pango_font_description_set_family (text->font_desc, + pango_font_description_get_family ((GTK_WIDGET (item->canvas))->style->font_desc)); + pango_layout_set_font_description (text->layout, text->font_desc); + + pango_layout_set_text (text->layout, text->text, -1); + reset_layout_attrs (text); } if (!text->button_down) { diff --git a/widgets/text/e-text.h b/widgets/text/e-text.h index b72a299195..4d2e4abcf0 100644 --- a/widgets/text/e-text.h +++ b/widgets/text/e-text.h @@ -215,6 +215,8 @@ struct _EText { gboolean im_context_signals_registered; gboolean handle_popup; + + PangoFontDescription *font_desc; }; struct _ETextClass { |