Setting 12pt as base font size for MacOS (see issue #5282)

This commit is contained in:
Hombre57 2019-04-14 11:10:01 +02:00
parent d01d99481d
commit ace5a01136
2 changed files with 6 additions and 4 deletions

View File

@ -42,9 +42,11 @@ public:
#ifdef __APPLE__ #ifdef __APPLE__
static constexpr double baseDPI = 72.; static constexpr double baseDPI = 72.;
static constexpr double baseHiDPI = 144.; static constexpr double baseHiDPI = 144.;
static constexpr int baseFontSize = 12;
#else #else
static constexpr double baseDPI = 96.; static constexpr double baseDPI = 96.;
static constexpr double baseHiDPI = 192.; static constexpr double baseHiDPI = 192.;
static constexpr int baseFontSize = 9;
#endif #endif
static void init(Gtk::Window *window); static void init(Gtk::Window *window);

View File

@ -170,7 +170,7 @@ RTWindow::RTWindow ()
css = Glib::ustring::compose ("* { font-family: %1; font-size: %2pt}", options.fontFamily, options.fontSize * (int)initialGdkScale); css = Glib::ustring::compose ("* { font-family: %1; font-size: %2pt}", options.fontFamily, options.fontSize * (int)initialGdkScale);
#endif #endif
//GTK318 //GTK318
fontScale = options.fontSize / 9.f; fontScale = options.fontSize / (float)RTScalable::baseFontSize;
if (options.rtSettings.verbose) { if (options.rtSettings.verbose) {
printf("\"Non-Default\" font size(%d) * scale(%d) / fontScale(%.3f)\n", options.fontSize, (int)initialGdkScale, fontScale); printf("\"Non-Default\" font size(%d) * scale(%d) / fontScale(%.3f)\n", options.fontSize, (int)initialGdkScale, fontScale);
} }
@ -192,12 +192,12 @@ RTWindow::RTWindow ()
// 1pt = 1/72in @ 96 ppi // 1pt = 1/72in @ 96 ppi
// HOMBRE: If the font unit is px, is it already scaled up to match the resolution ? // HOMBRE: If the font unit is px, is it already scaled up to match the resolution ?
// px >inch >pt >"scaled pt" // px >inch >pt >"scaled pt"
pt = (int)(double(fontSize) / RTScalable::baseDPI * 72. * (RTScalable::baseDPI / resolution) + 0.49); pt = (int)(double(fontSize) / RTScalable::baseDPI * 72. * (96. / (double)resolution) + 0.49);
} else { } else {
pt = fontSize / Pango::SCALE; pt = fontSize / Pango::SCALE;
} }
fontScale = (float)pt / 9.f; fontScale = (float)pt / (float)RTScalable::baseFontSize;
if ((int)initialGdkScale > 1 || pt != 9) { if ((int)initialGdkScale > 1 || pt != RTScalable::baseFontSize) {
css = Glib::ustring::compose ("* { font-size: %1pt}", pt * (int)initialGdkScale); css = Glib::ustring::compose ("* { font-size: %1pt}", pt * (int)initialGdkScale);
if (options.rtSettings.verbose) { if (options.rtSettings.verbose) {
printf("\"Default\" font size(%d) * scale(%d) / fontScale(%.3f)\n", pt, (int)initialGdkScale, fontScale); printf("\"Default\" font size(%d) * scale(%d) / fontScale(%.3f)\n", pt, (int)initialGdkScale, fontScale);