diff --git a/src/Menu.cpp b/src/Menu.cpp index 83b0fb2c5be4..5bce26e085fb 100644 --- a/src/Menu.cpp +++ b/src/Menu.cpp @@ -1587,10 +1587,10 @@ void MenuUpdateZoom(MainWindow* win) { void MenuUpdatePrintItem(MainWindow* win, HMENU menu, bool disableOnly = false) { bool filePrintEnabled = win->IsDocLoaded(); -#ifndef DISABLE_DOCUMENT_RESTRICTIONS - bool filePrintAllowed = !filePrintEnabled || !win->AsFixed() || win->AsFixed()->GetEngine()->AllowsPrinting(); -#else +#if defined(DISABLE_DOCUMENT_RESTRICTIONS) bool filePrintAllowed = true; +#else + bool filePrintAllowed = !filePrintEnabled || !win->AsFixed() || win->AsFixed()->GetEngine()->AllowsPrinting(); #endif for (auto& def : menuDefFile) { diff --git a/src/utils/WinUtil.cpp b/src/utils/WinUtil.cpp index 0d17646ec60e..f42e6bdf2391 100755 --- a/src/utils/WinUtil.cpp +++ b/src/utils/WinUtil.cpp @@ -2981,6 +2981,8 @@ static Size HwndMeasureText(HWND hwnd, const WCHAR* txt, HFONT font) { ScopedSelectFont prev(dc, font); RECT r{}; + // TODO: DT_EDITCONTROL is probably not correct here + // TODO: what about DT_NOPREFIX? uint fmt = DT_CALCRECT | DT_LEFT | DT_NOCLIP | DT_EDITCONTROL; size_t txtLen = str::Len(txt); DrawTextExW(dc, (WCHAR*)txt, (int)txtLen, &r, fmt, nullptr); @@ -2999,6 +3001,7 @@ Size HwndMeasureText(HWND hwnd, const char* txt, HFONT font) { return HwndMeasureText(hwnd, sw, font); } +// return approximate height of font in pixels int FontDyPx(HWND hwnd, HFONT hfont) { Size s = HwndMeasureText(hwnd, "A", hfont); return s.dy; diff --git a/src/wingui/VirtWnd.cpp b/src/wingui/VirtWnd.cpp index 654a9fb37714..77717bfa190e 100644 --- a/src/wingui/VirtWnd.cpp +++ b/src/wingui/VirtWnd.cpp @@ -85,7 +85,10 @@ Size VirtWndText::GetIdealSize(bool onlyIfEmpty) { void VirtWndText::Draw(HDC hdc) { ReportIf(lastBounds.IsEmpty()); - UINT fmt = DT_NOCLIP | DT_NOPREFIX | (isRtl ? DT_RTLREADING : DT_LEFT); + UINT fmt = DT_NOCLIP | DT_NOPREFIX; + if (isRtl) { + fmt = fmt | DT_RTLREADING; + } RECT dr = ToRECT(lastBounds); HdcDrawText(hdc, s, &dr, fmt, font); if (withUnderline) {