Restoring the FonButton in Preferences (#3540)

This commit is contained in:
Hombre
2016-12-18 22:50:59 +01:00
parent 7de1ec2d66
commit c993906d07
10 changed files with 126 additions and 14 deletions

View File

@@ -56,6 +56,7 @@ Glib::ustring creditsPath;
Glib::ustring licensePath;
Glib::ustring argv1;
bool simpleEditor;
Glib::RefPtr<Gtk::CssProvider> cssForced;
Glib::RefPtr<Gtk::CssProvider> cssRT;
//Glib::Threads::Thread* mainThread;
@@ -332,6 +333,19 @@ int main(int argc, char **argv)
} catch (...) {
printf("Error: Can't load css file \"%s\"\n", filename.c_str());
}
// Set the font face and size
if (options.fontFamily != "default") {
try {
cssForced = Gtk::CssProvider::create();
cssForced->load_from_data (Glib::ustring::compose("* { font-family: %1; font-size: %2pt }", options.fontFamily, options.fontSize));
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());
} catch (...) {
printf("Error: Can't find the font named \"%s\"\n", options.fontFamily.c_str());
}
}
}
#ifndef NDEBUG