Index: ui/views/style/typography.h |
diff --git a/ui/views/style/typography.h b/ui/views/style/typography.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2312fd4802893f818e4d6ead42eba86bdde59880 |
--- /dev/null |
+++ b/ui/views/style/typography.h |
@@ -0,0 +1,81 @@ |
+// 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. |
+ |
+#ifndef UI_VIEWS_STYLE_TYPOGRAPHY_H_ |
+#define UI_VIEWS_STYLE_TYPOGRAPHY_H_ |
+ |
+#include "third_party/skia/include/core/SkColor.h" |
+#include "ui/views/views_export.h" |
+ |
+namespace gfx { |
+class FontList; |
+} |
+ |
+namespace views { |
+namespace typography { |
sky
2017/03/16 16:23:51
How about putting this in the style namespace? Two
tapted
2017/03/17 10:33:11
Done.
|
+ |
+// Where a piece of text appears in the UI. This influences size and weight, but |
+// typically not style or color. |
+enum TextContext { |
+ VIEWS_TEXT_CONTEXT_START = 0, |
sky
2017/03/16 16:23:51
Can all these enums be named consistently? e.g. CO
Peter Kasting
2017/03/17 02:26:00
I like having the "marker" values, which should ne
tapted
2017/03/17 10:33:11
Yeah - that was the intent. I've added an explaine
|
+ |
+ // A title for a dialog window. Usually 15pt. Multi-line OK. |
+ CONTEXT_DIALOG_TITLE, |
Peter Kasting
2017/03/17 02:26:00
Nit: Should be "= VIEWS_TEXT_CONTEXT_START" (then
tapted
2017/03/17 10:33:11
Done (did the same for STYLE).
|
+ |
+ // Text to label a control, usually next to it. "Body 2". Usually 12pt. |
sky
2017/03/16 16:23:51
This description implies it's only for labels near
tapted
2017/03/17 10:33:11
Done.
|
+ CONTEXT_CONTROL_LABEL, |
+ |
+ // An editable text field. Usually matches CONTROL_LABEL. |
sky
2017/03/16 16:23:51
That you say 'editable' implies we may have differ
tapted
2017/03/17 10:33:11
There's no plan to make them different at this sta
|
+ CONTEXT_FIELD, |
sky
2017/03/16 16:23:51
CONTEXT_TEXT_FIELD.
tapted
2017/03/17 10:33:11
Done.
|
+ |
+ // Text that appears on a button control. Usually 12pt. |
+ CONTEXT_BUTTON_TEXT, |
sky
2017/03/16 16:23:51
CONTEXT_BUTTON (for consistency with other names).
tapted
2017/03/17 10:33:11
Done.
|
+ |
+ // Embedders must start TextContext enum values from this value. |
+ VIEWS_TEXT_CONTEXT_END, |
+ |
+ // All TextContext enum values must be below this value. |
+ TEXT_CONTEXT_MAX = 0x1000 |
+}; |
+ |
+// How a piece of text should be presented. This influences color and style, but |
+// typically not size. |
+enum TextStyle { |
+ VIEWS_TEXT_STYLE_START = TEXT_CONTEXT_MAX, |
sky
2017/03/16 16:23:51
Why does this need to start at TEXT_CONTEXT_MAX? A
Peter Kasting
2017/03/16 19:33:13
This was explained in previous CL comments, but it
sky
2017/03/16 20:48:47
Ok, got it.
|
+ |
+ // Primary text: solid black, normal weight. Converts to DISABLED in some |
+ // contexts (e.g. BUTTON_TEXT, FIELD). |
+ STYLE_PRIMARY, |
+ |
+ // Disabled "greyed out" text. |
+ STYLE_DISABLED, |
+ |
+ // The style used for links. Usually a solid shade of blue. |
+ STYLE_LINK, |
+ |
+ // Active tab in a tabbed pane. |
+ STYLE_ACTIVE_TAB, |
Peter Kasting
2017/03/17 02:26:00
Nit: I tend to prefer STYLE_TAB_ACTIVE, which read
tapted
2017/03/17 10:33:11
Done.
|
+ |
+ // Inactive tab in a tabbed pane. |
+ STYLE_INACTIVE_TAB, |
+ |
+ // Hovered tab in a tabbed pane. |
+ STYLE_HOVERED_TAB, |
+ |
+ // Embedders must start TextStyle enum values from here. |
+ VIEWS_TEXT_STYLE_END |
+}; |
+ |
+// Helpers to obtain font properties from the TypographyProvider given by the |
+// current ViewsDelegate. |context| can be an enum value from TextContext, or a |
+// value understood by the embedder's TypographyProvider. Similarly, |
+// |text_style| corresponds to TextStyle. |
+VIEWS_EXPORT const gfx::FontList& GetFont(int text_context, int text_style); |
+VIEWS_EXPORT SkColor GetColor(int text_context, int text_style); |
+VIEWS_EXPORT int GetLineHeight(int text_context, int text_style); |
+ |
+} // namespace typography |
+} // namespace views |
+ |
+#endif // UI_VIEWS_STYLE_TYPOGRAPHY_H_ |