OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2006, 2007, 2011 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2006, 2007, 2011 Apple Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 14 matching lines...) Expand all Loading... |
25 #define TextRun_h | 25 #define TextRun_h |
26 | 26 |
27 #include "platform/PlatformExport.h" | 27 #include "platform/PlatformExport.h" |
28 #include "platform/fonts/Glyph.h" | 28 #include "platform/fonts/Glyph.h" |
29 #include "platform/geometry/FloatRect.h" | 29 #include "platform/geometry/FloatRect.h" |
30 #include "platform/heap/Heap.h" | 30 #include "platform/heap/Heap.h" |
31 #include "platform/text/TabSize.h" | 31 #include "platform/text/TabSize.h" |
32 #include "platform/text/TextDirection.h" | 32 #include "platform/text/TextDirection.h" |
33 #include "platform/text/TextPath.h" | 33 #include "platform/text/TextPath.h" |
34 #include "wtf/Allocator.h" | 34 #include "wtf/Allocator.h" |
35 #include "wtf/text/StringView.h" | |
36 #include "wtf/text/WTFString.h" | 35 #include "wtf/text/WTFString.h" |
37 | 36 |
38 class SkTextBlob; | 37 class SkTextBlob; |
39 | 38 |
40 namespace blink { | 39 namespace blink { |
41 | 40 |
42 enum TextJustify { | 41 enum TextJustify { |
43 TextJustifyAuto = 0x0, | 42 TextJustifyAuto = 0x0, |
44 TextJustifyNone = 0x1, | 43 TextJustifyNone = 0x1, |
45 TextJustifyInterWord = 0x2, | 44 TextJustifyInterWord = 0x2, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 , m_direction(direction) | 94 , m_direction(direction) |
96 , m_directionalOverride(directionalOverride) | 95 , m_directionalOverride(directionalOverride) |
97 , m_disableSpacing(false) | 96 , m_disableSpacing(false) |
98 , m_textJustify(TextJustifyAuto) | 97 , m_textJustify(TextJustifyAuto) |
99 , m_normalizeSpace(false) | 98 , m_normalizeSpace(false) |
100 , m_tabSize(0) | 99 , m_tabSize(0) |
101 { | 100 { |
102 m_data.characters16 = c; | 101 m_data.characters16 = c; |
103 } | 102 } |
104 | 103 |
| 104 TextRun(const String& string, float xpos = 0, float expansion = 0, Expansion
Behavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, Te
xtDirection direction = LTR, bool directionalOverride = false) |
| 105 : m_charactersLength(string.length()) |
| 106 , m_len(string.length()) |
| 107 , m_xpos(xpos) |
| 108 , m_horizontalGlyphStretch(1) |
| 109 , m_expansion(expansion) |
| 110 , m_expansionBehavior(expansionBehavior) |
| 111 , m_allowTabs(false) |
| 112 , m_direction(direction) |
| 113 , m_directionalOverride(directionalOverride) |
| 114 , m_disableSpacing(false) |
| 115 , m_textJustify(TextJustifyAuto) |
| 116 , m_normalizeSpace(false) |
| 117 , m_tabSize(0) |
| 118 { |
| 119 if (!m_charactersLength) { |
| 120 m_is8Bit = true; |
| 121 m_data.characters8 = 0; |
| 122 } else if (string.is8Bit()) { |
| 123 m_data.characters8 = string.characters8(); |
| 124 m_is8Bit = true; |
| 125 } else { |
| 126 m_data.characters16 = string.characters16(); |
| 127 m_is8Bit = false; |
| 128 } |
| 129 } |
| 130 |
105 TextRun(const StringView& string, float xpos = 0, float expansion = 0, Expan
sionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion
, TextDirection direction = LTR, bool directionalOverride = false) | 131 TextRun(const StringView& string, float xpos = 0, float expansion = 0, Expan
sionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion
, TextDirection direction = LTR, bool directionalOverride = false) |
106 : m_charactersLength(string.length()) | 132 : m_charactersLength(string.length()) |
107 , m_len(string.length()) | 133 , m_len(string.length()) |
108 , m_xpos(xpos) | 134 , m_xpos(xpos) |
109 , m_horizontalGlyphStretch(1) | 135 , m_horizontalGlyphStretch(1) |
110 , m_expansion(expansion) | 136 , m_expansion(expansion) |
111 , m_expansionBehavior(expansionBehavior) | 137 , m_expansionBehavior(expansionBehavior) |
112 , m_allowTabs(false) | 138 , m_allowTabs(false) |
113 , m_direction(direction) | 139 , m_direction(direction) |
114 , m_directionalOverride(directionalOverride) | 140 , m_directionalOverride(directionalOverride) |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 260 |
235 const TextRun& run; | 261 const TextRun& run; |
236 int from; | 262 int from; |
237 int to; | 263 int to; |
238 FloatRect bounds; | 264 FloatRect bounds; |
239 RefPtr<const SkTextBlob>* cachedTextBlob; | 265 RefPtr<const SkTextBlob>* cachedTextBlob; |
240 }; | 266 }; |
241 | 267 |
242 } // namespace blink | 268 } // namespace blink |
243 #endif | 269 #endif |
OLD | NEW |