| Index: ui/gfx/pango_util.cc
|
| diff --git a/ui/gfx/pango_util.cc b/ui/gfx/pango_util.cc
|
| index a324b7b326c373323420c8a2cfeba7a9d11c1325..bdec8d49717cb6f08ce19e9b5c8866e2c067e7ec 100644
|
| --- a/ui/gfx/pango_util.cc
|
| +++ b/ui/gfx/pango_util.cc
|
| @@ -28,6 +28,9 @@ namespace {
|
| // Marker for accelerators in the text.
|
| const gunichar kAcceleratorChar = '&';
|
|
|
| +const double kStandardDPI = 96.0;
|
| +const double kPointsPerInch = 72.0;
|
| +
|
| // Creates and returns a PangoContext. The caller owns the context.
|
| PangoContext* GetPangoContext() {
|
| PangoFontMap* font_map = pango_cairo_font_map_get_default();
|
| @@ -85,27 +88,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(
|
| @@ -163,7 +145,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());
|
| + kStandardDPI);
|
|
|
| // Set text and accelerator character if needed.
|
| if (flags & Canvas::SHOW_PREFIX) {
|
| @@ -205,9 +187,10 @@ int GetPangoFontSizeInPixels(PangoFontDescription* pango_font) {
|
| if (pango_font_description_get_size_is_absolute(pango_font))
|
| return pango_font_description_get_size(pango_font) / PANGO_SCALE;
|
|
|
| + const double scale = kStandardDPI / kPointsPerInch;
|
| // Otherwise, we need to convert from points.
|
| - return static_cast<int>(GetPixelsInPoint() *
|
| - pango_font_description_get_size(pango_font) / PANGO_SCALE + 0.5);
|
| + return static_cast<int>(
|
| + scale * pango_font_description_get_size(pango_font) / PANGO_SCALE + 0.5);
|
| }
|
|
|
| PangoFontMetrics* GetPangoFontMetrics(PangoFontDescription* desc) {
|
|
|