5
* Font selection widgets
8
* Chris Lahey <clahey@ximian.com>
9
* Lauris Kaplinski <lauris@kaplinski.com>
11
* Copyright (C) 1999-2001 Ximian, Inc.
12
* Copyright (C) 2002 Lauris Kaplinski
14
* Released under GNU GPL, read the file 'COPYING' for more information
19
#include "nrtype-forward.h"
20
#include "nr-type-primitives.h"
25
* This class enumerates fonts using libnrtype into reusable data stores and
26
* allows for random access to the font list
38
virtual ~FontLister ();
40
/** GtkTreeModelColumnRecord for the font list Gtk::ListStore
43
: public Gtk::TreeModelColumnRecord
46
/** Column containing the family name
48
Gtk::TreeModelColumn<Glib::ustring> font;
50
/** Column containing an std::vector<std::string> with style names
51
* for the corresponding family
53
Gtk::TreeModelColumn<GList*> styles;
62
/* Case-insensitive < compare for standard strings */
66
bool operator () (std::string str1, std::string str2) const
68
std::string s1=str1; // Can't transform the originals!
70
std::transform(s1.begin(), s1.end(), s1.begin(), (int(*)(int)) toupper);
71
std::transform(s2.begin(), s2.end(), s2.begin(), (int(*)(int)) toupper);
76
FontListClass FontList;
77
typedef std::map<Glib::ustring, Gtk::TreePath, StringLessThan> IterMapType;
79
/** Returns the ListStore with the font names
81
* The return is const and the function is declared as const.
82
* The ListStore is ready to be used after class instantiation
83
* and should not (cannot) be modified.
85
const Glib::RefPtr<Gtk::ListStore>
86
get_font_list () const;
88
static Inkscape::FontLister*
91
static Inkscape::FontLister* instance = new Inkscape::FontLister();
96
get_row_for_font (Glib::ustring family)
98
IterMapType::iterator iter = font_list_store_iter_map.find (family);
99
if (iter == font_list_store_iter_map.end ()) throw FAMILY_NOT_FOUND;
100
return (*iter).second;
104
get_name_list () const
116
Glib::RefPtr<Gtk::ListStore> font_list_store;
117
IterMapType font_list_store_iter_map;
127
c-file-style:"stroustrup"
128
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
133
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :