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 "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "third_party/harfbuzz-ng/src/hb.h" | 10 #include "third_party/harfbuzz-ng/src/hb.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 const std::string& font_family, | 228 const std::string& font_family, |
229 const FontRenderParams& params, | 229 const FontRenderParams& params, |
230 internal::TextRunHarfBuzz* run); | 230 internal::TextRunHarfBuzz* run); |
231 | 231 |
232 // Makes sure that text runs for layout text are shaped. | 232 // Makes sure that text runs for layout text are shaped. |
233 void EnsureLayoutRunList(); | 233 void EnsureLayoutRunList(); |
234 | 234 |
235 // ICU grapheme iterator for the layout text. Can be NULL in case of an error. | 235 // ICU grapheme iterator for the layout text. Can be NULL in case of an error. |
236 base::i18n::BreakIterator* GetGraphemeIterator(); | 236 base::i18n::BreakIterator* GetGraphemeIterator(); |
237 | 237 |
238 // Convert an index in |text_| to the index in |given_text|. The | |
239 // |given_text| should be either |display_text_| or |layout_text_| | |
240 // depending on the elide state. | |
241 size_t TextIndexToGivenTextIndex(const base::string16& given_text, | |
242 size_t index); | |
243 | |
244 // Returns the current run list, |display_run_list_| if the text is | 238 // Returns the current run list, |display_run_list_| if the text is |
245 // elided, or |layout_run_list_| otherwise. | 239 // elided, or |layout_run_list_| otherwise. |
246 internal::TextRunList* GetRunList(); | 240 internal::TextRunList* GetRunList(); |
247 const internal::TextRunList* GetRunList() const; | 241 const internal::TextRunList* GetRunList() const; |
248 | 242 |
249 // Text run list for |layout_text_| and |display_text_|. | 243 // Text run list for |layout_text_| and |display_text_|. |
250 // |display_run_list_| is created only when the text is elided. | 244 // |display_run_list_| is created only when the text is elided. |
251 internal::TextRunList layout_run_list_; | 245 internal::TextRunList layout_run_list_; |
252 scoped_ptr<internal::TextRunList> display_run_list_; | 246 scoped_ptr<internal::TextRunList> display_run_list_; |
253 | 247 |
(...skipping 11 matching lines...) Expand all Loading... |
265 | 259 |
266 // Fixed width of glyphs. This should only be set in test environments. | 260 // Fixed width of glyphs. This should only be set in test environments. |
267 float glyph_width_for_test_; | 261 float glyph_width_for_test_; |
268 | 262 |
269 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz); | 263 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz); |
270 }; | 264 }; |
271 | 265 |
272 } // namespace gfx | 266 } // namespace gfx |
273 | 267 |
274 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_ | 268 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_ |
OLD | NEW |