From 2251609ab3a4db3ed65c6e2974f6f92e0c564a5e Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Thu, 3 Feb 2011 23:00:30 +0000 Subject: Fix STR #2553: in function fl_width(unsigned), the SelectObject() statement was put before making sure we have a valid gc, which was wrong. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8365 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/fl_font_win32.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/fl_font_win32.cxx b/src/fl_font_win32.cxx index bfbd1f349..5c5238605 100644 --- a/src/fl_font_win32.cxx +++ b/src/fl_font_win32.cxx @@ -188,7 +188,6 @@ double fl_width(unsigned int c) { unsigned int r; r = (c & 0xFC00) >> 10; if (!fl_fontsize->width[r]) { - SelectObject(fl_gc, fl_fontsize->fid); fl_fontsize->width[r] = (int*) malloc(sizeof(int) * 0x0400); SIZE s; unsigned short i = 0, ii = r * 0x400; @@ -207,6 +206,7 @@ double fl_width(unsigned int c) { } if (!gc) Fl::fatal("Invalid graphic context: fl_width() failed because no valid HDC was found!"); + SelectObject(gc, fl_fontsize->fid); for (; i < 0x400; i++) { GetTextExtentPoint32W(gc, (WCHAR*)&ii, 1, &s); fl_fontsize->width[r][i] = s.cx; -- cgit v1.2.3