OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_GFX_TEXT_CONSTANTS_H_ | 5 #ifndef UI_GFX_TEXT_CONSTANTS_H_ |
6 #define UI_GFX_TEXT_CONSTANTS_H_ | 6 #define UI_GFX_TEXT_CONSTANTS_H_ |
7 | 7 |
8 namespace gfx { | 8 namespace gfx { |
9 | 9 |
10 // TODO(msw): Distinguish between logical character stops and glyph stops? | 10 // TODO(msw): Distinguish between logical character stops and glyph stops? |
(...skipping 14 matching lines...) Expand all Loading... | |
25 | 25 |
26 // The directionality modes used to determine the base text direction. | 26 // The directionality modes used to determine the base text direction. |
27 enum DirectionalityMode { | 27 enum DirectionalityMode { |
28 DIRECTIONALITY_FROM_TEXT = 0, // Use the first strong character's direction. | 28 DIRECTIONALITY_FROM_TEXT = 0, // Use the first strong character's direction. |
29 DIRECTIONALITY_FROM_UI, // Use the UI locale's text reading 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. | 30 DIRECTIONALITY_FORCE_LTR, // Use LTR regardless of content or UI locale. |
31 DIRECTIONALITY_FORCE_RTL, // Use RTL regardless of content or UI locale. | 31 DIRECTIONALITY_FORCE_RTL, // Use RTL regardless of content or UI locale. |
32 }; | 32 }; |
33 | 33 |
34 // Text styles and adornments. | 34 // Text styles and adornments. |
35 // Figure of font metrics: | |
msw
2015/02/17 23:32:06
nit: vertically center "height", "ascent", and "ca
dschuyler
2015/02/18 01:37:27
Done.
| |
36 // +--------+--------+------------------------+-------------+ | |
37 // | | | internal leading | SUPERSCRIPT | | |
38 // | | ascent +------------+-----------| | | |
39 // | | | | SUPERIOR |-------------+ | |
40 // | | | |-----------| | |
41 // | height | | cap height | INFERIOR |-------------+ | |
42 // | |--------+------------+-----------| SUBSCRIPT | | |
43 // | | descent | | | |
44 // +--------+---------------------------------+-------------+ | |
35 // TODO(msw): Merge with gfx::Font::FontStyle. | 45 // TODO(msw): Merge with gfx::Font::FontStyle. |
36 enum TextStyle { | 46 enum TextStyle { |
37 BOLD = 0, | 47 BOLD = 0, |
38 ITALIC, | 48 ITALIC, |
39 STRIKE, | 49 STRIKE, |
40 DIAGONAL_STRIKE, | 50 DIAGONAL_STRIKE, |
41 UNDERLINE, | 51 UNDERLINE, |
52 SUPERSCRIPT, // e.g. a mathematical exponent would be superscript | |
msw
2015/02/17 23:32:06
I don't think you'll want to merge these directly
dschuyler
2015/02/18 01:37:27
I'm a little less confident for the number of plac
msw
2015/02/18 17:07:23
What you have looks pretty good. That comment is s
| |
53 SUPERIOR, // e.g. 8th, the "th" would be superior script | |
54 INFERIOR, // e.g. 1/2, the "2" would be inferior ("1" is superior) | |
55 SUBSCRIPT, // e.g. H2O, the "2" would be subscript | |
42 NUM_TEXT_STYLES, | 56 NUM_TEXT_STYLES, |
43 }; | 57 }; |
44 | 58 |
45 // Elision behaviors of text that exceeds constrained dimensions. | 59 // Elision behaviors of text that exceeds constrained dimensions. |
46 enum ElideBehavior { | 60 enum ElideBehavior { |
47 NO_ELIDE = 0, // Do not modify the text, it may overflow its available bounds. | 61 NO_ELIDE = 0, // Do not modify the text, it may overflow its available bounds. |
48 TRUNCATE, // Do not elide or fade, just truncate at the end of the string. | 62 TRUNCATE, // Do not elide or fade, just truncate at the end of the string. |
49 ELIDE_HEAD, // Add an ellipsis at the start of the string. | 63 ELIDE_HEAD, // Add an ellipsis at the start of the string. |
50 ELIDE_MIDDLE, // Add an ellipsis in the middle of the string. | 64 ELIDE_MIDDLE, // Add an ellipsis in the middle of the string. |
51 ELIDE_TAIL, // Add an ellipsis at the end of the string. | 65 ELIDE_TAIL, // Add an ellipsis at the end of the string. |
52 ELIDE_EMAIL, // Add ellipses to username and domain substrings. | 66 ELIDE_EMAIL, // Add ellipses to username and domain substrings. |
53 FADE_TAIL, // Fade the string's end opposite of its horizontal alignment. | 67 FADE_TAIL, // Fade the string's end opposite of its horizontal alignment. |
54 }; | 68 }; |
55 | 69 |
56 } // namespace gfx | 70 } // namespace gfx |
57 | 71 |
58 #endif // UI_GFX_TEXT_CONSTANTS_H_ | 72 #endif // UI_GFX_TEXT_CONSTANTS_H_ |
OLD | NEW |