Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::UI::Widget::FontSelector Class Reference

A container of widgets for selecting font faces. More...

#include <font-selector.h>

Inheritance diagram for Inkscape::UI::Widget::FontSelector:
FontSelectorInterface

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.
 
- Public Member Functions inherited from FontSelectorInterface
virtual ~FontSelectorInterface ()
 

Static Public Member Functions

static std::unique_ptr< FontSelectorInterfacecreate_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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ FontSelector()

Member Function Documentation

◆ box()

Gtk::Widget * Inkscape::UI::Widget::FontSelector::box ( )
inlineoverrideprivatevirtual

Implements FontSelectorInterface.

Definition at line 149 of file font-selector.h.

◆ changed_emit()

◆ connectChanged()

sigc::connection Inkscape::UI::Widget::FontSelector::connectChanged ( sigc::slot< void(Glib::ustring)>  slot)
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().

◆ create_font_selector()

std::unique_ptr< FontSelectorInterface > Inkscape::UI::Widget::FontSelector::create_font_selector ( )
static

Definition at line 43 of file font-selector.cpp.

Referenced by Inkscape::UI::Dialog::TextEdit::TextEdit().

◆ get_fontsize() [1/2]

double Inkscape::UI::Widget::FontSelector::get_fontsize ( )
inline

Get font size.

Could be merged with fontspec.

Definition at line 175 of file font-selector.h.

References font_size.

◆ get_fontsize() [2/2]

double Inkscape::UI::Widget::FontSelector::get_fontsize ( ) const
inlineoverrideprivatevirtual

Implements FontSelectorInterface.

Definition at line 151 of file font-selector.h.

References font_size.

◆ get_fontspec() [1/2]

Glib::ustring Inkscape::UI::Widget::FontSelector::get_fontspec ( ) const
inlineoverrideprivatevirtual

◆ get_fontspec() [2/2]

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.

◆ hide_others()

void Inkscape::UI::Widget::FontSelector::hide_others ( )

◆ on_drag_begin()

void Inkscape::UI::Widget::FontSelector::on_drag_begin ( Gtk::DragSource &  source,
Glib::RefPtr< Gdk::Drag > const &  drag 
)
private

Definition at line 194 of file font-selector.cpp.

References family_treeview.

Referenced by FontSelector().

◆ on_drag_prepare()

Glib::RefPtr< Gdk::ContentProvider > Inkscape::UI::Widget::FontSelector::on_drag_prepare ( double  x,
double  y 
)
private

◆ on_family_changed()

◆ on_realize_list()

void Inkscape::UI::Widget::FontSelector::on_realize_list ( )
private

◆ on_size_changed()

void Inkscape::UI::Widget::FontSelector::on_size_changed ( )
private

◆ on_style_changed()

void Inkscape::UI::Widget::FontSelector::on_style_changed ( )
private

Definition at line 472 of file font-selector.cpp.

References changed_emit(), get_fontspec(), signal_block, and update_variations().

Referenced by FontSelector().

◆ on_variations_changed()

void Inkscape::UI::Widget::FontSelector::on_variations_changed ( )
private

Definition at line 518 of file font-selector.cpp.

References changed_emit(), and signal_block.

Referenced by FontSelector().

◆ set_cell_markup()

bool Inkscape::UI::Widget::FontSelector::set_cell_markup ( )
private

◆ set_current_font()

void Inkscape::UI::Widget::FontSelector::set_current_font ( const Glib::ustring &  family,
const Glib::ustring &  face 
)
inlineoverrideprivatevirtual

Implements FontSelectorInterface.

Definition at line 152 of file font-selector.h.

References update_font().

◆ set_current_size()

void Inkscape::UI::Widget::FontSelector::set_current_size ( double  size)
inlineoverrideprivatevirtual

Implements FontSelectorInterface.

Definition at line 153 of file font-selector.h.

References Inkscape::size, and update_size().

◆ set_fontsize_tooltip()

void Inkscape::UI::Widget::FontSelector::set_fontsize_tooltip ( )
private

◆ set_model()

void Inkscape::UI::Widget::FontSelector::set_model ( )
overridevirtual

◆ set_sizes()

void Inkscape::UI::Widget::FontSelector::set_sizes ( )
private

◆ signal_apply()

sigc::signal< void()> & Inkscape::UI::Widget::FontSelector::signal_apply ( )
inlineoverrideprivatevirtual

Implements FontSelectorInterface.

Definition at line 155 of file font-selector.h.

References _signal_apply.

◆ signal_changed()

sigc::signal< void()> & Inkscape::UI::Widget::FontSelector::signal_changed ( )
inlineoverrideprivatevirtual

Implements FontSelectorInterface.

Definition at line 154 of file font-selector.h.

References dummy.

◆ style_cell_data_func()

void Inkscape::UI::Widget::FontSelector::style_cell_data_func ( Gtk::CellRenderer *  renderer,
Gtk::TreeModel::const_iterator const &  iter 
)
private

Definition at line 385 of file font-selector.cpp.

References family_treeview.

Referenced by FontSelector().

◆ unset_model()

void Inkscape::UI::Widget::FontSelector::unset_model ( )
overridevirtual

◆ update_font()

void Inkscape::UI::Widget::FontSelector::update_font ( )

◆ update_size()

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().

◆ update_variations()

void Inkscape::UI::Widget::FontSelector::update_variations ( const Glib::ustring &  fontspec)
private

Member Data Documentation

◆ _idle_connection

sigc::scoped_connection Inkscape::UI::Widget::FontSelector::_idle_connection
private

Definition at line 132 of file font-selector.h.

Referenced by changed_emit(), and on_realize_list().

◆ _signal_apply

sigc::signal<void ()> Inkscape::UI::Widget::FontSelector::_signal_apply
private

Definition at line 128 of file font-selector.h.

Referenced by changed_emit(), and signal_apply().

◆ _signal_changed

sigc::signal<void (Glib::ustring)> Inkscape::UI::Widget::FontSelector::_signal_changed
private

Definition at line 127 of file font-selector.h.

Referenced by changed_emit(), and connectChanged().

◆ dummy

sigc::signal<void ()> Inkscape::UI::Widget::FontSelector::dummy
private

Definition at line 156 of file font-selector.h.

Referenced by signal_changed().

◆ family_cell

Gtk::CellRendererText Inkscape::UI::Widget::FontSelector::family_cell
protected

Definition at line 94 of file font-selector.h.

Referenced by changed_emit(), FontSelector(), on_realize_list(), and set_cell_markup().

◆ family_frame

Gtk::Frame Inkscape::UI::Widget::FontSelector::family_frame
protected

Definition at line 90 of file font-selector.h.

Referenced by FontSelector().

◆ family_scroll

Gtk::ScrolledWindow Inkscape::UI::Widget::FontSelector::family_scroll
protected

Definition at line 91 of file font-selector.h.

Referenced by FontSelector().

◆ family_treecolumn

Gtk::TreeViewColumn Inkscape::UI::Widget::FontSelector::family_treecolumn
protected

Definition at line 93 of file font-selector.h.

Referenced by changed_emit(), FontSelector(), on_realize_list(), and set_cell_markup().

◆ family_treeview

Gtk::TreeView Inkscape::UI::Widget::FontSelector::family_treeview
protected

◆ font_size

double Inkscape::UI::Widget::FontSelector::font_size
private

Definition at line 135 of file font-selector.h.

Referenced by get_fontsize(), get_fontsize(), on_size_changed(), and update_size().

◆ font_variations

FontVariations Inkscape::UI::Widget::FontSelector::font_variations
protected

Definition at line 109 of file font-selector.h.

Referenced by FontSelector(), get_fontspec(), and update_variations().

◆ font_variations_scroll

Gtk::ScrolledWindow Inkscape::UI::Widget::FontSelector::font_variations_scroll
protected

Definition at line 108 of file font-selector.h.

Referenced by FontSelector(), hide_others(), and update_variations().

◆ initial

bool Inkscape::UI::Widget::FontSelector::initial = true
private

Definition at line 137 of file font-selector.h.

Referenced by changed_emit().

◆ signal_block

bool Inkscape::UI::Widget::FontSelector::signal_block
private

◆ size_combobox

Gtk::ComboBoxText Inkscape::UI::Widget::FontSelector::size_combobox
protected

◆ size_label

Gtk::Label Inkscape::UI::Widget::FontSelector::size_label
protected

Definition at line 104 of file font-selector.h.

Referenced by FontSelector(), and hide_others().

◆ style_cell

Gtk::CellRendererText Inkscape::UI::Widget::FontSelector::style_cell
protected

Definition at line 101 of file font-selector.h.

Referenced by FontSelector().

◆ style_frame

Gtk::Frame Inkscape::UI::Widget::FontSelector::style_frame
protected

Definition at line 97 of file font-selector.h.

Referenced by FontSelector(), and hide_others().

◆ style_scroll

Gtk::ScrolledWindow Inkscape::UI::Widget::FontSelector::style_scroll
protected

Definition at line 98 of file font-selector.h.

Referenced by FontSelector().

◆ style_treecolumn

Gtk::TreeViewColumn Inkscape::UI::Widget::FontSelector::style_treecolumn
protected

Definition at line 100 of file font-selector.h.

Referenced by FontSelector().

◆ style_treeview

Gtk::TreeView Inkscape::UI::Widget::FontSelector::style_treeview
protected

Definition at line 99 of file font-selector.h.

Referenced by FontSelector(), get_fontspec(), on_family_changed(), and update_font().


The documentation for this class was generated from the following files: