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

Side by Side Diff: ui/views/style/typography_provider.cc

Issue 2734113006: "Bootstrap" a toolkit-views Typography spec. (Closed)
Patch Set: Rebase Created 3 years, 9 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 unified diff | Download patch
OLDNEW
(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 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.
20 return ResourceBundle::GetSharedInstance().GetFontListWithDelta(
21 size_delta, kFontStyle, font_weight);
22 }
23
24 void DefaultTypographyProvider::GetDefaultFont(
25 int context,
26 int style,
27 int* size_delta,
28 gfx::Font::Weight* font_weight) const {
29 switch (context) {
30 case typography::CONTEXT_DIALOG_TITLE:
31 *size_delta = ui::kTitleFontSizeDelta;
32 break;
33 default:
34 *size_delta = ui::kLabelFontSizeDelta;
35 break;
36 }
37
38 switch (style) {
39 case typography::STYLE_ACTIVE_TAB:
40 *font_weight = gfx::Font::Weight::BOLD;
41 break;
42 default:
43 *font_weight = gfx::Font::Weight::NORMAL;
44 break;
45 }
46 }
47
48 SkColor DefaultTypographyProvider::GetColor(int context, int style) const {
49 return SK_ColorBLACK;
50 }
51
52 int DefaultTypographyProvider::GetLineHeight(int context, int style) const {
53 return 0;
54 }
55
56 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698