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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <usp10.h> | 9 #include <usp10.h> |
10 | 10 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 const std::vector<Font>* GetLinkedFonts(const Font& font) const; | 102 const std::vector<Font>* GetLinkedFonts(const Font& font) const; |
103 | 103 |
104 // Return the run index that contains the argument; or the length of the | 104 // Return the run index that contains the argument; or the length of the |
105 // |runs_| vector if argument exceeds the text length or width. | 105 // |runs_| vector if argument exceeds the text length or width. |
106 size_t GetRunContainingCaret(const SelectionModel& caret) const; | 106 size_t GetRunContainingCaret(const SelectionModel& caret) const; |
107 size_t GetRunContainingPoint(const Point& point) const; | 107 size_t GetRunContainingPoint(const Point& point) const; |
108 | 108 |
109 // Given a |run|, returns the SelectionModel that contains the logical first | 109 // Given a |run|, returns the SelectionModel that contains the logical first |
110 // or last caret position inside (not at a boundary of) the run. | 110 // or last caret position inside (not at a boundary of) the run. |
111 // The returned value represents a cursor/caret position without a selection. | 111 // The returned value represents a cursor/caret position without a selection. |
112 SelectionModel FirstSelectionModelInsideRun(internal::TextRun* run); | 112 SelectionModel FirstSelectionModelInsideRun(const internal::TextRun* run); |
113 SelectionModel LastSelectionModelInsideRun(internal::TextRun* run); | 113 SelectionModel LastSelectionModelInsideRun(const internal::TextRun* run); |
| 114 |
| 115 // Returns a range [start, end) over the run's text corresponding to the given |
| 116 // glyph index. For example, if the glyph covers characters "fi" in a run with |
| 117 // text "hifi", then the returned range will have |start| == 2 and |end| == 4. |
| 118 ui::Range GetTextRangeForRunGlyph(const internal::TextRun* run, |
| 119 size_t glyph_index) const; |
114 | 120 |
115 // Cached HDC for performing Uniscribe API calls. | 121 // Cached HDC for performing Uniscribe API calls. |
116 static HDC cached_hdc_; | 122 static HDC cached_hdc_; |
117 | 123 |
118 // Cached map from font names to vectors of linked fonts. | 124 // Cached map from font names to vectors of linked fonts. |
119 static std::map<std::string, std::vector<Font> > cached_linked_fonts_; | 125 static std::map<std::string, std::vector<Font> > cached_linked_fonts_; |
120 | 126 |
121 SCRIPT_CONTROL script_control_; | 127 SCRIPT_CONTROL script_control_; |
122 SCRIPT_STATE script_state_; | 128 SCRIPT_STATE script_state_; |
123 | 129 |
124 std::vector<internal::TextRun*> runs_; | 130 std::vector<internal::TextRun*> runs_; |
125 Size string_size_; | 131 Size string_size_; |
126 | 132 |
127 // A common vertical baseline for all the text runs. This is computed as the | 133 // A common vertical baseline for all the text runs. This is computed as the |
128 // largest baseline over all the runs' fonts. | 134 // largest baseline over all the runs' fonts. |
129 int common_baseline_; | 135 int common_baseline_; |
130 | 136 |
131 scoped_array<int> visual_to_logical_; | 137 scoped_array<int> visual_to_logical_; |
132 scoped_array<int> logical_to_visual_; | 138 scoped_array<int> logical_to_visual_; |
133 | 139 |
134 bool needs_layout_; | 140 bool needs_layout_; |
135 | 141 |
136 DISALLOW_COPY_AND_ASSIGN(RenderTextWin); | 142 DISALLOW_COPY_AND_ASSIGN(RenderTextWin); |
137 }; | 143 }; |
138 | 144 |
139 } // namespace gfx | 145 } // namespace gfx |
140 | 146 |
141 #endif // UI_GFX_RENDER_TEXT_WIN_H_ | 147 #endif // UI_GFX_RENDER_TEXT_WIN_H_ |
OLD | NEW |