Inkscape
Vector Graphics Editor
font-variants.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Author:
4 * Tavmjong Bah <tavmjong@free.fr>
5 *
6 * Copyright (C) 2015, 2018 Tavmong Bah
7 *
8 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
9 */
10
11#ifndef INKSCAPE_UI_WIDGET_FONT_VARIANT_H
12#define INKSCAPE_UI_WIDGET_FONT_VARIANT_H
13
14#include <map>
15#include <string>
16#include <gtkmm/box.h>
17#include <gtkmm/checkbutton.h>
18#include <gtkmm/entry.h>
19#include <gtkmm/expander.h>
20#include <gtkmm/grid.h>
21#include <gtkmm/label.h>
22#include <gtkmm/checkbutton.h>
23
24class SPDesktop;
25class SPObject;
26class SPStyle;
27class SPCSSAttr;
28
29namespace Inkscape::UI::Widget {
30
31class Feature;
32
36class FontVariants final : public Gtk::Box
37{
38public:
40
41private:
42 // Ligatures: To start, use four check buttons.
43 Gtk::Expander _ligatures_frame;
44 Gtk::Grid _ligatures_grid;
45 Gtk::CheckButton _ligatures_common;
46 Gtk::CheckButton _ligatures_discretionary;
47 Gtk::CheckButton _ligatures_historical;
48 Gtk::CheckButton _ligatures_contextual;
53
54 // Position: Exclusive options
55 Gtk::Expander _position_frame;
56 Gtk::Grid _position_grid;
57 Gtk::CheckButton _position_normal;
58 Gtk::CheckButton _position_sub;
59 Gtk::CheckButton _position_super;
60
61 // Caps: Exclusive options (maybe a dropdown menu to save space?)
62 Gtk::Expander _caps_frame;
63 Gtk::Grid _caps_grid;
64 Gtk::CheckButton _caps_normal;
65 Gtk::CheckButton _caps_small;
66 Gtk::CheckButton _caps_all_small;
67 Gtk::CheckButton _caps_petite;
68 Gtk::CheckButton _caps_all_petite;
69 Gtk::CheckButton _caps_unicase;
70 Gtk::CheckButton _caps_titling;
71
72 // Numeric: Complicated!
73 Gtk::Expander _numeric_frame;
74 Gtk::Grid _numeric_grid;
75
76 Gtk::CheckButton _numeric_default_style;
77 Gtk::CheckButton _numeric_lining;
79 Gtk::CheckButton _numeric_old_style;
81
82 Gtk::CheckButton _numeric_default_width;
83 Gtk::CheckButton _numeric_proportional;
85 Gtk::CheckButton _numeric_tabular;
87
89 Gtk::CheckButton _numeric_diagonal;
91 Gtk::CheckButton _numeric_stacked;
93
94 Gtk::CheckButton _numeric_ordinal;
96
97 Gtk::CheckButton _numeric_slashed_zero;
99
100 // East Asian: Complicated!
101 Gtk::Expander _asian_frame;
102 Gtk::Grid _asian_grid;
103
104 Gtk::CheckButton _asian_default_variant;
105 Gtk::CheckButton _asian_jis78;
106 Gtk::CheckButton _asian_jis83;
107 Gtk::CheckButton _asian_jis90;
108 Gtk::CheckButton _asian_jis04;
109 Gtk::CheckButton _asian_simplified;
110 Gtk::CheckButton _asian_traditional;
111
112 Gtk::CheckButton _asian_default_width;
113 Gtk::CheckButton _asian_full_width;
115
116 Gtk::CheckButton _asian_ruby;
117
118 // -----
119 Gtk::Expander _feature_frame;
120 Gtk::Grid _feature_grid;
122 Gtk::Entry _feature_entry;
123 Gtk::Label _feature_label;
124 Gtk::Label _feature_list;
126
127 void ligatures_init();
128 void ligatures_callback();
129
130 void position_init();
131 void position_callback();
132
133 void caps_init();
134 void caps_callback();
135
136 void numeric_init();
137 void numeric_callback();
138
139 void asian_init();
140 void asian_callback();
141
142 void feature_init();
143public:
144 void feature_callback();
145
146private:
147 // To determine if we need to write out property (may not be necessary)
150 unsigned _caps_all;
151 unsigned _numeric_all;
152 unsigned _asian_all;
153
156 unsigned _caps_mix;
157 unsigned _numeric_mix;
158 unsigned _asian_mix;
159
166
167 std::map<std::string, Feature*> _features;
168
169 sigc::signal<void ()> _changed_signal;
170
171public:
172
176 void update( SPStyle const *query, bool different_features, Glib::ustring& font_spec );
177
181 void update_opentype( Glib::ustring& font_spec );
182
186 void fill_css( SPCSSAttr* css );
187
191 Glib::ustring get_markup();
192
197 sigc::connection connectChanged(sigc::slot<void ()> slot) {
198 return _changed_signal.connect(slot);
199 }
200};
201
202} // namespace Inkscape::UI::Widget
203
204#endif // INKSCAPE_UI_WIDGET_FONT_VARIANT_H
205
206/*
207 Local Variables:
208 mode:c++
209 c-file-style:"stroustrup"
210 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
211 indent-tabs-mode:nil
212 fill-column:99
213 End:
214*/
215// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 :
A container for selecting font variants (OpenType Features).
Definition: font-variants.h:37
void update(SPStyle const *query, bool different_features, Glib::ustring &font_spec)
Update GUI based on query results.
Gtk::CheckButton _numeric_proportional
Definition: font-variants.h:83
Gtk::CheckButton _numeric_default_fractions
Definition: font-variants.h:88
Gtk::CheckButton _numeric_default_width
Definition: font-variants.h:82
Gtk::CheckButton _ligatures_contextual
Definition: font-variants.h:48
Gtk::CheckButton _ligatures_discretionary
Definition: font-variants.h:46
sigc::signal< void()> _changed_signal
void fill_css(SPCSSAttr *css)
Fill SPCSSAttr based on settings of buttons.
Gtk::CheckButton _ligatures_historical
Definition: font-variants.h:47
Glib::ustring get_markup()
Get CSS string for markup.
Gtk::CheckButton _asian_proportional_width
std::map< std::string, Feature * > _features
Gtk::CheckButton _numeric_slashed_zero
Definition: font-variants.h:97
Gtk::CheckButton _numeric_default_style
Definition: font-variants.h:76
void update_opentype(Glib::ustring &font_spec)
Update GUI based on OpenType features of selected font.
sigc::connection connectChanged(sigc::slot< void()> slot)
Let others know that user has changed GUI settings.
To do: update description of desktop.
Definition: desktop.h:150
SPObject is an abstract base class of all of the document nodes at the SVG document level.
Definition: sp-object.h:146
An SVG style object.
Definition: style.h:45
std::shared_ptr< Css const > css
Custom widgets.
Definition: desktop.h:127