From 7da4b720fe573e150b8476d181330d1a7014e526 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Thu, 7 Sep 2000 23:56:41 +0000 Subject: Incorporated Mark's patch to handle failing GetTextExtentExPoint. --- win32/PlatWin.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 4eb1e2b47..2eb2d12f0 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -516,7 +516,11 @@ void Surface::MeasureWidths(Font &font_, const char *s, int len, int *positions) } positions[i] = sz.cx; } else { - ::GetTextExtentExPoint(hdc, s, len, 30000, &fit, positions, &sz); + if (!::GetTextExtentExPoint(hdc, s, len, 30000, &fit, positions, &sz)) { + // Eeek - a NULL DC or other foolishness could cause this. + // The least we can do is set the positions to zero! + memset(positions, 0, len * sizeof(*positions)); + } } } -- cgit v1.2.3