Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
document-fonts.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * This file contains document used fonts related logic. The functions to manage the
4 * document fonts are defined in this file.
5 *
6 * Authors:
7 * Vaibhav Malik <vaibhavmalik2018@gmail.com>
8 *
9 * The contents of this file may be used under the GNU General Public License Version 2 or later.
10 *
11 */
12
13#include "document-fonts.h"
14
15// #include <iostream>
16
17namespace Inkscape {
18
20{
21 static DocumentFonts instance;
22 return &instance;
23}
24
29
30/*
31void DocumentFonts::print_document_fonts()
32{
33 std::cout << std::endl << "********************" << std::endl;
34
35 for(auto const& font: _document_fonts) {
36 std::cout << font << std::endl;
37 }
38
39 std::cout << std::endl << "********************" << std::endl;
40}
41*/
42
43void DocumentFonts::update_document_fonts(std::map<Glib::ustring, std::set<Glib::ustring>> const &font_data)
44{
45 // Clear the old fonts and then insert latest set.
46 clear();
47
48 // Iterate over all the fonts in this map,
49 // and insert these fonts into the document_fonts.
50 for(auto const &ele: font_data) {
51 _document_fonts.insert(ele.first);
52 }
53
54 // Emit the update signal to keep everything consistent.
55 update_signal.emit();
56}
57
58// Returns the fonts used in the document.
59std::set<Glib::ustring> const &DocumentFonts::get_fonts() const
60{
61 return _document_fonts;
62}
63
64} // namespace Inkscape
65
66/*
67 Local Variables:
68 mode:c++
69 c-file-style:"stroustrup"
70 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
71 indent-tabs-mode:nil
72 fill-column:99
73 End:
74*/
75// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
std::set< Glib::ustring > const & get_fonts() const
sigc::signal< void()> update_signal
void update_document_fonts(std::map< Glib::ustring, std::set< Glib::ustring > > const &font_data)
std::set< Glib::ustring > _document_fonts
static DocumentFonts * get()
Helper class to stream background task notifications as a series of messages.