Merged revisions 6293,6296-6306,6308 via svnmerge from
[ardour.git] / libs / gtkmm2 / pango / src / fontset.ccg
1 // -*- c++ -*-
2 /* $Id: fontset.ccg,v 1.5 2006/05/11 11:40:24 murrayc Exp $ */
3
4 /* 
5  *
6  * Copyright 2001      The gtkmm Development Team
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */
22
23 static gboolean fontset_foreach_callback(PangoFontset* /* fontset */, PangoFont* font, gpointer data)
24 {
25   #ifdef GLIBMM_EXCEPTIONS_ENABLED
26   try
27   {
28   #endif //GLIBMM_EXCEPTIONS_ENABLED
29     Pango::Fontset::ForeachSlot& slot = *static_cast<Pango::Fontset::ForeachSlot*>(data);
30     Glib::RefPtr<Pango::Font> cppFont = Glib::wrap(font, true /* take_copy */);
31
32     return slot(cppFont);
33   #ifdef GLIBMM_EXCEPTIONS_ENABLED
34   }
35   catch(...)
36   {
37     Glib::exception_handlers_invoke();
38   }
39
40   return false; //arbitrary default
41   #endif //GLIBMM_EXCEPTIONS_ENABLED
42 }
43
44
45 namespace Pango
46 {
47
48 void Fontset::foreach(const ForeachSlot& slot)
49 {
50   pango_fontset_foreach(gobj(), &fontset_foreach_callback, (void*)&slot); 
51 }
52            
53 } //namespace