26#include <unordered_map>
28#include <glibmm/ustring.h>
29#include <glibmm/stringutils.h>
31#include <gtkmm/liststore.h>
32#include <gtkmm/treemodel.h>
33#include <gtkmm/treemodelcolumn.h>
34#include <gtkmm/treepath.h>
92 using Styles = std::vector<StyleNames>;
100 Gtk::TreeModelColumn<Glib::ustring>
family;
103 Gtk::TreeModelColumn<std::shared_ptr<Styles>>
styles;
204 std::pair<Glib::ustring, Glib::ustring>
ui_from_fontspec(Glib::ustring
const &fontspec)
const;
217 void set_fontspec(Glib::ustring
const &fontspec,
bool check =
true);
229 std::pair<Glib::ustring, Glib::ustring>
new_font_family(Glib::ustring
const &family,
bool check_style =
true);
239 std::pair<Glib::ustring, Glib::ustring>
set_font_family(Glib::ustring
const &family,
bool check_style =
true,
250 std::pair<Glib::ustring, Glib::ustring>
set_font_family(
int row,
bool check_style =
true,
bool emit =
true);
298 std::pair<Gtk::TreePath, Gtk::TreePath>
get_paths(Glib::ustring
const &family, Glib::ustring
const &style);
372 Gtk::TreeModel::const_iterator
const &iter);
375 Gtk::TreeModel::const_iterator
const &iter);
378 Gtk::TreeModel::const_iterator
const &iter);
381 Gtk::TreeModel::const_iterator
const &iter,
385 Gtk::TreeModel::const_iterator
const &iter);
This class enumerates fonts using libnrtype into reusable data stores and allows for random access to...
Glib::ustring get_font_family_markup(Gtk::TreeModel::const_iterator const &iter) const
Get markup for font-family.
Gtk::TreeModel::Row get_row_for_style()
std::pair< bool, std::string > get_font_count_label() const
void insert_font_family(Glib::ustring const &new_family)
Inserts a font family or font-fallback list (for use when not already in document or on system).
Glib::ustring current_style
void update_font_data_recursive(SPObject &r, std::map< Glib::ustring, std::set< Glib::ustring > > &font_data)
bool find_string_case_insensitive(std::string const &text, std::string const &pat)
Takes a hand written font spec and returns a Pango generated one in standard form.
Gtk::TreePath get_path_for_style(Glib::ustring const &style)
void set_fontspec(Glib::ustring const &fontspec, bool check=true)
Sets current_fontspec, etc.
int current_family_row
Info for currently selected font (what is shown in the UI).
std::pair< Glib::ustring, Glib::ustring > new_font_family(Glib::ustring const &family, bool check_style=true)
Changes font-family, updating style list and attempting to find closest style to current_style style ...
Glib::ustring const & get_dragging_family() const
int get_font_families_size() const
Glib::ustring current_family
std::pair< Glib::ustring, Glib::ustring > ui_from_fontspec(Glib::ustring const &fontspec) const
Gets font-family and style from fontspec.
void set_font_style(Glib::ustring style, bool emit=true)
Sets style.
std::pair< Glib::ustring, Glib::ustring > selection_update()
Sets font-family and style after a selection change.
Glib::RefPtr< Gtk::ListStore > const & get_style_list() const
void update_font_list(SPDocument *document)
Updates font list to include fonts in document.
void init_default_styles()
Glib::RefPtr< Gtk::ListStore > style_list_store
Glib::RefPtr< Gtk::ListStore > font_list_store
Glib::ustring canonize_fontspec(Glib::ustring const &fontspec) const
void fill_css(SPCSSAttr *css, Glib::ustring fontspec={})
Fill css using given fontspec (doesn't need to be member function).
void apply_collections(std::set< Glib::ustring > &selected_collections)
std::shared_ptr< Styles > default_styles
If a font-family is not on system, this list of styles is used.
void ensureRowStyles(Gtk::TreeModel::iterator iter)
Ensures the style list for a particular family has been created.
Gtk::TreeModel::Row get_row_for_font()
std::vector< StyleNames > Styles
Gtk::TreePath get_path_for_font(Glib::ustring const &family)
int get_font_family_row() const
Glib::ustring system_fontspec(Glib::ustring const &fontspec)
Find closest system font to given font.
sigc::signal< void()> new_fonts_signal
void font_family_row_update(int start=0)
std::map< std::string, PangoFontFamily * > pango_family_map
The list of fonts, sorted by the order they will appear in the UI.
void init_font_families(int group_offset=-1, int group_size=-1)
int add_document_fonts_at_top(SPDocument *document)
Glib::ustring const & get_font_style() const
bool font_installed_on_system(Glib::ustring const &font) const
bool is_path_for_font(Gtk::TreePath path, Glib::ustring family)
void show_results(Glib::ustring const &search_text)
static Inkscape::FontLister * get_instance()
FontStyleListClass font_style_list
std::pair< Gtk::TreePath, Gtk::TreePath > get_paths(Glib::ustring const &family, Glib::ustring const &style)
Glib::RefPtr< Gtk::ListStore > const & get_font_list() const
Glib::ustring get_best_style_match(Glib::ustring const &family, Glib::ustring const &style)
Return best style match for new font given style for old font.
std::pair< Glib::ustring, Glib::ustring > set_font_family(Glib::ustring const &family, bool check_style=true, bool emit=true)
Sets font-family, updating style list and attempting to find closest style to old current_style.
void set_dragging_family(Glib::ustring const &new_family)
sigc::connection connectNewFonts(sigc::slot< void()> slot)
Glib::ustring get_fontspec() const
sigc::connection connectUpdate(sigc::slot< void()> slot)
Let users of FontLister know to update GUI.
Glib::ustring const & get_font_family() const
Glib::ustring dragging_family
sigc::signal< void()> update_signal
Glib::ustring fontspec_from_style(SPStyle *style) const
Typed SVG document implementation.
SPObject is an abstract base class of all of the document nodes at the SVG document level.
std::shared_ptr< Css const > css
constexpr int FONT_FAMILIES_GROUP_SIZE
void font_lister_cell_data_func_markup(Gtk::CellRenderer *renderer, Gtk::TreeModel::const_iterator const &iter)
void font_lister_style_cell_data_func(Gtk::CellRenderer *renderer, Gtk::TreeModel::const_iterator const &iter)
bool font_lister_separator_func(Glib::RefPtr< Gtk::TreeModel > const &model, Gtk::TreeModel::const_iterator const &iter)
void font_lister_cell_data_func(Gtk::CellRenderer *renderer, Gtk::TreeModel::const_iterator const &iter)
void font_lister_cell_data_func2(Gtk::CellRenderer &cell, Gtk::TreeModel::const_iterator const &iter, bool with_markup)
Helper class to stream background task notifications as a series of messages.
GtkTreeModelColumnRecord for the font-family list Gtk::ListStore.
Gtk::TreeModelColumn< std::shared_ptr< Styles > > styles
Styles for each family name.
Gtk::TreeModelColumn< Glib::ustring > family
Family name.
Gtk::TreeModelColumn< PangoFontFamily * > pango_family
Not actually a column.
Gtk::TreeModelColumn< bool > onSystem
Whether font is on system.
Gtk::TreeModelColumn< Glib::ustring > cssStyle
Column containing the styles in CSS/Pango format.
Gtk::TreeModelColumn< Glib::ustring > displayStyle
Column containing the styles as Font designer used.