File: text_constants.h

package info (click to toggle)
chromium-browser 41.0.2272.118-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 2,189,132 kB
  • sloc: cpp: 9,691,462; ansic: 3,341,451; python: 712,689; asm: 518,779; xml: 208,926; java: 169,820; sh: 119,353; perl: 68,907; makefile: 28,311; yacc: 13,305; objc: 11,385; tcl: 3,186; cs: 2,225; sql: 2,217; lex: 2,215; lisp: 1,349; pascal: 1,256; awk: 407; ruby: 155; sed: 53; php: 14; exp: 11
file content (58 lines) | stat: -rw-r--r-- 2,266 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright (c) 2012 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_GFX_TEXT_CONSTANTS_H_
#define UI_GFX_TEXT_CONSTANTS_H_

namespace gfx {

// TODO(msw): Distinguish between logical character stops and glyph stops?
// TODO(msw): Merge with base::i18n::BreakIterator::BreakType.
enum BreakType {
  CHARACTER_BREAK = 0, // Stop cursor movement on neighboring characters.
  WORD_BREAK,          // Stop cursor movement on nearest word boundaries.
  LINE_BREAK,          // Stop cursor movement on line ends as shown on screen.
};

// Horizontal text alignment modes.
enum HorizontalAlignment {
  ALIGN_LEFT = 0, // Align the text's left edge with that of its display area.
  ALIGN_CENTER,   // Align the text's center with that of its display area.
  ALIGN_RIGHT,    // Align the text's right edge with that of its display area.
  ALIGN_TO_HEAD,  // Align the text to its first strong character's direction.
};

// The directionality modes used to determine the base text direction.
enum DirectionalityMode {
  DIRECTIONALITY_FROM_TEXT = 0, // Use the first strong character's direction.
  DIRECTIONALITY_FROM_UI,       // Use the UI locale's text reading direction.
  DIRECTIONALITY_FORCE_LTR,     // Use LTR regardless of content or UI locale.
  DIRECTIONALITY_FORCE_RTL,     // Use RTL regardless of content or UI locale.
};

// Text styles and adornments.
// TODO(msw): Merge with gfx::Font::FontStyle.
enum TextStyle {
  BOLD = 0,
  ITALIC,
  STRIKE,
  DIAGONAL_STRIKE,
  UNDERLINE,
  NUM_TEXT_STYLES,
};

// Elision behaviors of text that exceeds constrained dimensions.
enum ElideBehavior {
  NO_ELIDE = 0, // Do not modify the text, it may overflow its available bounds.
  TRUNCATE,     // Do not elide or fade, just truncate at the end of the string.
  ELIDE_HEAD,   // Add an ellipsis at the start of the string.
  ELIDE_MIDDLE, // Add an ellipsis in the middle of the string.
  ELIDE_TAIL,   // Add an ellipsis at the end of the string.
  ELIDE_EMAIL,  // Add ellipses to username and domain substrings.
  FADE_TAIL,    // Fade the string's end opposite of its horizontal alignment.
};

}  // namespace gfx

#endif  // UI_GFX_TEXT_CONSTANTS_H_