Mercurial > dwindows
diff win/dw.c @ 436:98d6c00fe11e
Fix bug with specifying fonts with modifiers; the modifiers were not being
stripped. Still may not be sufficient; see comment in code.
Drawing filled and hollow rectangles now work the same as under GTK.
author | mhessling@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 28 May 2003 04:52:34 +0000 |
parents | f977c80a1dfa |
children | fac2afe7bda3 |
line wrap: on
line diff
--- a/win/dw.c Tue May 27 22:34:14 2003 +0000 +++ b/win/dw.c Wed May 28 04:52:34 2003 +0000 @@ -3406,6 +3406,7 @@ HFONT hfont; int z, size = 9; LOGFONT lf; + char *myFontName; if(fontname == DefaultFont || !fontname[0]) hfont = GetStockObject(DEFAULT_GUI_FONT); @@ -3437,7 +3438,19 @@ lf.lfClipPrecision = 0; lf.lfQuality = DEFAULT_QUALITY; lf.lfPitchAndFamily = DEFAULT_PITCH | FW_DONTCARE; - strcpy(lf.lfFaceName, &fontname[z+1]); + /* + * remove any font modifiers by truncating at the first space + * - this may not be enough!; what about "Courier New" ??? + */ + myFontName = strdup(&fontname[z+1]); + for(z=0;z<strlen(myFontName);z++) + if(myFontName[z] == ' ') + { + myFontName[z]='\0'; + break; + } + strcpy(lf.lfFaceName, myFontName); + free(myFontName); hfont = CreateFontIndirect(&lf); #if 0 @@ -6889,6 +6902,7 @@ HDC hdcPaint; HPEN oldPen; HBRUSH oldBrush; + RECT Rect; int threadid = dw_thread_id(); if(threadid < 0 || threadid >= THREAD_LIMIT) @@ -6901,11 +6915,11 @@ else return; - oldPen = SelectObject(hdcPaint, _hPen[threadid]); - oldBrush = SelectObject(hdcPaint, _hBrush[threadid]); - Rectangle(hdcPaint, x, y, x + width, y + height); - SelectObject(hdcPaint, oldPen); - SelectObject(hdcPaint, oldBrush); + SetRect(&Rect, x, y, x + width , y + height ); + if(fill) + FillRect(hdcPaint, &Rect, _hBrush[threadid]); + else + FrameRect(hdcPaint, &Rect, _hBrush[threadid]); if(!pixmap) ReleaseDC(handle, hdcPaint); }