| 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 30 matching lines...) Expand all Loading... |
| 41 // Writes the character and glyph ranges of the cluster containing |pos|. | 41 // Writes the character and glyph ranges of the cluster containing |pos|. |
| 42 void GetClusterAt(size_t pos, Range* chars, Range* glyphs) const; | 42 void GetClusterAt(size_t pos, Range* chars, Range* glyphs) const; |
| 43 | 43 |
| 44 // Returns the grapheme bounds at |text_index|. Handles multi-grapheme glyphs. | 44 // Returns the grapheme bounds at |text_index|. Handles multi-grapheme glyphs. |
| 45 Range GetGraphemeBounds(base::i18n::BreakIterator* grapheme_iterator, | 45 Range GetGraphemeBounds(base::i18n::BreakIterator* grapheme_iterator, |
| 46 size_t text_index); | 46 size_t text_index); |
| 47 | 47 |
| 48 // Returns whether the given shaped run contains any missing glyphs. | 48 // Returns whether the given shaped run contains any missing glyphs. |
| 49 bool HasMissingGlyphs() const; | 49 bool HasMissingGlyphs() const; |
| 50 | 50 |
| 51 int width; | 51 float width; |
| 52 int preceding_run_widths; | 52 float preceding_run_widths; |
| 53 Range range; | 53 Range range; |
| 54 bool is_rtl; | 54 bool is_rtl; |
| 55 UBiDiLevel level; | 55 UBiDiLevel level; |
| 56 UScriptCode script; | 56 UScriptCode script; |
| 57 | 57 |
| 58 scoped_ptr<uint16[]> glyphs; | 58 scoped_ptr<uint16[]> glyphs; |
| 59 scoped_ptr<SkPoint[]> positions; | 59 scoped_ptr<SkPoint[]> positions; |
| 60 std::vector<uint32> glyph_to_char; | 60 std::vector<uint32> glyph_to_char; |
| 61 size_t glyph_count; | 61 size_t glyph_count; |
| 62 | 62 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 73 | 73 |
| 74 } // namespace internal | 74 } // namespace internal |
| 75 | 75 |
| 76 class GFX_EXPORT RenderTextHarfBuzz : public RenderText { | 76 class GFX_EXPORT RenderTextHarfBuzz : public RenderText { |
| 77 public: | 77 public: |
| 78 RenderTextHarfBuzz(); | 78 RenderTextHarfBuzz(); |
| 79 virtual ~RenderTextHarfBuzz(); | 79 virtual ~RenderTextHarfBuzz(); |
| 80 | 80 |
| 81 // Overridden from RenderText. | 81 // Overridden from RenderText. |
| 82 virtual Size GetStringSize() OVERRIDE; | 82 virtual Size GetStringSize() OVERRIDE; |
| 83 virtual SizeF GetStringSizeF() OVERRIDE; |
| 83 virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE; | 84 virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE; |
| 84 virtual std::vector<FontSpan> GetFontSpansForTesting() OVERRIDE; | 85 virtual std::vector<FontSpan> GetFontSpansForTesting() OVERRIDE; |
| 85 virtual Range GetGlyphBounds(size_t index) OVERRIDE; | 86 virtual Range GetGlyphBounds(size_t index) OVERRIDE; |
| 86 | 87 |
| 87 protected: | 88 protected: |
| 88 // Overridden from RenderText. | 89 // Overridden from RenderText. |
| 89 virtual int GetLayoutTextBaseline() OVERRIDE; | 90 virtual int GetLayoutTextBaseline() OVERRIDE; |
| 90 virtual SelectionModel AdjacentCharSelectionModel( | 91 virtual SelectionModel AdjacentCharSelectionModel( |
| 91 const SelectionModel& selection, | 92 const SelectionModel& selection, |
| 92 VisualCursorDirection direction) OVERRIDE; | 93 VisualCursorDirection direction) OVERRIDE; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // ICU grapheme iterator for the layout text. Valid when |!needs_layout_|. Can | 143 // ICU grapheme iterator for the layout text. Valid when |!needs_layout_|. Can |
| 143 // be NULL in case of an error. | 144 // be NULL in case of an error. |
| 144 scoped_ptr<base::i18n::BreakIterator> grapheme_iterator_; | 145 scoped_ptr<base::i18n::BreakIterator> grapheme_iterator_; |
| 145 | 146 |
| 146 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz); | 147 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz); |
| 147 }; | 148 }; |
| 148 | 149 |
| 149 } // namespace gfx | 150 } // namespace gfx |
| 150 | 151 |
| 151 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_ | 152 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_ |
| OLD | NEW |