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

Unified Diff: ui/gfx/pango_util.cc

Issue 659883002: Enable hidpi on Linux, refactor a bit on Windows to share Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resource bundle loading Created 6 years, 2 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
Index: ui/gfx/pango_util.cc
diff --git a/ui/gfx/pango_util.cc b/ui/gfx/pango_util.cc
index a324b7b326c373323420c8a2cfeba7a9d11c1325..3b8016a3ab12154697d4180204afbc5d04697ba4 100644
--- a/ui/gfx/pango_util.cc
+++ b/ui/gfx/pango_util.cc
@@ -85,27 +85,6 @@ cairo_font_options_t* CreateCairoFontOptions(const FontRenderParams& params) {
return cairo_font_options;
}
-// Returns the DPI that should be used by Pango.
-double GetPangoDPI() {
- static double dpi = -1.0;
- if (dpi < 0.0) {
- const gfx::LinuxFontDelegate* delegate = gfx::LinuxFontDelegate::instance();
- if (delegate)
- dpi = delegate->GetFontDPI();
- if (dpi <= 0.0)
- dpi = 96.0;
- }
- return dpi;
-}
-
-// Returns the number of pixels in a point.
-// - multiply a point size by this to get pixels ("device units")
-// - divide a pixel size by this to get points
-double GetPixelsInPoint() {
- static double pixels_in_point = GetPangoDPI() / 72.0; // 72 points in an inch
- return pixels_in_point;
-}
-
} // namespace
void SetUpPangoLayout(
@@ -162,8 +141,7 @@ void SetUpPangoLayout(
// Set the layout's resolution to match the resolution used to convert from
// points to pixels.
- pango_cairo_context_set_resolution(pango_layout_get_context(layout),
- GetPangoDPI());
+ pango_cairo_context_set_resolution(pango_layout_get_context(layout), 96.0);
// Set text and accelerator character if needed.
if (flags & Canvas::SHOW_PREFIX) {
@@ -206,7 +184,7 @@ int GetPangoFontSizeInPixels(PangoFontDescription* pango_font) {
return pango_font_description_get_size(pango_font) / PANGO_SCALE;
// Otherwise, we need to convert from points.
- return static_cast<int>(GetPixelsInPoint() *
+ return static_cast<int>((96.0 / 72.0) *
pango_font_description_get_size(pango_font) / PANGO_SCALE + 0.5);
}

Powered by Google App Engine
This is Rietveld 408576698