librsvg r1147 - trunk
- From: doml svn gnome org
- To: svn-commits-list gnome org
- Subject: librsvg r1147 - trunk
- Date: Wed, 20 Feb 2008 15:07:22 +0000 (GMT)
Author: doml
Date: Wed Feb 20 15:07:21 2008
New Revision: 1147
URL: http://svn.gnome.org/viewvc/librsvg?rev=1147&view=rev
Log:
2008-02-20 Dominic Lachowicz <domlachowicz gmail com>
From Behdad Esfahbod <behdad behdad org>
* Fixes bugs described in the following thread:
http://lists.cairographics.org/archives/cairo/2008-February/013082.html
Modified:
trunk/ChangeLog
trunk/configure.in
trunk/rsvg-cairo-draw.c
trunk/rsvg-text.c
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Wed Feb 20 15:07:21 2008
@@ -9,7 +9,7 @@
LIBXML_REQUIRED=2.4.7
CAIRO_REQUIRED=1.2.0
PANGOFT2_REQUIRED=1.2.0
-PANGOCAIRO_REQUIRED=1.2.0
+PANGOCAIRO_REQUIRED=1.10.0
AC_SUBST(GDK_PIXBUF_REQUIRED)
AC_SUBST(GLIB_REQUIRED)
Modified: trunk/rsvg-cairo-draw.c
==============================================================================
--- trunk/rsvg-cairo-draw.c (original)
+++ trunk/rsvg-cairo-draw.c Wed Feb 20 15:07:21 2008
@@ -460,9 +460,11 @@
{
PangoFontMap *fontmap;
PangoContext *context;
+ RsvgCairoRender *render = (RsvgCairoRender *) ctx->render;
fontmap = pango_cairo_font_map_get_default ();
context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
+ pango_cairo_update_context (render->cr, context);
pango_cairo_context_set_resolution (context, ctx->dpi_y);
return context;
}
@@ -472,26 +474,23 @@
{
RsvgCairoRender *render = (RsvgCairoRender *) ctx->render;
RsvgState *state = rsvg_state_current (ctx);
- PangoRectangle logical;
+ PangoRectangle ink;
RsvgBbox bbox;
- _rsvg_cairo_set_text_antialias (render->cr, state->text_rendering_type);
+ _rsvg_cairo_set_text_antialias (render->cr, state->text_rendering_type);
_set_rsvg_affine (render, state->affine);
- cairo_set_line_width (render->cr, _rsvg_css_normalize_length (&state->stroke_width, ctx, 'h'));
-
- pango_cairo_update_layout (render->cr, layout);
- pango_layout_get_pixel_extents (layout, NULL, &logical);
+ pango_layout_get_extents (layout, &ink, NULL);
rsvg_bbox_init (&bbox, state->affine);
- bbox.x = x;
- bbox.y = y;
- bbox.w = logical.width;
- bbox.h = logical.height;
+ bbox.x = x + ink.x / (double)PANGO_SCALE;
+ bbox.y = y + ink.y / (double)PANGO_SCALE;
+ bbox.w = ink.width / (double)PANGO_SCALE;
+ bbox.h = ink.height / (double)PANGO_SCALE;
bbox.virgin = 0;
- cairo_translate (render->cr, x, y);
+ cairo_move_to (render->cr, x, y);
rsvg_bbox_insert (&render->bbox, &bbox);
@@ -513,6 +512,8 @@
state->stroke,
state->stroke_opacity,
bbox, rsvg_state_current (ctx)->current_color);
+
+ cairo_set_line_width (render->cr, _rsvg_css_normalize_length (&state->stroke_width, ctx, 'h'));
cairo_stroke (render->cr);
}
}
Modified: trunk/rsvg-text.c
==============================================================================
--- trunk/rsvg-text.c (original)
+++ trunk/rsvg-text.c Wed Feb 20 15:07:21 2008
@@ -550,23 +550,6 @@
return layout;
}
-static void
-rsvg_text_layout_get_offsets (RsvgTextLayout * layout, gint * x, gint * y)
-{
- PangoRectangle ink;
- PangoRectangle logical;
-
- pango_layout_get_pixel_extents (layout->layout, &ink, &logical);
-
- if (ink.width < 1 || ink.height < 1) {
- *x = *y = 0;
- return;
- }
-
- *x = MIN (ink.x, logical.x);
- *y = MIN (ink.y, logical.y);
-}
-
static FT_Int32
rsvg_text_layout_render_flags (RsvgTextLayout * layout)
{
@@ -775,7 +758,6 @@
for (list = line->runs; list; list = list->next) {
PangoLayoutRun *run = list->data;
- pango_glyph_string_extents (run->glyphs, run->item->analysis.font, NULL, &rect);
x_off += rsvg_text_layout_render_glyphs (layout,
run->item->analysis.font, run->glyphs,
render_func, x + x_off, y, render_data);
@@ -788,13 +770,10 @@
RsvgTextRenderFunc render_func, gpointer render_data)
{
PangoLayoutIter *iter;
- gint offx, offy;
gint x, y;
- rsvg_text_layout_get_offsets (layout, &offx, &offy);
-
- x = offx + layout->x;
- y = offy + layout->y;
+ x = layout->x;
+ y = layout->y;
x *= PANGO_SCALE;
y *= PANGO_SCALE;
@@ -802,19 +781,19 @@
iter = pango_layout_get_iter (layout->layout);
if (iter) {
- PangoRectangle rect;
+ PangoRectangle logical;
PangoLayoutLine *line;
gint baseline;
line = pango_layout_iter_get_line (iter);
- pango_layout_iter_get_line_extents (iter, NULL, &rect);
+ pango_layout_iter_get_line_extents (iter, NULL, &logical);
baseline = pango_layout_iter_get_baseline (iter);
rsvg_text_layout_render_line (layout, line,
- render_func, x + rect.x, y + baseline, render_data);
+ render_func, x, y + baseline, render_data);
- layout->x += rect.width / PANGO_SCALE + offx;
+ layout->x += logical.width / (double)PANGO_SCALE;
}
pango_layout_iter_free (iter);
@@ -866,12 +845,12 @@
state = rsvg_state_current (ctx);
context = ctx->render->create_pango_context (ctx);
layout = rsvg_text_create_layout (ctx, state, text, context);
- pango_layout_get_pixel_size (layout, &w, &h);
+ pango_layout_get_size (layout, &w, &h);
iter = pango_layout_get_iter (layout);
- baseline = pango_layout_iter_get_baseline (iter) / PANGO_SCALE;
+ baseline = pango_layout_iter_get_baseline (iter) / (double)PANGO_SCALE;
pango_layout_iter_free (iter);
ctx->render->render_pango_layout (ctx, layout, *x, *y - baseline);
- *x += w;
+ *x += w / (double)PANGO_SCALE;
g_object_unref (layout);
g_object_unref (context);
} else {
@@ -885,26 +864,11 @@
static gdouble
rsvg_text_layout_width (RsvgTextLayout * layout)
{
- PangoLayoutIter *iter;
- gint offx, offy;
-
- rsvg_text_layout_get_offsets (layout, &offx, &offy);
+ gint width;
- iter = pango_layout_get_iter (layout->layout);
-
- if (iter) {
- PangoRectangle rect;
- PangoLayoutLine *line;
-
- line = pango_layout_iter_get_line (iter);
+ pango_layout_get_size (layout->layout, &width, NULL);
- pango_layout_iter_get_line_extents (iter, NULL, &rect);
-
- pango_layout_iter_free (iter);
- return rect.width / PANGO_SCALE + offx;
- }
-
- return 0;
+ return width / (double)PANGO_SCALE;
}
static gdouble
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]