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

Unified Diff: ui/views/style/typography_provider.cc

Issue 2734113006: "Bootstrap" a toolkit-views Typography spec. (Closed)
Patch Set: Rebase (conflict in layout_delegate.h due to r457774) 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 side-by-side diff with in-line comments
Download patch
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..521e2bf8ddba781e3ea5305f2df7ac4a8cd2867b
--- /dev/null
+++ b/ui/views/style/typography_provider.cc
@@ -0,0 +1,55 @@
+// 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);
+ return ResourceBundle::GetSharedInstance().GetFontListWithDelta(
+ size_delta, gfx::Font::NORMAL, font_weight);
+}
+
+void DefaultTypographyProvider::GetDefaultFont(
+ int context,
+ int style,
+ int* size_delta,
+ gfx::Font::Weight* font_weight) const {
+ switch (context) {
+ case style::CONTEXT_DIALOG_TITLE:
+ *size_delta = ui::kTitleFontSizeDelta;
+ break;
+ default:
+ *size_delta = ui::kLabelFontSizeDelta;
+ break;
+ }
+
+ switch (style) {
+ case style::STYLE_TAB_ACTIVE:
+ *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

Powered by Google App Engine
This is Rietveld 408576698