From 4770df95a0ace5e4e8f67e8ea85392e464fbaad2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 23 Aug 2001 22:08:58 +0000 Subject: [PATCH] fixes for rotated text drawing git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11446 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/dc.tex | 5 +++++ samples/drawing/drawing.cpp | 4 +++- src/msw/dc.cpp | 7 ++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/latex/wx/dc.tex b/docs/latex/wx/dc.tex index 94354be934..95d44545be 100644 --- a/docs/latex/wx/dc.tex +++ b/docs/latex/wx/dc.tex @@ -364,6 +364,11 @@ for filling the shape. Draws the text rotated by {\it angle} degrees. +{\bf NB:} Under Win9x only TrueType fonts can be drawn by this function. In +particular, a font different from {\tt wxNORMAL\_FONT} should be used as the +latter is not a TrueType font. {\tt wxSWISS\_FONT} is an example of a font +which is. + \wxheading{See also} \helpref{DrawText}{wxdcdrawtext} diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index 0e8f8ee757..9fdf5136d3 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -824,7 +824,9 @@ void MyCanvas::DrawText(wxDC& dc) dc.DrawText( "This is text", 110, 10 ); dc.DrawRotatedText( "That is text", 20, 10, -45 ); - dc.SetFont( *wxNORMAL_FONT ); + // use wxSWISS_FONT and not wxNORMAL_FONT as the latter can't be rotated + // under Win9x (it is not TrueType) + dc.SetFont( *wxSWISS_FONT ); wxString text; dc.SetBackgroundMode(wxTRANSPARENT); diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 721a1fb3c7..7606a64098 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -1009,9 +1009,10 @@ void wxDC::DoDrawRotatedText(const wxString& text, #ifndef __WXMICROWIN__ else { - // NB: don't take DEFAULT_GUI_FONT because it's not TrueType and so - // can't have non zero orientation/escapement - wxFont font = m_font.Ok() ? m_font : *wxNORMAL_FONT; + // NB: don't take DEFAULT_GUI_FONT (a.k.a. wxSYS_DEFAULT_GUI_FONT) + // because it's not TrueType and so can't have non zero + // orientation/escapement under Win9x + wxFont font = m_font.Ok() ? m_font : *wxSWISS_FONT; HFONT hfont = (HFONT)font.GetResourceHandle(); LOGFONT lf; if ( ::GetObject(hfont, sizeof(lf), &lf) == 0 ) -- 2.45.2