| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WIN_H_ | 5 #ifndef UI_GFX_RENDER_TEXT_WIN_H_ |
| 6 #define UI_GFX_RENDER_TEXT_WIN_H_ | 6 #define UI_GFX_RENDER_TEXT_WIN_H_ |
| 7 | 7 |
| 8 #include <usp10.h> | 8 #include <usp10.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 scoped_ptr<int[]> advance_widths; | 48 scoped_ptr<int[]> advance_widths; |
| 49 scoped_ptr<GOFFSET[]> offsets; | 49 scoped_ptr<GOFFSET[]> offsets; |
| 50 ABC abc_widths; | 50 ABC abc_widths; |
| 51 SCRIPT_CACHE script_cache; | 51 SCRIPT_CACHE script_cache; |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 DISALLOW_COPY_AND_ASSIGN(TextRun); | 54 DISALLOW_COPY_AND_ASSIGN(TextRun); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 UI_EXPORT void CheckLineIntegrity(const std::vector<Line>& lines, |
| 58 const ScopedVector<TextRun>& runs); |
| 59 |
| 57 } // namespace internal | 60 } // namespace internal |
| 58 | 61 |
| 59 // RenderTextWin is the Windows implementation of RenderText using Uniscribe. | 62 // RenderTextWin is the Windows implementation of RenderText using Uniscribe. |
| 60 class RenderTextWin : public RenderText { | 63 class RenderTextWin : public RenderText { |
| 61 public: | 64 public: |
| 62 RenderTextWin(); | 65 RenderTextWin(); |
| 63 virtual ~RenderTextWin(); | 66 virtual ~RenderTextWin(); |
| 64 | 67 |
| 65 // Overridden from RenderText: | 68 // Overridden from RenderText: |
| 66 virtual Size GetStringSize() OVERRIDE; | 69 virtual Size GetStringSize() OVERRIDE; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 80 virtual std::vector<Rect> GetSubstringBounds(const ui::Range& range) OVERRIDE; | 83 virtual std::vector<Rect> GetSubstringBounds(const ui::Range& range) OVERRIDE; |
| 81 virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE; | 84 virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE; |
| 82 virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE; | 85 virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE; |
| 83 virtual bool IsCursorablePosition(size_t position) OVERRIDE; | 86 virtual bool IsCursorablePosition(size_t position) OVERRIDE; |
| 84 virtual void ResetLayout() OVERRIDE; | 87 virtual void ResetLayout() OVERRIDE; |
| 85 virtual void EnsureLayout() OVERRIDE; | 88 virtual void EnsureLayout() OVERRIDE; |
| 86 virtual void DrawVisualText(Canvas* canvas) OVERRIDE; | 89 virtual void DrawVisualText(Canvas* canvas) OVERRIDE; |
| 87 | 90 |
| 88 private: | 91 private: |
| 89 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Win_LogicalClusters); | 92 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Win_LogicalClusters); |
| 93 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_MinWidth); |
| 94 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_NormalWidth); |
| 90 | 95 |
| 91 void ItemizeLogicalText(); | 96 void ItemizeLogicalText(); |
| 92 void LayoutVisualText(); | 97 void LayoutVisualText(); |
| 93 void LayoutTextRun(internal::TextRun* run); | 98 void LayoutTextRun(internal::TextRun* run); |
| 94 | 99 |
| 95 // Helper function that calls |ScriptShape()| on the run, which has logic to | 100 // Helper function that calls |ScriptShape()| on the run, which has logic to |
| 96 // handle E_OUTOFMEMORY return codes. | 101 // handle E_OUTOFMEMORY return codes. |
| 97 HRESULT ShapeTextRunWithFont(internal::TextRun* run, const Font& font); | 102 HRESULT ShapeTextRunWithFont(internal::TextRun* run, const Font& font); |
| 98 | 103 |
| 99 // Returns the number of characters in |run| that have missing glyphs. | 104 // Returns the number of characters in |run| that have missing glyphs. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 114 static HDC cached_hdc_; | 119 static HDC cached_hdc_; |
| 115 | 120 |
| 116 // Cached map from font name to the last successful substitute font used. | 121 // Cached map from font name to the last successful substitute font used. |
| 117 // TODO(asvitkine): Move the caching logic to font_fallback_win.cc. | 122 // TODO(asvitkine): Move the caching logic to font_fallback_win.cc. |
| 118 static std::map<std::string, Font> successful_substitute_fonts_; | 123 static std::map<std::string, Font> successful_substitute_fonts_; |
| 119 | 124 |
| 120 SCRIPT_CONTROL script_control_; | 125 SCRIPT_CONTROL script_control_; |
| 121 SCRIPT_STATE script_state_; | 126 SCRIPT_STATE script_state_; |
| 122 | 127 |
| 123 ScopedVector<internal::TextRun> runs_; | 128 ScopedVector<internal::TextRun> runs_; |
| 124 Size string_size_; | |
| 125 | 129 |
| 126 // A common vertical baseline for all the text runs. This is computed as the | 130 // Single line width of the layout text. |
| 127 // largest baseline over all the runs' fonts. | 131 int string_width_; |
| 128 int common_baseline_; | 132 |
| 133 // Wrapped multiline size of the layout text. |
| 134 Size multiline_string_size_; |
| 129 | 135 |
| 130 scoped_ptr<int[]> visual_to_logical_; | 136 scoped_ptr<int[]> visual_to_logical_; |
| 131 scoped_ptr<int[]> logical_to_visual_; | 137 scoped_ptr<int[]> logical_to_visual_; |
| 132 | 138 |
| 133 bool needs_layout_; | 139 bool needs_layout_; |
| 134 | 140 |
| 135 DISALLOW_COPY_AND_ASSIGN(RenderTextWin); | 141 DISALLOW_COPY_AND_ASSIGN(RenderTextWin); |
| 136 }; | 142 }; |
| 137 | 143 |
| 138 } // namespace gfx | 144 } // namespace gfx |
| 139 | 145 |
| 140 #endif // UI_GFX_RENDER_TEXT_WIN_H_ | 146 #endif // UI_GFX_RENDER_TEXT_WIN_H_ |
| OLD | NEW |