blob: c76adfa3a159c8a92b135c2ca45156736c547edd [file] [log] [blame]
[email protected]46cb5382012-08-01 21:57:311// Copyright (c) 2012 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#ifndef UI_GFX_TEXT_CONSTANTS_H_
6#define UI_GFX_TEXT_CONSTANTS_H_
7
8namespace gfx {
9
10// TODO(msw): Distinguish between logical character stops and glyph stops?
11// TODO(msw): Merge with base::i18n::BreakIterator::BreakType.
12enum BreakType {
[email protected]f3ce6212014-06-05 22:42:0813 CHARACTER_BREAK = 0, // Stop cursor movement on neighboring characters.
14 WORD_BREAK, // Stop cursor movement on nearest word boundaries.
15 LINE_BREAK, // Stop cursor movement on line ends as shown on screen.
[email protected]46cb5382012-08-01 21:57:3116};
17
18// Horizontal text alignment modes.
19enum HorizontalAlignment {
[email protected]f3ce6212014-06-05 22:42:0820 ALIGN_LEFT = 0, // Align the text's left edge with that of its display area.
21 ALIGN_CENTER, // Align the text's center with that of its display area.
22 ALIGN_RIGHT, // Align the text's right edge with that of its display area.
[email protected]5f751da2014-06-12 07:41:4723 ALIGN_TO_HEAD, // Align the text to its first strong character's direction.
[email protected]46cb5382012-08-01 21:57:3124};
25
26// The directionality modes used to determine the base text direction.
27enum DirectionalityMode {
[email protected]f3ce6212014-06-05 22:42:0828 DIRECTIONALITY_FROM_TEXT = 0, // Use the first strong character's direction.
29 DIRECTIONALITY_FROM_UI, // Use the UI locale's text reading direction.
30 DIRECTIONALITY_FORCE_LTR, // Use LTR regardless of content or UI locale.
31 DIRECTIONALITY_FORCE_RTL, // Use RTL regardless of content or UI locale.
[email protected]46cb5382012-08-01 21:57:3132};
33
[email protected]ccfa43f02013-02-01 04:42:1734// Text styles and adornments.
35// TODO(msw): Merge with gfx::Font::FontStyle.
36enum TextStyle {
37 BOLD = 0,
38 ITALIC,
39 STRIKE,
40 DIAGONAL_STRIKE,
41 UNDERLINE,
42 NUM_TEXT_STYLES,
43};
44
dschuylerfcd76912015-03-11 01:40:1145// Text baseline offset types.
46// Figure of font metrics:
47// +--------+--------+------------------------+-------------+
48// | | | internal leading | SUPERSCRIPT |
49// | | +------------+-----------| |
50// | | ascent | | SUPERIOR |-------------+
51// | height | | cap height |-----------|
52// | | | | INFERIOR |-------------+
53// | |--------+------------+-----------| |
54// | | descent | SUBSCRIPT |
55// +--------+---------------------------------+-------------+
56enum BaselineStyle {
57 NORMAL_BASELINE = 0,
58 SUPERSCRIPT, // e.g. a mathematical exponent would be superscript.
59 SUPERIOR, // e.g. 8th, the "th" would be superior script.
60 INFERIOR, // e.g. 1/2, the "2" would be inferior ("1" is superior).
61 SUBSCRIPT, // e.g. H2O, the "2" would be subscript.
62};
63
[email protected]f3ce6212014-06-05 22:42:0864// Elision behaviors of text that exceeds constrained dimensions.
65enum ElideBehavior {
[email protected]8d936142014-07-10 21:40:3766 NO_ELIDE = 0, // Do not modify the text, it may overflow its available bounds.
67 TRUNCATE, // Do not elide or fade, just truncate at the end of the string.
[email protected]f3ce6212014-06-05 22:42:0868 ELIDE_HEAD, // Add an ellipsis at the start of the string.
69 ELIDE_MIDDLE, // Add an ellipsis in the middle of the string.
70 ELIDE_TAIL, // Add an ellipsis at the end of the string.
71 ELIDE_EMAIL, // Add ellipses to username and domain substrings.
72 FADE_TAIL, // Fade the string's end opposite of its horizontal alignment.
73};
74
[email protected]46cb5382012-08-01 21:57:3175} // namespace gfx
76
77#endif // UI_GFX_TEXT_CONSTANTS_H_