Menu

#2185 Printing/FormatRange is broken on Win32 after per-monitor DPI awareness changes

Bug
closed-fixed
5
2020-07-22
2020-06-09
Zufu Liu
No

in Editor::FormatRange() two AutoSurface are created with HDC instead of WindowID, which get screen DPI (e.g. 96) instead of printing DPI (e.g. 600). for printing, the old LOGPIXELSY is needed.

Related

Bugs: #2186

Discussion

  • Zufu Liu

    Zufu Liu - 2020-06-09
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1 @@
    -in Editor::FormatRange() two AutoSurface are created with HDC instead of WindowID, which get screen DPI (see 96) instead of printing DPI (see 600). for printing, the old LOGPIXELSY is needed.
    +in Editor::FormatRange() two AutoSurface are created with HDC instead of WindowID, which get screen DPI (e.g. 96) instead of printing DPI (e.g. 600). for printing, the old LOGPIXELSY is needed.
    
     
  • Zufu Liu

    Zufu Liu - 2020-06-09

    a fix (add a printing parameter to Surface::Init method).

    void SurfaceGDI::Init(SurfaceID sid, WindowID wid, bool printing) noexcept {
        Release();
        hdc = static_cast<HDC>(sid);
        ::SetTextAlign(hdc, TA_BASELINE);
        logPixelsY = printing ? ::GetDeviceCaps(hdc, LOGPIXELSY) : DpiForWindow(wid);
    }
    
     
    • Neil Hodgson

      Neil Hodgson - 2020-06-09

      Surface is a stable platform interface that does not change between major versions.

       
  • Neil Hodgson

    Neil Hodgson - 2020-06-09

    This is unlikely to be perfect but it is an improvement as TECHNOLOGY appears to be DT_RASPRINTER for the printing choices I tried.

        const int deviceTechnology = ::GetDeviceCaps(hdc, TECHNOLOGY);
        if (deviceTechnology == DT_RASDISPLAY)
            logPixelsY = DpiForWindow(wid);
        else
            logPixelsY = ::GetDeviceCaps(hdc, LOGPIXELSY);
    
     
  • Zufu Liu

    Zufu Liu - 2020-06-10

    how about format the code to:

    const bool printing = (::GetDeviceCaps(hdc, TECHNOLOGY) != DT_RASDISPLAY);
    logPixelsY = printing ? ::GetDeviceCaps(hdc, LOGPIXELSY) : DpiForWindow(wid);
    
     
  • Neil Hodgson

    Neil Hodgson - 2020-06-11
    • labels: win32 --> win32, printing, scintilla, scite
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2020-06-11

    Fixed with [b006d1].

     

    Related

    Commit: [b006d1]

  • Jens Mahlmann

    Jens Mahlmann - 2020-06-18

    Hi Neil,
    thanx, I've read the posts but still don't quite understand what I have to do:
    a)
    Shall I fix something in my "SciTEGlobal.properties", and what?
    b)
    My prob is on 32 bits AND 64 bits.
    Best
    Jens

     
    • Neil Hodgson

      Neil Hodgson - 2020-06-18

      Reinstall 4.3.3 (https://sourceforge.net/projects/scintilla/files/SciTE/4.3.3/) until there is a new release which may take a month.

       
  • Jens Mahlmann

    Jens Mahlmann - 2020-06-18

    Thanx, that did the job!

     
  • Jens Mahlmann

    Jens Mahlmann - 2020-07-22

    444 works fine now thanx!

     
  • Neil Hodgson

    Neil Hodgson - 2020-07-22
    • status: open-fixed --> closed-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2020-07-22

    Fixed with [b006d1].

     

    Related

    Commit: [b006d1]


Log in to post a comment.

MongoDB Logo MongoDB