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

Unified Diff: ui/gfx/platform_font_pango.cc

Issue 403923002: Make GetCustomFontRenderParams() pass font style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove an extra assignment Created 6 years, 5 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/platform_font_pango.cc
diff --git a/ui/gfx/platform_font_pango.cc b/ui/gfx/platform_font_pango.cc
index 394363f498a0cc6d31190381b09e3f0a887a1134..39f0bb8ff9bf6c6a8ac85f552a944b55d88d3798 100644
--- a/ui/gfx/platform_font_pango.cc
+++ b/ui/gfx/platform_font_pango.cc
@@ -94,20 +94,15 @@ PlatformFontPango::PlatformFontPango() {
}
PlatformFontPango::PlatformFontPango(NativeFont native_font) {
- const int pango_size =
- pango_font_description_get_size(native_font) / PANGO_SCALE;
- const bool pango_using_pixels =
- pango_font_description_get_size_is_absolute(native_font);
-
std::string font_family;
std::vector<std::string> family_names;
base::SplitString(pango_font_description_get_family(native_font), ',',
&family_names);
- const FontRenderParams params = GetCustomFontRenderParams(
- false, &family_names,
- pango_using_pixels ? &pango_size : NULL /* pixel_size */,
- !pango_using_pixels ? &pango_size : NULL /* point_size */,
- &font_family);
+
+ const int pango_size =
+ pango_font_description_get_size(native_font) / PANGO_SCALE;
+ const bool pango_using_pixels =
+ pango_font_description_get_size_is_absolute(native_font);
int style = 0;
// TODO(davemoore) What should we do about other weights? We currently only
@@ -118,6 +113,12 @@ PlatformFontPango::PlatformFontPango(NativeFont native_font) {
if (pango_font_description_get_style(native_font) == PANGO_STYLE_ITALIC)
style |= gfx::Font::ITALIC;
+ const FontRenderParams params = GetCustomFontRenderParams(
+ false, &family_names,
+ pango_using_pixels ? &pango_size : NULL /* pixel_size */,
+ !pango_using_pixels ? &pango_size : NULL /* point_size */,
+ &style, &font_family);
+
InitFromDetails(skia::RefPtr<SkTypeface>(), font_family,
gfx::GetPangoFontSizeInPixels(native_font), style, params);
}
@@ -125,10 +126,11 @@ PlatformFontPango::PlatformFontPango(NativeFont native_font) {
PlatformFontPango::PlatformFontPango(const std::string& font_name,
int font_size_pixels) {
const std::vector<std::string> font_list(1, font_name);
+ const int style = Font::NORMAL;
const FontRenderParams params = GetCustomFontRenderParams(
- false, &font_list, &font_size_pixels, NULL, NULL);
+ false, &font_list, &font_size_pixels, NULL, &style, NULL);
InitFromDetails(skia::RefPtr<SkTypeface>(), font_name, font_size_pixels,
- SkTypeface::kNormal, params);
Daniel Erat 2014/07/19 01:34:44 this was a bug, but luckily both enums use 0 for "
msw 2014/07/19 03:11:52 Acknowledged; thanks for fixing it.
+ style, params);
}
double PlatformFontPango::underline_position() const {
@@ -169,13 +171,9 @@ Font PlatformFontPango::DeriveFont(int size_delta, int style) const {
skia::RefPtr<SkTypeface> typeface =
(style == style_) ? typeface_ : CreateSkTypeface(style, &new_family);
- // If the size or family changed, get updated rendering settings.
- FontRenderParams render_params = font_render_params_;
- if (size_delta != 0 || new_family != font_family_) {
- const std::vector<std::string> family_list(1, new_family);
- render_params = GetCustomFontRenderParams(
- false, &family_list, &new_size, NULL, NULL);
- }
+ const std::vector<std::string> family_list(1, new_family);
+ const FontRenderParams render_params = GetCustomFontRenderParams(
+ false, &family_list, &new_size, NULL, &style, NULL);
return Font(new PlatformFontPango(typeface,
new_family,
« ui/gfx/font_render_params_linux.cc ('K') | « ui/gfx/font_render_params_linux_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698