Inkscape
Vector Graphics Editor
|
A container of widgets for selecting font faces. More...
#include <font-selector.h>
Public Member Functions | |
FontSelector (bool with_size=true, bool with_variations=true) | |
Constructor. | |
void | hide_others () |
void | update_font () |
Update GUI based on fontspec. | |
void | update_size (double size) |
void | unset_model () override |
void | set_model () override |
Glib::ustring | get_fontspec (bool use_variations=true) |
Get fontspec based on current settings. | |
double | get_fontsize () |
Get font size. | |
sigc::connection | connectChanged (sigc::slot< void(Glib::ustring)> slot) |
Let others know that user has changed GUI settings. | |
![]() | |
virtual | ~FontSelectorInterface () |
Static Public Member Functions | |
static std::unique_ptr< FontSelectorInterface > | create_font_selector () |
Protected Attributes | |
Gtk::Frame | family_frame |
Gtk::ScrolledWindow | family_scroll |
Gtk::TreeView | family_treeview |
Gtk::TreeViewColumn | family_treecolumn |
Gtk::CellRendererText | family_cell |
Gtk::Frame | style_frame |
Gtk::ScrolledWindow | style_scroll |
Gtk::TreeView | style_treeview |
Gtk::TreeViewColumn | style_treecolumn |
Gtk::CellRendererText | style_cell |
Gtk::Label | size_label |
Gtk::ComboBoxText | size_combobox |
Gtk::ScrolledWindow | font_variations_scroll |
FontVariations | font_variations |
Private Member Functions | |
void | set_sizes () |
void | set_fontsize_tooltip () |
void | style_cell_data_func (Gtk::CellRenderer *renderer, Gtk::TreeModel::const_iterator const &iter) |
void | on_family_changed () |
void | on_style_changed () |
void | on_size_changed () |
void | on_variations_changed () |
void | changed_emit () |
void | update_variations (const Glib::ustring &fontspec) |
bool | set_cell_markup () |
void | on_realize_list () |
Glib::RefPtr< Gdk::ContentProvider > | on_drag_prepare (double x, double y) |
void | on_drag_begin (Gtk::DragSource &source, Glib::RefPtr< Gdk::Drag > const &drag) |
Gtk::Widget * | box () override |
Glib::ustring | get_fontspec () const override |
double | get_fontsize () const override |
void | set_current_font (const Glib::ustring &family, const Glib::ustring &face) override |
void | set_current_size (double size) override |
sigc::signal< void()> & | signal_changed () override |
sigc::signal< void()> & | signal_apply () override |
Private Attributes | |
sigc::signal< void(Glib::ustring)> | _signal_changed |
sigc::signal< void()> | _signal_apply |
bool | signal_block |
sigc::scoped_connection | _idle_connection |
double | font_size |
bool | initial = true |
sigc::signal< void()> | dummy |
A container of widgets for selecting font faces.
It is used by the TextEdit and Glyphs panel dialogs. The FontSelector class utilizes the FontLister class to obtain a list of font-families and their associated styles for fonts either on the system or in the document. The FontLister class is also used by the Text toolbar. Fonts are kept track of by their "fontspecs" which are the same as the strings that Pango generates.
The main functions are: Create the font-selector widget. Update the child widgets when a new text selection is made. Update the Style list when a new font-family is selected, highlighting the best match to the original font style (as not all fonts have the same style options). Emit a signal when any change is made to a child widget.
Definition at line 76 of file font-selector.h.
Inkscape::UI::Widget::FontSelector::FontSelector | ( | bool | with_size = true , |
bool | with_variations = true |
||
) |
Constructor.
Definition at line 47 of file font-selector.cpp.
References Inkscape::append(), Inkscape::UI::Widget::FontVariations::connectChanged(), Inkscape::FontLister::FontStyleListClass::cssStyle, family_cell, family_frame, family_scroll, family_treecolumn, family_treeview, font_lister_cell_data_func_markup(), font_lister_separator_func(), Inkscape::FontLister::font_style_list, font_variations, font_variations_scroll, Inkscape::FontLister::get_font_list(), Inkscape::FontLister::get_fontspec(), Inkscape::FontLister::get_instance(), Inkscape::FontLister::get_style_list(), Inkscape::UI::Widget::height, on_drag_begin(), on_drag_prepare(), on_family_changed(), on_realize_list(), on_size_changed(), on_style_changed(), on_variations_changed(), set_sizes(), size_combobox, size_label, style_cell, style_cell_data_func(), style_frame, style_scroll, style_treecolumn, style_treeview, Inkscape::FontLister::update_font_list(), and update_variations().
|
inlineoverrideprivatevirtual |
Implements FontSelectorInterface.
Definition at line 149 of file font-selector.h.
|
private |
Definition at line 527 of file font-selector.cpp.
References _idle_connection, _signal_apply, _signal_changed, family_cell, family_treecolumn, font_lister_cell_data_func(), get_fontspec(), initial, set_cell_markup(), and signal_block.
Referenced by on_family_changed(), on_size_changed(), on_style_changed(), and on_variations_changed().
|
inline |
Let others know that user has changed GUI settings.
(Used to enable 'Apply' and 'Default' buttons.)
Definition at line 181 of file font-selector.h.
References _signal_changed.
Referenced by Inkscape::UI::Dialog::GlyphsPanel::GlyphsPanel().
|
static |
Definition at line 43 of file font-selector.cpp.
Referenced by Inkscape::UI::Dialog::TextEdit::TextEdit().
|
inline |
Get font size.
Could be merged with fontspec.
Definition at line 175 of file font-selector.h.
References font_size.
|
inlineoverrideprivatevirtual |
Implements FontSelectorInterface.
Definition at line 151 of file font-selector.h.
References font_size.
|
inlineoverrideprivatevirtual |
Implements FontSelectorInterface.
Definition at line 150 of file font-selector.h.
References get_fontspec().
Referenced by changed_emit(), get_fontspec(), on_style_changed(), and Inkscape::UI::Dialog::GlyphsPanel::rebuild().
Glib::ustring Inkscape::UI::Widget::FontSelector::get_fontspec | ( | bool | use_variations = true | ) |
Get fontspec based on current settings.
(Does not handle size, yet.)
Definition at line 338 of file font-selector.cpp.
References family_treeview, font_variations, Inkscape::UI::Widget::FontVariations::get_pango_string(), and style_treeview.
void Inkscape::UI::Widget::FontSelector::hide_others | ( | ) |
Definition at line 184 of file font-selector.cpp.
References font_variations_scroll, size_combobox, size_label, and style_frame.
Referenced by Inkscape::UI::Dialog::FontCollectionsManager::FontCollectionsManager().
|
private |
Definition at line 194 of file font-selector.cpp.
References family_treeview.
Referenced by FontSelector().
|
private |
Definition at line 205 of file font-selector.cpp.
References Inkscape::FontLister::get_dragging_family(), and Inkscape::FontLister::get_instance().
Referenced by FontSelector().
|
private |
Definition at line 410 of file font-selector.cpp.
References changed_emit(), Inkscape::FontLister::FontStyleListClass::cssStyle, Inkscape::FontLister::FontStyleListClass::displayStyle, family_treeview, Inkscape::FontLister::get_instance(), signal_block, and style_treeview.
Referenced by FontSelector().
|
private |
Definition at line 171 of file font-selector.cpp.
References _idle_connection, family_cell, family_treecolumn, font_lister_cell_data_func(), and set_cell_markup().
Referenced by FontSelector().
|
private |
Definition at line 486 of file font-selector.cpp.
References changed_emit(), font_size, Inkscape::Preferences::get(), Inkscape::Preferences::getInt(), signal_block, Inkscape::size, and size_combobox.
Referenced by FontSelector().
|
private |
Definition at line 472 of file font-selector.cpp.
References changed_emit(), get_fontspec(), signal_block, and update_variations().
Referenced by FontSelector().
|
private |
Definition at line 518 of file font-selector.cpp.
References changed_emit(), and signal_block.
Referenced by FontSelector().
|
private |
Definition at line 176 of file font-selector.cpp.
References family_cell, family_treecolumn, family_treeview, and font_lister_cell_data_func_markup().
Referenced by changed_emit(), and on_realize_list().
|
inlineoverrideprivatevirtual |
Implements FontSelectorInterface.
Definition at line 152 of file font-selector.h.
References update_font().
|
inlineoverrideprivatevirtual |
Implements FontSelectorInterface.
Definition at line 153 of file font-selector.h.
References Inkscape::size, and update_size().
|
private |
Definition at line 241 of file font-selector.cpp.
References Inkscape::ustring::format_classic(), Inkscape::Preferences::get(), Inkscape::Preferences::getInt(), size_combobox, SP_CSS_UNIT_PT, and sp_style_get_css_unit_string().
Referenced by update_size().
|
overridevirtual |
Implements FontSelectorInterface.
Definition at line 328 of file font-selector.cpp.
References family_treeview, Inkscape::FontLister::get_font_list(), and Inkscape::FontLister::get_instance().
Referenced by Inkscape::UI::Dialog::FontCollectionsManager::on_search_entry_changed().
|
private |
Definition at line 217 of file font-selector.cpp.
References Inkscape::ustring::format_classic(), Inkscape::Preferences::get(), Inkscape::Preferences::getInt(), Inkscape::size, size_combobox, and SP_CSS_UNIT_PT.
Referenced by FontSelector().
|
inlineoverrideprivatevirtual |
Implements FontSelectorInterface.
Definition at line 155 of file font-selector.h.
References _signal_apply.
|
inlineoverrideprivatevirtual |
|
private |
Definition at line 385 of file font-selector.cpp.
References family_treeview.
Referenced by FontSelector().
|
overridevirtual |
Implements FontSelectorInterface.
Definition at line 323 of file font-selector.cpp.
References family_treeview.
Referenced by Inkscape::UI::Dialog::FontCollectionsManager::on_search_entry_changed().
void Inkscape::UI::Widget::FontSelector::update_font | ( | ) |
Update GUI based on fontspec.
Definition at line 253 of file font-selector.cpp.
References family_treeview, Inkscape::FontLister::get_instance(), signal_block, style_treeview, and update_variations().
Referenced by Inkscape::UI::Dialog::GlyphsPanel::readSelection(), and set_current_font().
void Inkscape::UI::Widget::FontSelector::update_size | ( | double | size | ) |
Definition at line 309 of file font-selector.cpp.
References font_size, set_fontsize_tooltip(), signal_block, Inkscape::size, and size_combobox.
Referenced by set_current_size().
|
private |
Definition at line 540 of file font-selector.cpp.
References font_variations, font_variations_scroll, Inkscape::UI::Widget::FontVariations::update(), and Inkscape::UI::Widget::FontVariations::variations_present().
Referenced by FontSelector(), on_style_changed(), and update_font().
|
private |
Definition at line 132 of file font-selector.h.
Referenced by changed_emit(), and on_realize_list().
|
private |
Definition at line 128 of file font-selector.h.
Referenced by changed_emit(), and signal_apply().
|
private |
Definition at line 127 of file font-selector.h.
Referenced by changed_emit(), and connectChanged().
|
private |
Definition at line 156 of file font-selector.h.
Referenced by signal_changed().
|
protected |
Definition at line 94 of file font-selector.h.
Referenced by changed_emit(), FontSelector(), on_realize_list(), and set_cell_markup().
|
protected |
Definition at line 90 of file font-selector.h.
Referenced by FontSelector().
|
protected |
Definition at line 91 of file font-selector.h.
Referenced by FontSelector().
|
protected |
Definition at line 93 of file font-selector.h.
Referenced by changed_emit(), FontSelector(), on_realize_list(), and set_cell_markup().
|
protected |
Definition at line 92 of file font-selector.h.
Referenced by FontSelector(), get_fontspec(), on_drag_begin(), on_family_changed(), set_cell_markup(), set_model(), style_cell_data_func(), unset_model(), and update_font().
|
private |
Definition at line 135 of file font-selector.h.
Referenced by get_fontsize(), get_fontsize(), on_size_changed(), and update_size().
|
protected |
Definition at line 109 of file font-selector.h.
Referenced by FontSelector(), get_fontspec(), and update_variations().
|
protected |
Definition at line 108 of file font-selector.h.
Referenced by FontSelector(), hide_others(), and update_variations().
|
private |
Definition at line 137 of file font-selector.h.
Referenced by changed_emit().
|
private |
Definition at line 130 of file font-selector.h.
Referenced by changed_emit(), on_family_changed(), on_size_changed(), on_style_changed(), on_variations_changed(), update_font(), and update_size().
|
protected |
Definition at line 105 of file font-selector.h.
Referenced by FontSelector(), hide_others(), on_size_changed(), set_fontsize_tooltip(), set_sizes(), and update_size().
|
protected |
Definition at line 104 of file font-selector.h.
Referenced by FontSelector(), and hide_others().
|
protected |
Definition at line 101 of file font-selector.h.
Referenced by FontSelector().
|
protected |
Definition at line 97 of file font-selector.h.
Referenced by FontSelector(), and hide_others().
|
protected |
Definition at line 98 of file font-selector.h.
Referenced by FontSelector().
|
protected |
Definition at line 100 of file font-selector.h.
Referenced by FontSelector().
|
protected |
Definition at line 99 of file font-selector.h.
Referenced by FontSelector(), get_fontspec(), on_family_changed(), and update_font().