From 574c5ed8b0d4efc22bc980d1501d7358e3c58bfa Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 5 Mar 2007 23:12:47 +0000 Subject: [PATCH] get real Pango::FontDescriptions for several canvas items git-svn-id: svn://localhost/ardour2/trunk@1557 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/utils.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index 396940284b..fbebf0d51a 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -232,7 +232,21 @@ get_font_for_style (string widgetname) foobar.ensure_style(); style = foobar.get_style (); - return style->get_font(); + + Glib::RefPtr layout = foobar.get_layout(); + + PangoFontDescription *pfd = (PangoFontDescription *)pango_layout_get_font_description((PangoLayout *)layout->gobj()); + + if (!pfd) { + + /* layout inherited its font description from a PangoContext */ + + PangoContext* ctxt = (PangoContext*) pango_layout_get_context ((PangoLayout*) layout->gobj()); + pfd = pango_context_get_font_description (ctxt); + return Pango::FontDescription (pfd, true); /* make a copy */ + } + + return Pango::FontDescription (pfd, true); /* make a copy */ } uint32_t