[email protected] | 46cb538 | 2012-08-01 21:57:31 | [diff] [blame] | 1 | // 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 | |
| 8 | namespace gfx { |
| 9 | |
| 10 | // TODO(msw): Distinguish between logical character stops and glyph stops? |
| 11 | // TODO(msw): Merge with base::i18n::BreakIterator::BreakType. |
| 12 | enum BreakType { |
[email protected] | f3ce621 | 2014-06-05 22:42:08 | [diff] [blame] | 13 | 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] | 46cb538 | 2012-08-01 21:57:31 | [diff] [blame] | 16 | }; |
| 17 | |
mukai | a193393 | 2015-03-28 00:07:05 | [diff] [blame] | 18 | // Specifies the word wrapping behavior when a word would exceed the available |
| 19 | // display width. All words that are too wide will be put on a new line, and |
| 20 | // then: |
| 21 | enum WordWrapBehavior { |
| 22 | IGNORE_LONG_WORDS, // Overflowing word text is left on that line. |
| 23 | TRUNCATE_LONG_WORDS, // Overflowing word text is truncated. |
| 24 | ELIDE_LONG_WORDS, // Overflowing word text is elided at the ellipsis. |
| 25 | WRAP_LONG_WORDS, // Overflowing word text is wrapped over multiple lines. |
| 26 | }; |
| 27 | |
[email protected] | 46cb538 | 2012-08-01 21:57:31 | [diff] [blame] | 28 | // Horizontal text alignment modes. |
| 29 | enum HorizontalAlignment { |
[email protected] | f3ce621 | 2014-06-05 22:42:08 | [diff] [blame] | 30 | ALIGN_LEFT = 0, // Align the text's left edge with that of its display area. |
| 31 | ALIGN_CENTER, // Align the text's center with that of its display area. |
| 32 | ALIGN_RIGHT, // Align the text's right edge with that of its display area. |
[email protected] | 5f751da | 2014-06-12 07:41:47 | [diff] [blame] | 33 | ALIGN_TO_HEAD, // Align the text to its first strong character's direction. |
[email protected] | 46cb538 | 2012-08-01 21:57:31 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | // The directionality modes used to determine the base text direction. |
| 37 | enum DirectionalityMode { |
[email protected] | f3ce621 | 2014-06-05 22:42:08 | [diff] [blame] | 38 | DIRECTIONALITY_FROM_TEXT = 0, // Use the first strong character's direction. |
| 39 | DIRECTIONALITY_FROM_UI, // Use the UI locale's text reading direction. |
| 40 | DIRECTIONALITY_FORCE_LTR, // Use LTR regardless of content or UI locale. |
| 41 | DIRECTIONALITY_FORCE_RTL, // Use RTL regardless of content or UI locale. |
[email protected] | 46cb538 | 2012-08-01 21:57:31 | [diff] [blame] | 42 | }; |
| 43 | |
[email protected] | ccfa43f0 | 2013-02-01 04:42:17 | [diff] [blame] | 44 | // Text styles and adornments. |
| 45 | // TODO(msw): Merge with gfx::Font::FontStyle. |
| 46 | enum TextStyle { |
mboc | 998e890 | 2016-06-02 11:40:35 | [diff] [blame] | 47 | ITALIC = 0, |
[email protected] | ccfa43f0 | 2013-02-01 04:42:17 | [diff] [blame] | 48 | STRIKE, |
| 49 | DIAGONAL_STRIKE, |
| 50 | UNDERLINE, |
| 51 | NUM_TEXT_STYLES, |
| 52 | }; |
| 53 | |
dschuyler | fcd7691 | 2015-03-11 01:40:11 | [diff] [blame] | 54 | // Text baseline offset types. |
| 55 | // Figure of font metrics: |
| 56 | // +--------+--------+------------------------+-------------+ |
| 57 | // | | | internal leading | SUPERSCRIPT | |
| 58 | // | | +------------+-----------| | |
| 59 | // | | ascent | | SUPERIOR |-------------+ |
| 60 | // | height | | cap height |-----------| |
| 61 | // | | | | INFERIOR |-------------+ |
| 62 | // | |--------+------------+-----------| | |
| 63 | // | | descent | SUBSCRIPT | |
| 64 | // +--------+---------------------------------+-------------+ |
| 65 | enum BaselineStyle { |
| 66 | NORMAL_BASELINE = 0, |
| 67 | SUPERSCRIPT, // e.g. a mathematical exponent would be superscript. |
| 68 | SUPERIOR, // e.g. 8th, the "th" would be superior script. |
| 69 | INFERIOR, // e.g. 1/2, the "2" would be inferior ("1" is superior). |
| 70 | SUBSCRIPT, // e.g. H2O, the "2" would be subscript. |
| 71 | }; |
| 72 | |
[email protected] | f3ce621 | 2014-06-05 22:42:08 | [diff] [blame] | 73 | // Elision behaviors of text that exceeds constrained dimensions. |
| 74 | enum ElideBehavior { |
[email protected] | 8d93614 | 2014-07-10 21:40:37 | [diff] [blame] | 75 | NO_ELIDE = 0, // Do not modify the text, it may overflow its available bounds. |
| 76 | TRUNCATE, // Do not elide or fade, just truncate at the end of the string. |
[email protected] | f3ce621 | 2014-06-05 22:42:08 | [diff] [blame] | 77 | ELIDE_HEAD, // Add an ellipsis at the start of the string. |
| 78 | ELIDE_MIDDLE, // Add an ellipsis in the middle of the string. |
| 79 | ELIDE_TAIL, // Add an ellipsis at the end of the string. |
| 80 | ELIDE_EMAIL, // Add ellipses to username and domain substrings. |
| 81 | FADE_TAIL, // Fade the string's end opposite of its horizontal alignment. |
| 82 | }; |
| 83 | |
[email protected] | 46cb538 | 2012-08-01 21:57:31 | [diff] [blame] | 84 | } // namespace gfx |
| 85 | |
| 86 | #endif // UI_GFX_TEXT_CONSTANTS_H_ |