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

Unified Diff: ui/gfx/platform_font_pango.cc

Issue 789583002: Updates subpixel positioning and hinting when DSF is changed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: linux fix Created 6 years 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 | « ui/gfx/platform_font_pango.h ('k') | ui/gfx/platform_font_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/platform_font_pango.cc
diff --git a/ui/gfx/platform_font_pango.cc b/ui/gfx/platform_font_pango.cc
index 1cac87ad29d65667f814720bc5890a7d3812898b..96c601ac632c3851cd282a495e0cd2cb2a285ab9 100644
--- a/ui/gfx/platform_font_pango.cc
+++ b/ui/gfx/platform_font_pango.cc
@@ -201,7 +201,19 @@ int PlatformFontPango::GetFontSize() const {
return font_size_pixels_;
}
-const FontRenderParams& PlatformFontPango::GetFontRenderParams() const {
+const FontRenderParams& PlatformFontPango::GetFontRenderParams() {
+#if defined(OS_CHROMEOS)
+ float current_scale_factor = gfx::GetFontRenderParamsDeviceScaleFactor();
+ if (current_scale_factor != device_scale_factor_) {
+ FontRenderParamsQuery query(false);
+ query.families.push_back(font_family_);
+ query.pixel_size = font_size_pixels_;
+ query.style = style_;
+ query.device_scale_factor = current_scale_factor;
+ font_render_params_ = gfx::GetFontRenderParams(query, nullptr);
+ device_scale_factor_ = current_scale_factor;
+ }
+#endif
return font_render_params_;
}
@@ -260,6 +272,9 @@ void PlatformFontPango::InitFromDetails(
font_size_pixels_ = font_size_pixels;
style_ = style;
+#if defined(OS_CHROMEOS)
+ device_scale_factor_ = gfx::GetFontRenderParamsDeviceScaleFactor();
+#endif
font_render_params_ = render_params;
SkPaint paint;
@@ -285,6 +300,9 @@ void PlatformFontPango::InitFromPlatformFont(const PlatformFontPango* other) {
cap_height_pixels_ = other->cap_height_pixels_;
pango_metrics_inited_ = other->pango_metrics_inited_;
average_width_pixels_ = other->average_width_pixels_;
+#if defined(OS_CHROMEOS)
+ device_scale_factor_ = other->device_scale_factor_;
+#endif
}
void PlatformFontPango::PaintSetup(SkPaint* paint) const {
« no previous file with comments | « ui/gfx/platform_font_pango.h ('k') | ui/gfx/platform_font_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698