OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/harmony/chrome_typography.h" | 5 #include "chrome/browser/ui/views/harmony/chrome_typography.h" |
6 | 6 |
7 #include "ui/base/default_style.h" | 7 #include "ui/base/default_style.h" |
8 #include "ui/base/resource/resource_bundle.h" | 8 #include "ui/base/resource/resource_bundle.h" |
9 | 9 |
10 const gfx::FontList& LegacyTypographyProvider::GetFont(int text_context, | 10 const gfx::FontList& LegacyTypographyProvider::GetFont(int text_context, |
11 int text_style) const { | 11 int text_style) const { |
12 constexpr int kHeadlineDelta = 8; | 12 constexpr int kHeadlineDelta = 8; |
13 constexpr int kDialogMessageDelta = 1; | 13 constexpr int kDialogMessageDelta = 1; |
14 | 14 |
15 int size_delta; | 15 int size_delta; |
16 gfx::Font::Weight font_weight; | 16 gfx::Font::Weight font_weight; |
17 GetDefaultFont(text_context, text_style, &size_delta, &font_weight); | 17 GetDefaultFont(text_context, text_style, &size_delta, &font_weight); |
18 | 18 |
| 19 #if defined(USE_ASH) |
| 20 ash::ApplyAshFontStyles(text_context, text_style, &size_delta, &font_weight); |
| 21 #endif |
| 22 |
19 switch (text_context) { | 23 switch (text_context) { |
20 case CONTEXT_HEADLINE: | 24 case CONTEXT_HEADLINE: |
21 size_delta = kHeadlineDelta; | 25 size_delta = kHeadlineDelta; |
22 break; | 26 break; |
23 case CONTEXT_BODY_TEXT_LARGE: | 27 case CONTEXT_BODY_TEXT_LARGE: |
24 // Note: Not using ui::kMessageFontSizeDelta, so 13pt in most cases. | 28 // Note: Not using ui::kMessageFontSizeDelta, so 13pt in most cases. |
25 size_delta = kDialogMessageDelta; | 29 size_delta = kDialogMessageDelta; |
26 break; | 30 break; |
27 case CONTEXT_BODY_TEXT_SMALL: | 31 case CONTEXT_BODY_TEXT_SMALL: |
28 size_delta = ui::kLabelFontSizeDelta; | 32 size_delta = ui::kLabelFontSizeDelta; |
29 break; | 33 break; |
30 case CONTEXT_DEPRECATED_SMALL: | 34 case CONTEXT_DEPRECATED_SMALL: |
31 size_delta = ui::ResourceBundle::kSmallFontDelta; | 35 size_delta = ui::ResourceBundle::kSmallFontDelta; |
32 break; | 36 break; |
33 } | 37 } |
34 | 38 |
35 switch (text_style) { | 39 switch (text_style) { |
36 case STYLE_EMPHASIZED: | 40 case STYLE_EMPHASIZED: |
37 font_weight = gfx::Font::Weight::BOLD; | 41 font_weight = gfx::Font::Weight::BOLD; |
38 break; | 42 break; |
39 } | 43 } |
40 constexpr gfx::Font::FontStyle kFontStyle = gfx::Font::NORMAL; | 44 constexpr gfx::Font::FontStyle kFontStyle = gfx::Font::NORMAL; |
41 return ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta( | 45 return ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta( |
42 size_delta, kFontStyle, font_weight); | 46 size_delta, kFontStyle, font_weight); |
43 } | 47 } |
OLD | NEW |