From 6b82d89473972919c10d264efc94dd1ea4d64d9f Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Mon, 24 Jan 2000 12:24:57 +0000 Subject: [PATCH] Corrected font calculation (use screen resolution now); and check for mask in m_image.cpp or get assert in DoBlit git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5624 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/html/m_image.cpp | 2 +- src/msw/fontutil.cpp | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/html/m_image.cpp b/src/html/m_image.cpp index a7f1f297e7..ba6fdac6d8 100644 --- a/src/html/m_image.cpp +++ b/src/html/m_image.cpp @@ -306,7 +306,7 @@ wxHtmlImageCell::wxHtmlImageCell(wxFSFile *input, int w, int h, int align, wxStr void wxHtmlImageCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2) { if (m_Image) - dc.DrawBitmap(*m_Image, x + m_PosX, y + m_PosY, TRUE); + dc.DrawBitmap(*m_Image, x + m_PosX, y + m_PosY, (m_Image->GetMask() != (wxMask*) 0)); wxHtmlCell::Draw(dc, x, y, view_y1, view_y2); } diff --git a/src/msw/fontutil.cpp b/src/msw/fontutil.cpp index 92332ba22a..04ad8a0548 100644 --- a/src/msw/fontutil.cpp +++ b/src/msw/fontutil.cpp @@ -41,6 +41,12 @@ #include "wx/tokenzr.h" +// If 1, use the screen resolution to calculate font sizes. +// This is OK for screen fonts but might have implications when the +// same font is used for printing. +// If 0, assume 96 DPI. +#define wxUSE_SCREEN_DPI 1 + // ============================================================================ // implementation // ============================================================================ @@ -270,9 +276,9 @@ void wxFillLogFont(LOGFONT *logFont, const wxFont *font) break; } -#if 0 +#if wxUSE_SCREEN_DPI HDC dc = ::GetDC(NULL); - int ppInch = ::GetDeviceCaps(dc, LOGPIXELSY); + static const int ppInch = ::GetDeviceCaps(dc, LOGPIXELSY); ::ReleaseDC(NULL, dc); #else // New behaviour: apparently ppInch varies according to Large/Small Fonts @@ -392,14 +398,17 @@ wxFont wxCreateFontFromLogFont(const LOGFONT *logFont) wxString fontFace = logFont->lfFaceName; - // font size - HDC dc = ::GetDC(NULL); - // remember that 1pt = 1/72inch int height = abs(logFont->lfHeight); - int fontPoints = (int) ((72.0*((double)height))/(double) GetDeviceCaps(dc, LOGPIXELSY) + 0.5); +#if wxUSE_SCREEN_DPI + HDC dc = ::GetDC(NULL); + static const int ppInch = GetDeviceCaps(dc, LOGPIXELSY); ::ReleaseDC(NULL, dc); +#else + static const int ppInch = 96; +#endif + int fontPoints = (int) (((72.0*((double)height))/(double) ppInch) + 0.5); wxFontEncoding fontEncoding; switch ( logFont->lfCharSet ) -- 2.45.2