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

Unified Diff: chrome/browser/ui/views/harmony/chrome_typography.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: chrome/browser/ui/views/harmony/chrome_typography.cc
diff --git a/chrome/browser/ui/views/harmony/chrome_typography.cc b/chrome/browser/ui/views/harmony/chrome_typography.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f128f7c969f0c934839eb435b916725d789ef192
--- /dev/null
+++ b/chrome/browser/ui/views/harmony/chrome_typography.cc
@@ -0,0 +1,43 @@
+// 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 "chrome/browser/ui/views/harmony/chrome_typography.h"
+
+#include "ui/base/default_style.h"
+#include "ui/base/resource/resource_bundle.h"
+
+const gfx::FontList& LegacyTypographyProvider::GetFont(int text_context,
+ int text_style) const {
+ constexpr int kHeadlineDelta = 8;
+ constexpr int kDialogMessageDelta = 1;
+
+ int size_delta;
+ gfx::Font::Weight font_weight;
+ GetDefaultFont(text_context, text_style, &size_delta, &font_weight);
+
+ switch (text_context) {
+ case CONTEXT_HEADLINE:
+ size_delta = kHeadlineDelta;
+ break;
+ case CONTEXT_BODY_TEXT_LARGE:
+ // Note: Not using ui::kMessageFontSizeDelta, so 13pt in most cases.
+ size_delta = kDialogMessageDelta;
+ break;
+ case CONTEXT_BODY_TEXT_SMALL:
+ size_delta = ui::kLabelFontSizeDelta;
+ break;
+ case CONTEXT_DEPRECATED_SMALL:
+ size_delta = ui::ResourceBundle::kSmallFontDelta;
+ break;
+ }
+
+ switch (text_style) {
+ case STYLE_EMPHASIZED:
+ font_weight = gfx::Font::Weight::BOLD;
+ break;
+ }
+ constexpr gfx::Font::FontStyle kFontStyle = gfx::Font::NORMAL;
+ return ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta(
+ size_delta, kFontStyle, font_weight);
+}

Powered by Google App Engine
This is Rietveld 408576698