From c4902facfd630c9bb4e47374f4547c43d4912970 Mon Sep 17 00:00:00 2001 From: Neil Date: Sun, 15 Mar 2015 10:09:49 +1100 Subject: Bug [#1705]. Fix a bug with Mingw-w64. Probably due to incorrect definition of DWRITE_TEXT_METRICS struct in header. --- win32/PlatWin.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 3fdfc6065..37724ced8 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1793,12 +1793,13 @@ XYPOSITION SurfaceD2D::AverageCharWidth(Font &font_) { // Create a layout IDWriteTextLayout *pTextLayout = 0; const WCHAR wszAllAlpha[] = L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; - HRESULT hr = pIDWriteFactory->CreateTextLayout(wszAllAlpha, static_cast(wcslen(wszAllAlpha)), + const size_t lenAllAlpha = wcslen(wszAllAlpha); + HRESULT hr = pIDWriteFactory->CreateTextLayout(wszAllAlpha, static_cast(lenAllAlpha), pTextFormat, 1000.0, 1000.0, &pTextLayout); if (SUCCEEDED(hr)) { DWRITE_TEXT_METRICS textMetrics; if (SUCCEEDED(pTextLayout->GetMetrics(&textMetrics))) - width = textMetrics.width / wcslen(wszAllAlpha); + width = textMetrics.width / lenAllAlpha; pTextLayout->Release(); } } -- cgit v1.2.3