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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 virtual void EnsureLayout() OVERRIDE; | 91 virtual void EnsureLayout() OVERRIDE; |
92 virtual void DrawVisualText(Canvas* canvas) OVERRIDE; | 92 virtual void DrawVisualText(Canvas* canvas) OVERRIDE; |
93 | 93 |
94 private: | 94 private: |
95 void ItemizeLogicalText(); | 95 void ItemizeLogicalText(); |
96 void LayoutVisualText(); | 96 void LayoutVisualText(); |
97 | 97 |
98 // Helper function to update the font on a text run after font substitution. | 98 // Helper function to update the font on a text run after font substitution. |
99 void ApplySubstituteFont(internal::TextRun* run, const Font& font); | 99 void ApplySubstituteFont(internal::TextRun* run, const Font& font); |
100 | 100 |
101 // Returns whether |run| contains missing glyphs. | |
102 bool HasMissingGlyphs(internal::TextRun* run) const; | |
msw
2012/05/03 17:33:34
nit: make run const? thx for fixing First/LastSel.
Alexei Svitkine (slow)
2012/05/03 17:47:50
Can't unfortunately, because ScriptGetFontProperti
| |
103 | |
101 // Returns a vector of linked fonts corresponding to |font|. | 104 // Returns a vector of linked fonts corresponding to |font|. |
102 const std::vector<Font>* GetLinkedFonts(const Font& font) const; | 105 const std::vector<Font>* GetLinkedFonts(const Font& font) const; |
103 | 106 |
104 // Return the run index that contains the argument; or the length of the | 107 // Return the run index that contains the argument; or the length of the |
105 // |runs_| vector if argument exceeds the text length or width. | 108 // |runs_| vector if argument exceeds the text length or width. |
106 size_t GetRunContainingCaret(const SelectionModel& caret) const; | 109 size_t GetRunContainingCaret(const SelectionModel& caret) const; |
107 size_t GetRunContainingPoint(const Point& point) const; | 110 size_t GetRunContainingPoint(const Point& point) const; |
108 | 111 |
109 // Given a |run|, returns the SelectionModel that contains the logical first | 112 // Given a |run|, returns the SelectionModel that contains the logical first |
110 // or last caret position inside (not at a boundary of) the run. | 113 // or last caret position inside (not at a boundary of) the run. |
111 // The returned value represents a cursor/caret position without a selection. | 114 // The returned value represents a cursor/caret position without a selection. |
112 SelectionModel FirstSelectionModelInsideRun(internal::TextRun* run); | 115 SelectionModel FirstSelectionModelInsideRun(const internal::TextRun* run); |
113 SelectionModel LastSelectionModelInsideRun(internal::TextRun* run); | 116 SelectionModel LastSelectionModelInsideRun(const internal::TextRun* run); |
114 | 117 |
115 // Cached HDC for performing Uniscribe API calls. | 118 // Cached HDC for performing Uniscribe API calls. |
116 static HDC cached_hdc_; | 119 static HDC cached_hdc_; |
117 | 120 |
118 // Cached map from font names to vectors of linked fonts. | 121 // Cached map from font names to vectors of linked fonts. |
119 static std::map<std::string, std::vector<Font> > cached_linked_fonts_; | 122 static std::map<std::string, std::vector<Font> > cached_linked_fonts_; |
120 | 123 |
121 SCRIPT_CONTROL script_control_; | 124 SCRIPT_CONTROL script_control_; |
122 SCRIPT_STATE script_state_; | 125 SCRIPT_STATE script_state_; |
123 | 126 |
124 std::vector<internal::TextRun*> runs_; | 127 std::vector<internal::TextRun*> runs_; |
125 Size string_size_; | 128 Size string_size_; |
126 | 129 |
127 // A common vertical baseline for all the text runs. This is computed as the | 130 // A common vertical baseline for all the text runs. This is computed as the |
128 // largest baseline over all the runs' fonts. | 131 // largest baseline over all the runs' fonts. |
129 int common_baseline_; | 132 int common_baseline_; |
130 | 133 |
131 scoped_array<int> visual_to_logical_; | 134 scoped_array<int> visual_to_logical_; |
132 scoped_array<int> logical_to_visual_; | 135 scoped_array<int> logical_to_visual_; |
133 | 136 |
134 bool needs_layout_; | 137 bool needs_layout_; |
135 | 138 |
136 DISALLOW_COPY_AND_ASSIGN(RenderTextWin); | 139 DISALLOW_COPY_AND_ASSIGN(RenderTextWin); |
137 }; | 140 }; |
138 | 141 |
139 } // namespace gfx | 142 } // namespace gfx |
140 | 143 |
141 #endif // UI_GFX_RENDER_TEXT_WIN_H_ | 144 #endif // UI_GFX_RENDER_TEXT_WIN_H_ |
OLD | NEW |