From: Paul Cornett Date: Tue, 24 Jan 2012 18:07:45 +0000 (+0000) Subject: add strike-through font support to wxGraphicsContext on GTK X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/968c75e36684abc092623e7055e8e1f4d94194c6?ds=inline add strike-through font support to wxGraphicsContext on GTK git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70453 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/graphicc.cpp b/src/generic/graphicc.cpp index 312cd84635..d493518890 100644 --- a/src/generic/graphicc.cpp +++ b/src/generic/graphicc.cpp @@ -293,6 +293,7 @@ public: #ifdef __WXGTK__ const PangoFontDescription* GetFont() const { return m_font; } bool GetUnderlined() const { return m_underlined; } + bool GetStrikethrough() const { return m_strikethrough; } #endif private : void InitColour(const wxColour& col); @@ -310,6 +311,7 @@ private : #elif defined(__WXGTK__) PangoFontDescription* m_font; bool m_underlined; + bool m_strikethrough; #endif // These members are used when the font is created from its face name and @@ -856,6 +858,7 @@ wxCairoFontData::wxCairoFontData( wxGraphicsRenderer* renderer, const wxFont &fo #elif defined(__WXGTK__) m_font = pango_font_description_copy( font.GetNativeFontInfo()->description ); m_underlined = font.GetUnderlined(); + m_strikethrough = font.GetStrikethrough(); #else InitFontComponents ( @@ -1984,11 +1987,22 @@ void wxCairoContext::DoDrawText(const wxString& str, wxDouble x, wxDouble y) pango_layout_set_font_description( layout, font_data->GetFont()); pango_layout_set_text(layout, data, datalen); + PangoAttrList* attrs = NULL; if (font_data->GetUnderlined()) { - PangoAttrList *attrs = pango_attr_list_new(); + attrs = pango_attr_list_new(); PangoAttribute *attr = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE); pango_attr_list_insert(attrs, attr); + } + if (font_data->GetStrikethrough()) + { + if (attrs == NULL) + attrs = pango_attr_list_new(); + PangoAttribute* attr = pango_attr_strikethrough_new(true); + pango_attr_list_insert(attrs, attr); + } + if (attrs) + { pango_layout_set_attributes(layout, attrs); pango_attr_list_unref(attrs); }