OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_RENDER_TEXT_HARFBUZZ_H_ | 5 #ifndef UI_GFX_RENDER_TEXT_HARFBUZZ_H_ |
6 #define UI_GFX_RENDER_TEXT_HARFBUZZ_H_ | 6 #define UI_GFX_RENDER_TEXT_HARFBUZZ_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
msw
2016/09/15 18:19:37
ditto nit: remove?
karandeepb
2016/09/16 01:08:55
Done.
| |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
16 #include "third_party/harfbuzz-ng/src/hb.h" | 16 #include "third_party/harfbuzz-ng/src/hb.h" |
17 #include "third_party/icu/source/common/unicode/ubidi.h" | 17 #include "third_party/icu/source/common/unicode/ubidi.h" |
18 #include "third_party/icu/source/common/unicode/uscript.h" | 18 #include "third_party/icu/source/common/unicode/uscript.h" |
19 #include "ui/gfx/render_text.h" | 19 #include "ui/gfx/render_text.h" |
20 | 20 |
21 namespace base { | 21 namespace base { |
22 namespace i18n { | 22 namespace i18n { |
23 class BreakIterator; | 23 class BreakIterator; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 size_t TextIndexToDisplayIndex(size_t index) override; | 171 size_t TextIndexToDisplayIndex(size_t index) override; |
172 size_t DisplayIndexToTextIndex(size_t index) override; | 172 size_t DisplayIndexToTextIndex(size_t index) override; |
173 bool IsValidCursorIndex(size_t index) override; | 173 bool IsValidCursorIndex(size_t index) override; |
174 void OnLayoutTextAttributeChanged(bool text_changed) override; | 174 void OnLayoutTextAttributeChanged(bool text_changed) override; |
175 void OnDisplayTextAttributeChanged() override; | 175 void OnDisplayTextAttributeChanged() override; |
176 void EnsureLayout() override; | 176 void EnsureLayout() override; |
177 void DrawVisualText(internal::SkiaTextRenderer* renderer) override; | 177 void DrawVisualText(internal::SkiaTextRenderer* renderer) override; |
178 | 178 |
179 private: | 179 private: |
180 friend class test::RenderTextTestApi; | 180 friend class test::RenderTextTestApi; |
181 | 181 friend class RenderTextHarfBuzzTest; |
182 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, | |
183 Multiline_HorizontalAlignment); | |
184 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, Multiline_NormalWidth); | |
185 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, Multiline_WordWrapBehavior); | |
186 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_RunDirection); | |
187 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, | |
188 HarfBuzz_HorizontalPositions); | |
189 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, | |
190 HarfBuzz_BreakRunsByUnicodeBlocks); | |
191 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_BreakRunsByEmoji); | |
192 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_BreakRunsByAscii); | |
193 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, | |
194 HarfBuzz_SubglyphGraphemeCases); | |
195 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, | |
196 HarfBuzz_SubglyphGraphemePartition); | |
197 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_NonExistentFont); | |
198 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_UniscribeFallback); | |
199 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_UnicodeFallback); | |
200 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, | |
201 Multiline_LineBreakerBehavior); | |
202 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, | |
203 Multiline_SurrogatePairsOrCombiningChars); | |
204 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, Multiline_ZeroWidthChars); | |
205 | 182 |
206 // Specify the width of a glyph for test. The width of glyphs is very | 183 // Specify the width of a glyph for test. The width of glyphs is very |
207 // platform-dependent and environment-dependent. Otherwise multiline test | 184 // platform-dependent and environment-dependent. Otherwise multiline test |
208 // will become really flaky. | 185 // will become really flaky. |
209 void set_glyph_width_for_test(float test_width) { | 186 void set_glyph_width_for_test(float test_width) { |
210 glyph_width_for_test_ = test_width; | 187 glyph_width_for_test_ = test_width; |
211 } | 188 } |
212 | 189 |
213 // Return the run index that contains the argument; or the length of the | 190 // Return the run index that contains the argument; or the length of the |
214 // |runs_| vector if argument exceeds the text length or width. | 191 // |runs_| vector if argument exceeds the text length or width. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 | 260 |
284 // Fixed width of glyphs. This should only be set in test environments. | 261 // Fixed width of glyphs. This should only be set in test environments. |
285 float glyph_width_for_test_; | 262 float glyph_width_for_test_; |
286 | 263 |
287 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz); | 264 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz); |
288 }; | 265 }; |
289 | 266 |
290 } // namespace gfx | 267 } // namespace gfx |
291 | 268 |
292 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_ | 269 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_ |
OLD | NEW |