From 463df5a58a99b0058de715451ef3039545d44438 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Sep 2014 17:44:08 +0000 Subject: [PATCH] use cairo implement rotated text git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77854 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/x11/dcclient.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/x11/dcclient.cpp b/src/x11/dcclient.cpp index 13effdd781..28b2edb5c4 100644 --- a/src/x11/dcclient.cpp +++ b/src/x11/dcclient.cpp @@ -1664,7 +1664,23 @@ void wxWindowDCImpl::DoDrawRotatedText(const wxString& WXUNUSED(text), wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), double angle) { - wxFAIL_MSG( "not implemented" ); + // use cairo to draw rotated text + cairo_surface_t *surface; + surface = cairo_xlib_surface_create((Display*) m_display, (Drawable) m_x11window, + DefaultVisual((Display*) m_display, 0), x, y); + cairo_t *cr = cairo_create(surface); + + cairo_save(cr); + cairo_move_to (cr, x, y); + + // cairo use radians, but wxWidgets use degree + // so convert degrees to radians first. + // and wxWidgets is counter clock, so plus minus. + cairo_rotate(cr, -angle * (M_PI / 180)); + + cairo_show_text (cr, text); + cairo_restore(cr); + cairo_destroy(cr); } void wxWindowDCImpl::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height,