Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/90100bbd45be8e3bc45f258a32a24f433cadbd70
...commit
http://git.netsurf-browser.org/netsurf.git/commit/90100bbd45be8e3bc45f258a32a24f433cadbd70
...tree
http://git.netsurf-browser.org/netsurf.git/tree/90100bbd45be8e3bc45f258a32a24f433cadbd70
The branch, master has been updated
via 90100bbd45be8e3bc45f258a32a24f433cadbd70 (commit)
from 5d5081eb5788315f8ce7b60af05fe6d071672edd (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=90100bbd45be8e3bc45f258a32a24f433cadbd70
commit 90100bbd45be8e3bc45f258a32a24f433cadbd70
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
GTK: Font rendering: Use same pango layout for painting as for measuring.
With this change we are consistent about how the pango layout
we use is created.
Now it always comes from a pango_layout_new() call on a pango context
that comes from gdk_pango_context_get().
Previously the pango layout used for painting came from a call
to pango_cairo_create_layout(), which required a global called
"current_cr" (a cairo drawing context), which is only valid
during redraw (painting). Since it was only valid during
painting, this source could not be used for pango layout
creation for the measuring code.
diff --git a/frontends/gtk/layout_pango.c b/frontends/gtk/layout_pango.c
index bad57d6..5276148 100644
--- a/frontends/gtk/layout_pango.c
+++ b/frontends/gtk/layout_pango.c
@@ -226,27 +226,24 @@ nserror nsfont_paint(int x, int y, const char *string,
size_t length,
const plot_font_style_t *fstyle)
{
PangoFontDescription *desc;
- PangoLayout *layout;
PangoLayoutLine *line;
if (length == 0)
return NSERROR_OK;
- layout = pango_cairo_create_layout(current_cr);
+ nsfont_pango_check();
desc = nsfont_style_to_description(fstyle);
- pango_layout_set_font_description(layout, desc);
+ pango_layout_set_font_description(nsfont_pango_layout, desc);
pango_font_description_free(desc);
- pango_layout_set_text(layout, string, length);
+ pango_layout_set_text(nsfont_pango_layout, string, length);
- line = pango_layout_get_line_readonly(layout, 0);
+ line = pango_layout_get_line_readonly(nsfont_pango_layout, 0);
cairo_move_to(current_cr, x, y);
nsgtk_set_colour(fstyle->foreground);
pango_cairo_show_layout_line(current_cr, line);
- g_object_unref(layout);
-
return NSERROR_OK;
}
-----------------------------------------------------------------------
Summary of changes:
frontends/gtk/layout_pango.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/frontends/gtk/layout_pango.c b/frontends/gtk/layout_pango.c
index bad57d6..5276148 100644
--- a/frontends/gtk/layout_pango.c
+++ b/frontends/gtk/layout_pango.c
@@ -226,27 +226,24 @@ nserror nsfont_paint(int x, int y, const char *string,
size_t length,
const plot_font_style_t *fstyle)
{
PangoFontDescription *desc;
- PangoLayout *layout;
PangoLayoutLine *line;
if (length == 0)
return NSERROR_OK;
- layout = pango_cairo_create_layout(current_cr);
+ nsfont_pango_check();
desc = nsfont_style_to_description(fstyle);
- pango_layout_set_font_description(layout, desc);
+ pango_layout_set_font_description(nsfont_pango_layout, desc);
pango_font_description_free(desc);
- pango_layout_set_text(layout, string, length);
+ pango_layout_set_text(nsfont_pango_layout, string, length);
- line = pango_layout_get_line_readonly(layout, 0);
+ line = pango_layout_get_line_readonly(nsfont_pango_layout, 0);
cairo_move_to(current_cr, x, y);
nsgtk_set_colour(fstyle->foreground);
pango_cairo_show_layout_line(current_cr, line);
- g_object_unref(layout);
-
return NSERROR_OK;
}
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org