# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1307058938 0 # Node ID efa7d527adea0a42a40bdb5f486abb0533566cfb # Parent 2f79f183ff034f1a25d290d8222701bbbacd59a8 Use the actual Windows point size for a device... doing conversion as necessary. diff -r 2f79f183ff03 -r efa7d527adea win/dw.c --- a/win/dw.c Thu Jun 02 21:48:16 2011 +0000 +++ b/win/dw.c Thu Jun 02 23:55:38 2011 +0000 @@ -3995,21 +3995,24 @@ SetParent(handle, newparent); } -LOGFONT _get_logfont(char *fontname) +LOGFONT _get_logfont(HWND handle, char *fontname) { int Italic, Bold; char *myFontName; int z, size = 9; LOGFONT lf; + HDC hdc = GetDC(handle); + for(z=0;z FW_MEDIUM ) bold = " Bold"; if ( lf.lfItalic ) italic = " Italic"; - if ( lf.lfHeight <= 0 ) - height = abs (lf.lfHeight ); - else - /* - * we subtract 5 from a positive font height, because we (presumably) - * added 5 (in _acquire_font() above - don't know why ) - */ - height = lf.lfHeight - 5; + height = MulDiv(abs(lf.lfHeight), 72, GetDeviceCaps (hdc, LOGPIXELSY)); + ReleaseDC(NULL, hdc); sprintf( str, "%d.%s%s%s", height, lf.lfFaceName, bold, italic ); } } @@ -4182,18 +4181,14 @@ if ( str ) { int height; + HDC hdc = GetDC(handle); + if ( lf.lfWeight > FW_MEDIUM ) bold = " Bold"; if ( lf.lfItalic ) italic = " Italic"; - if ( lf.lfHeight <= 0 ) - height = abs (lf.lfHeight ); - else - /* - * we subtract 5 from a positive font height, because we (presumably) - * added 5 (in _acquire_font() above - don't know why ) - */ - height = lf.lfHeight - 5; + height = MulDiv(abs(lf.lfHeight), 72, GetDeviceCaps (hdc, LOGPIXELSY)); + ReleaseDC(handle, hdc); sprintf( str, "%d.%s%s%s", height, lf.lfFaceName, bold, italic ); } }