OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/views/style/typography_provider.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "ui/base/default_style.h" |
| 9 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/views/style/typography.h" |
| 11 |
| 12 namespace views { |
| 13 |
| 14 const gfx::FontList& DefaultTypographyProvider::GetFont(int context, |
| 15 int style) const { |
| 16 int size_delta; |
| 17 gfx::Font::Weight font_weight; |
| 18 GetDefaultFont(context, style, &size_delta, &font_weight); |
| 19 return ResourceBundle::GetSharedInstance().GetFontListWithDelta( |
| 20 size_delta, gfx::Font::NORMAL, font_weight); |
| 21 } |
| 22 |
| 23 void DefaultTypographyProvider::GetDefaultFont( |
| 24 int context, |
| 25 int style, |
| 26 int* size_delta, |
| 27 gfx::Font::Weight* font_weight) const { |
| 28 switch (context) { |
| 29 case style::CONTEXT_DIALOG_TITLE: |
| 30 *size_delta = ui::kTitleFontSizeDelta; |
| 31 break; |
| 32 default: |
| 33 *size_delta = ui::kLabelFontSizeDelta; |
| 34 break; |
| 35 } |
| 36 |
| 37 switch (style) { |
| 38 case style::STYLE_TAB_ACTIVE: |
| 39 *font_weight = gfx::Font::Weight::BOLD; |
| 40 break; |
| 41 default: |
| 42 *font_weight = gfx::Font::Weight::NORMAL; |
| 43 break; |
| 44 } |
| 45 } |
| 46 |
| 47 SkColor DefaultTypographyProvider::GetColor(int context, int style) const { |
| 48 return SK_ColorBLACK; |
| 49 } |
| 50 |
| 51 int DefaultTypographyProvider::GetLineHeight(int context, int style) const { |
| 52 return 0; |
| 53 } |
| 54 |
| 55 } // namespace views |
OLD | NEW |