mirror of
https://github.com/fltk/fltk.git
synced 2026-06-05 16:12:13 +08:00
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
This commit is contained in:
@@ -188,7 +188,6 @@ double fl_width(unsigned int c) {
|
|||||||
unsigned int r;
|
unsigned int r;
|
||||||
r = (c & 0xFC00) >> 10;
|
r = (c & 0xFC00) >> 10;
|
||||||
if (!fl_fontsize->width[r]) {
|
if (!fl_fontsize->width[r]) {
|
||||||
SelectObject(fl_gc, fl_fontsize->fid);
|
|
||||||
fl_fontsize->width[r] = (int*) malloc(sizeof(int) * 0x0400);
|
fl_fontsize->width[r] = (int*) malloc(sizeof(int) * 0x0400);
|
||||||
SIZE s;
|
SIZE s;
|
||||||
unsigned short i = 0, ii = r * 0x400;
|
unsigned short i = 0, ii = r * 0x400;
|
||||||
@@ -207,6 +206,7 @@ double fl_width(unsigned int c) {
|
|||||||
}
|
}
|
||||||
if (!gc)
|
if (!gc)
|
||||||
Fl::fatal("Invalid graphic context: fl_width() failed because no valid HDC was found!");
|
Fl::fatal("Invalid graphic context: fl_width() failed because no valid HDC was found!");
|
||||||
|
SelectObject(gc, fl_fontsize->fid);
|
||||||
for (; i < 0x400; i++) {
|
for (; i < 0x400; i++) {
|
||||||
GetTextExtentPoint32W(gc, (WCHAR*)&ii, 1, &s);
|
GetTextExtentPoint32W(gc, (WCHAR*)&ii, 1, &s);
|
||||||
fl_fontsize->width[r][i] = s.cx;
|
fl_fontsize->width[r][i] = s.cx;
|
||||||
|
|||||||
Reference in New Issue
Block a user