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

Unified Diff: chrome/browser/ui/extensions/icon_with_badge_image_source.cc

Issue 1819753003: Allow various font weights in gfx. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a lost comment and modify a render text unittest to not test black because of test env font con… Created 4 years, 7 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 | « chrome/browser/ui/cocoa/omnibox/omnibox_view_mac_unittest.mm ('k') | chrome/browser/ui/libgtk2ui/gtk2_ui.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/extensions/icon_with_badge_image_source.cc
diff --git a/chrome/browser/ui/extensions/icon_with_badge_image_source.cc b/chrome/browser/ui/extensions/icon_with_badge_image_source.cc
index 2e01d6755fb3521b36e003e5baace866e009545e..7045c4459dd4457db64dd811bd72871bf64e8571 100644
--- a/chrome/browser/ui/extensions/icon_with_badge_image_source.cc
+++ b/chrome/browser/ui/extensions/icon_with_badge_image_source.cc
@@ -69,7 +69,8 @@ SkPaint* GetBadgeTextPaintSingleton() {
text_paint->setTextAlign(SkPaint::kLeft_Align);
sk_sp<SkTypeface> typeface(
- SkTypeface::CreateFromName(kPreferredTypeface, SkTypeface::kBold));
+ SkTypeface::MakeFromName(kPreferredTypeface,
+ SkFontStyle::FromOldStyle(SkTypeface::kBold)));
// Skia doesn't do any font fallback---if the user is missing the font then
// typeface will be NULL. If we don't do manual fallback then we'll crash.
if (typeface) {
@@ -81,8 +82,8 @@ SkPaint* GetBadgeTextPaintSingleton() {
// that don't have Arial.
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont);
- typeface = sk_sp<SkTypeface>(SkTypeface::CreateFromName(
- base_font.GetFontName().c_str(), SkTypeface::kNormal));
+ typeface = sk_sp<SkTypeface>(SkTypeface::MakeFromName(
+ base_font.GetFontName().c_str(), SkFontStyle()));
DCHECK(typeface);
}
@@ -187,7 +188,8 @@ void IconWithBadgeImageSource::PaintBadge(gfx::Canvas* canvas) {
for (size_t i = 0; i < kMaxIncrementAttempts; ++i) {
int w = 0;
int h = 0;
- gfx::FontList bigger_font = base_font.Derive(1, 0);
+ gfx::FontList bigger_font =
+ base_font.Derive(1, 0, gfx::Font::Weight::NORMAL);
gfx::Canvas::SizeStringInt(utf16_text, bigger_font, &w, &h, 0,
gfx::Canvas::NO_ELLIPSIS);
if (h > kBadgeHeight)
« no previous file with comments | « chrome/browser/ui/cocoa/omnibox/omnibox_view_mac_unittest.mm ('k') | chrome/browser/ui/libgtk2ui/gtk2_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698