Chromium Code Reviews| Index: ui/views/style/typography_provider.cc |
| diff --git a/ui/views/style/typography_provider.cc b/ui/views/style/typography_provider.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..45755dff532acae9c1a66bcc577f6a37de992d90 |
| --- /dev/null |
| +++ b/ui/views/style/typography_provider.cc |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ui/views/style/typography_provider.h" |
| + |
| +#include "base/logging.h" |
| +#include "ui/base/default_style.h" |
| +#include "ui/base/resource/resource_bundle.h" |
| +#include "ui/views/style/typography.h" |
| + |
| +namespace views { |
| + |
| +const gfx::FontList& DefaultTypographyProvider::GetFont(int context, |
| + int style) const { |
| + int size_delta; |
| + gfx::Font::Weight font_weight; |
| + GetDefaultFont(context, style, &size_delta, &font_weight); |
| + constexpr gfx::Font::FontStyle kFontStyle = gfx::Font::NORMAL; |
|
Peter Kasting
2017/03/17 02:26:01
Nit: Not sure deinlining this really buys much rea
tapted
2017/03/17 10:33:11
Done.
|
| + return ResourceBundle::GetSharedInstance().GetFontListWithDelta( |
| + size_delta, kFontStyle, font_weight); |
| +} |
| + |
| +void DefaultTypographyProvider::GetDefaultFont( |
| + int context, |
| + int style, |
| + int* size_delta, |
| + gfx::Font::Weight* font_weight) const { |
| + switch (context) { |
| + case typography::CONTEXT_DIALOG_TITLE: |
| + *size_delta = ui::kTitleFontSizeDelta; |
| + break; |
| + default: |
| + *size_delta = ui::kLabelFontSizeDelta; |
| + break; |
| + } |
| + |
| + switch (style) { |
| + case typography::STYLE_ACTIVE_TAB: |
| + *font_weight = gfx::Font::Weight::BOLD; |
| + break; |
| + default: |
| + *font_weight = gfx::Font::Weight::NORMAL; |
| + break; |
| + } |
| +} |
| + |
| +SkColor DefaultTypographyProvider::GetColor(int context, int style) const { |
| + return SK_ColorBLACK; |
| +} |
| + |
| +int DefaultTypographyProvider::GetLineHeight(int context, int style) const { |
| + return 0; |
| +} |
| + |
| +} // namespace views |