merge with dev

This commit is contained in:
Desmis
2019-04-16 10:59:38 +02:00
12 changed files with 59 additions and 34 deletions

View File

@@ -106,12 +106,6 @@ RTWindow::RTWindow ()
Gtk::Settings::get_for_screen (screen)->property_gtk_theme_name() = "Adwaita";
Gtk::Settings::get_for_screen (screen)->property_gtk_application_prefer_dark_theme() = true;
#if defined(__APPLE__)
// This will force screen resolution regarding font, but I don't think it's compliant with Gtk guidelines...
// Do not confuse with screen scaling, where everything is scaled up !
screen->set_resolution (96.);
#endif
Glib::RefPtr<Glib::Regex> regex = Glib::Regex::create (THEMEREGEXSTR, Glib::RegexCompileFlags::REGEX_CASELESS);
Glib::ustring filename;
Glib::MatchInfo mInfo;
@@ -170,7 +164,9 @@ RTWindow::RTWindow ()
css = Glib::ustring::compose ("* { font-family: %1; font-size: %2pt}", options.fontFamily, options.fontSize * (int)initialGdkScale);
#endif
//GTK318
fontScale = options.fontSize / 9.f;
if (options.pseudoHiDPISupport) {
fontScale = options.fontSize / (float)RTScalable::baseFontSize;
}
if (options.rtSettings.verbose) {
printf("\"Non-Default\" font size(%d) * scale(%d) / fontScale(%.3f)\n", options.fontSize, (int)initialGdkScale, fontScale);
}
@@ -184,27 +180,27 @@ RTWindow::RTWindow ()
int resolution = (int)style->get_screen()->get_resolution();
if (isPix) {
// HOMBRE: guessing here...
// if resolution is lower than 192ppi, we're supposing that it's already expressed in a scale==1 scenario
// if resolution is lower than baseHiDPI, we're supposing that it's already expressed in a scale==1 scenario
if (resolution >= int(RTScalable::baseHiDPI)) {
// converting the resolution to a scale==1 scenario
resolution /= 2;
}
// 1pt = 1/72in @ 96 ppi
// HOMBRE: If the font unit is px, is it already scaled up to match the resolution ?
// px >inch >pt >"scaled pt"
pt = (int)(double(fontSize) / RTScalable::baseDPI * 72. * (RTScalable::baseHiDPI / resolution) + 0.49);
// px >inch >pt >"scaled pt"
pt = (int)(double(fontSize) / RTScalable::baseDPI * 72. * (96. / (double)resolution) + 0.49);
} else {
pt = fontSize / Pango::SCALE;
}
fontScale = (float)pt / 9.f;
if ((int)initialGdkScale > 1 || pt != 9) {
if (options.pseudoHiDPISupport) {
fontScale = (float)pt / (float)RTScalable::baseFontSize;
}
if ((int)initialGdkScale > 1 || pt != RTScalable::baseFontSize) {
css = Glib::ustring::compose ("* { font-size: %1pt}", pt * (int)initialGdkScale);
if (options.rtSettings.verbose) {
printf("\"Default\" font size(%d) * scale(%d) / fontScale(%.3f)\n", pt, (int)initialGdkScale, fontScale);
}
}
} else {
fontScale = 1.f;
}
}
if (!css.empty()) {