#1427 [GTK] Pango context not properly scaled

Bug
closed-fixed
Scintilla (792)
5
2014-08-25
2012-12-30
No

The Pango contexts are not properly updated for the surface they are actually used to draw on, which results in improper transformations if the target surface isn't the widget's one (e.g. when printing on a scaled surface).

Attached is a patch that fixes it by making sure the used Pango contexts are properly set up for the surface they are actually used with.

Discussion

  • Neil Hodgson

    Neil Hodgson - 2013-01-01
    • assigned_to: nobody --> nyamatongwe
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2013-01-01

    I couldn't see any problems using Print or Print Preview from SciTE with a scale factor.

    Committed.

     
  • Colomban Wendling

    What do you mean, that before you didn't see a problem, or that the patch didn't break anything? The problem the patch fixes is improper measurements if the target surface has a Cairo scale (and probably other transforms) factor different than the ScintillaGTK widget.

    Actually, when printing using the GTK backend, the default scale may be incorrect for the target because Scintilla creates its own Pango layout, but the GtkPrintOperation's one may have a scale factor applied (to adjust for printing deice DPIs). So since Scintilla won't it (since actually it never sees this scale factor nor the DPI), to print at the appropriate size for the device I needed to scale the target surface depending on the source (widget, so screen) and destination (printing device) DPI. But some[1] measurements were done with a non-scaled Pango context, thus leading to unaligned stuff and worse.

    Anyway, thanks for committing :)

    [1] not sure why not all were wrong, but e.g. tab stops were incorrect.

     
  • Neil Hodgson

    Neil Hodgson - 2013-01-01

    I meant that I couldn't see any problems before the patch was applied. It would have been useful to include an image showing an example problem.

     
  • Colomban Wendling

    Here is an image showing both incorrect (before the patch) and correct (after) output when printing on a scaled target surface, with font DejaVu Sans Mono 8.

    Here, some lines are aligned with tabulations (longer ones) and some with the appropriate amount of spaces (shorter ones). You can also see that the line height is taller on the improper output.

     
    Attachments
  • Neil Hodgson

    Neil Hodgson - 2013-01-17
    • status: open-fixed --> closed-fixed
    • milestone: --> Bug
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks