Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 505928
Collapse All | Expand All

(-)a/plug-ins/cairo/diacairo-renderer.c (-3 / +15 lines)
Lines 315-320 set_fillstyle(DiaRenderer *self, FillStyle mode) Link Here
315
  DIAG_STATE(DIA_CAIRO_RENDERER (self)->cr)
315
  DIAG_STATE(DIA_CAIRO_RENDERER (self)->cr)
316
}
316
}
317
317
318
/* There is a recurring bug with pangocairo related to kerning and font scaling.
319
 * See: https://bugzilla.gnome.org/buglist.cgi?quicksearch=341481+573261+700592
320
 * Rather than waiting for another fix let's try to implement the ultimate work
321
 * around. With Pango-1.32 and HarfBuzz the kludge in Pango is gone and apparently
322
 * substituted with a precision problem. If we now use huge fonts when talking
323
 * to Pango and downscale these with cairo it should work with all Pango versions.
324
 */
325
#define FONT_SIZE_TWEAK (72.0)
326
318
static void
327
static void
319
set_font(DiaRenderer *self, DiaFont *font, real height)
328
set_font(DiaRenderer *self, DiaFont *font, real height)
320
{
329
{
Lines 327-333 set_font(DiaRenderer *self, DiaFont *font, real height) Link Here
327
336
328
#ifdef HAVE_PANGOCAIRO_H
337
#ifdef HAVE_PANGOCAIRO_H
329
  /* select font and size */
338
  /* select font and size */
330
  pango_font_description_set_absolute_size (pfd, (int)(size * PANGO_SCALE));
339
  pango_font_description_set_absolute_size (pfd, (int)(size * FONT_SIZE_TWEAK * PANGO_SCALE));
331
  pango_layout_set_font_description (renderer->layout, pfd);
340
  pango_layout_set_font_description (renderer->layout, pfd);
332
  pango_font_description_free (pfd);
341
  pango_font_description_free (pfd);
333
#else
342
#else
Lines 707-720 draw_string(DiaRenderer *self, Link Here
707
    pango_layout_iter_get_line_extents (iter, NULL, &extents);
716
    pango_layout_iter_get_line_extents (iter, NULL, &extents);
708
    shift = alignment == ALIGN_CENTER ? PANGO_RBEARING(extents)/2 :
717
    shift = alignment == ALIGN_CENTER ? PANGO_RBEARING(extents)/2 :
709
            alignment == ALIGN_RIGHT ? PANGO_RBEARING(extents) : 0;
718
            alignment == ALIGN_RIGHT ? PANGO_RBEARING(extents) : 0;
719
    shift /= FONT_SIZE_TWEAK;
720
    bline /= FONT_SIZE_TWEAK;
710
    cairo_move_to (renderer->cr, pos->x - (double)shift / PANGO_SCALE, pos->y - (double)bline / PANGO_SCALE);
721
    cairo_move_to (renderer->cr, pos->x - (double)shift / PANGO_SCALE, pos->y - (double)bline / PANGO_SCALE);
711
    pango_layout_iter_free (iter);
722
    pango_layout_iter_free (iter);
712
  }
723
  }
713
  /* does this hide bug #341481? */
724
  /* does this hide bug #341481? */
714
  pango_cairo_update_context (renderer->cr, pango_layout_get_context (renderer->layout));
725
  cairo_scale (renderer->cr, 1.0/FONT_SIZE_TWEAK, 1.0/FONT_SIZE_TWEAK);
715
  pango_layout_context_changed (renderer->layout);
726
  pango_cairo_update_layout (renderer->cr, renderer->layout);
716
727
717
  pango_cairo_show_layout (renderer->cr, renderer->layout);
728
  pango_cairo_show_layout (renderer->cr, renderer->layout);
729
  /* restoring the previous scale */
718
  cairo_restore (renderer->cr);
730
  cairo_restore (renderer->cr);
719
#else
731
#else
720
  /* using the 'toy API' */
732
  /* using the 'toy API' */

Return to bug 505928