Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5839)

Unified Diff: chrome/browser/ui/libgtkui/gtk_ui.cc

Issue 2683653006: Don't allow font scale to be lower than 1.0 (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/libgtkui/gtk_ui.cc
diff --git a/chrome/browser/ui/libgtkui/gtk_ui.cc b/chrome/browser/ui/libgtkui/gtk_ui.cc
index 6d128f557a51d898214bfe26573027bf00a43440..7e45ffc7c65e4df9f512163dba4d1928415ff1ca 100644
--- a/chrome/browser/ui/libgtkui/gtk_ui.cc
+++ b/chrome/browser/ui/libgtkui/gtk_ui.cc
@@ -374,25 +374,6 @@ float GetRawDeviceScaleFactor() {
return GetDpi() / kDefaultDPI;
}
-// Returns the font size for the *raw* device scale factor in points.
-// The |ui_device_scale_factor| is used to cancel the scale to be applied by UI
-// and to compensate the scale when the device_scale_factor is floored.
-double GetFontSizePixelsInPoint(float ui_device_scale_factor) {
- // There are 72 points in an inch.
- double point = GetDpi() / 72.0;
-
- // Take device_scale_factor into account — if Chrome already scales the
- // entire UI up by 2x, we should not also scale up.
- point /= ui_device_scale_factor;
-
- // Allow the scale lower than 1.0 only for fonts. Don't always use
- // the raw value however, because the 1.0~1.3 is rounded to 1.0.
- float raw_scale = GetRawDeviceScaleFactor();
- if (raw_scale < 1.0f)
- return point * raw_scale / ui_device_scale_factor;
- return point;
-}
-
views::LinuxUI::NonClientMiddleClickAction GetDefaultMiddleClickAction() {
std::unique_ptr<base::Environment> env(base::Environment::Create());
switch (base::nix::GetDesktopEnvironment(env.get())) {
@@ -1027,9 +1008,9 @@ void Gtk2UI::UpdateDefaultFont() {
// Round the value when converting to pixels to match GTK's logic.
const double size_points = pango_font_description_get_size(desc) /
static_cast<double>(PANGO_SCALE);
- default_font_size_pixels_ = static_cast<int>(
- GetFontSizePixelsInPoint(GetDeviceScaleFactor()) * size_points);
- query.point_size = static_cast<int>(size_points);
+ default_font_size_pixels_ =
+ static_cast<int>(kDefaultDPI / 72.0 * size_points + 0.5);
+ query.point_size = static_cast<int>(size_points);
}
query.style = gfx::Font::NORMAL;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698