Fix font size from FontButton, behave differently from Gtk3.18 vs. 3.20
Gtk3.18 use px unit, Gtk3.20 use pt unit. Font selection does not necessarily select the correct font where variant exists, expect strange result. Nothing will be done to fix that.
This commit is contained in:
parent
19cabcb9b2
commit
adb2ec1241
@ -338,7 +338,13 @@ int main(int argc, char **argv)
|
||||
if (options.fontFamily != "default") {
|
||||
try {
|
||||
cssForced = Gtk::CssProvider::create();
|
||||
//GTK318
|
||||
#if GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 20
|
||||
cssForced->load_from_data (Glib::ustring::compose("* { font-family: %1; font-size: %2px }", options.fontFamily, options.fontSize));
|
||||
#else
|
||||
cssForced->load_from_data (Glib::ustring::compose("* { font-family: %1; font-size: %2pt }", options.fontFamily, options.fontSize));
|
||||
#endif
|
||||
//GTK318
|
||||
Gtk::StyleContext::add_provider_for_screen(screen, cssForced, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
} catch (Glib::Error &err) {
|
||||
printf("Error: \"%s\"\n", err.what().c_str());
|
||||
|
@ -2112,7 +2112,13 @@ void Preferences::switchFontTo(const Glib::ustring &newFontFamily, const int new
|
||||
}
|
||||
|
||||
try {
|
||||
//GTK318
|
||||
#if GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 20
|
||||
fontcss->load_from_data (Glib::ustring::compose("* { font-family: %1; font-size: %2px }", newFontFamily, newFontSize));
|
||||
#else
|
||||
fontcss->load_from_data (Glib::ustring::compose("* { font-family: %1; font-size: %2pt }", newFontFamily, newFontSize));
|
||||
#endif
|
||||
//GTK318
|
||||
} catch (Glib::Error &err) {
|
||||
printf("Error: \"%s\"\n", err.what().c_str());
|
||||
} catch (...) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user