Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: ui/gfx/render_text_win.h

Issue 8570003: Implement font fallback in RenderTextWin, try #2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/gfx/render_text_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "ui/gfx/render_text.h" 14 #include "ui/gfx/render_text.h"
15 15
16 namespace gfx { 16 namespace gfx {
17 17
18 namespace internal { 18 namespace internal {
19 19
20 struct TextRun { 20 struct TextRun {
21 TextRun(); 21 TextRun();
22 ~TextRun();
22 23
23 ui::Range range; 24 ui::Range range;
24 Font font; 25 Font font;
25 // TODO(msw): Disambiguate color, strike, etc. from TextRuns. 26 // TODO(msw): Disambiguate color, strike, etc. from TextRuns.
26 // Otherwise, this breaks the glyph shaping process. 27 // Otherwise, this breaks the glyph shaping process.
27 // See the example at: http://www.catch22.net/tuts/neatpad/12. 28 // See the example at: http://www.catch22.net/tuts/neatpad/12.
28 SkColor foreground; 29 SkColor foreground;
29 bool strike; 30 bool strike;
30 bool underline; 31 bool underline;
31 32
32 int width; 33 int width;
33 // The cumulative widths of preceding runs. 34 // The cumulative widths of preceding runs.
34 int preceding_run_widths; 35 int preceding_run_widths;
35 36
36 SCRIPT_ANALYSIS script_analysis; 37 SCRIPT_ANALYSIS script_analysis;
37 38
38 scoped_array<WORD> glyphs; 39 scoped_array<WORD> glyphs;
39 scoped_array<WORD> logical_clusters; 40 scoped_array<WORD> logical_clusters;
40 scoped_array<SCRIPT_VISATTR> visible_attributes; 41 scoped_array<SCRIPT_VISATTR> visible_attributes;
41 int glyph_count; 42 int glyph_count;
42 43
43 scoped_array<int> advance_widths; 44 scoped_array<int> advance_widths;
44 scoped_array<GOFFSET> offsets; 45 scoped_array<GOFFSET> offsets;
45 ABC abc_widths; 46 ABC abc_widths;
47 SCRIPT_CACHE script_cache;
46 48
47 private: 49 private:
48 DISALLOW_COPY_AND_ASSIGN(TextRun); 50 DISALLOW_COPY_AND_ASSIGN(TextRun);
49 }; 51 };
50 52
51 } // namespace internal 53 } // namespace internal
52 54
53 // RenderTextWin is the Windows implementation of RenderText using Uniscribe. 55 // RenderTextWin is the Windows implementation of RenderText using Uniscribe.
54 class RenderTextWin : public RenderText { 56 class RenderTextWin : public RenderText {
55 public: 57 public:
(...skipping 26 matching lines...) Expand all
82 void LayoutVisualText(); 84 void LayoutVisualText();
83 85
84 // Return the run index that contains the argument; or the length of the 86 // Return the run index that contains the argument; or the length of the
85 // |runs_| vector if argument exceeds the text length or width. 87 // |runs_| vector if argument exceeds the text length or width.
86 size_t GetRunContainingPosition(size_t position) const; 88 size_t GetRunContainingPosition(size_t position) const;
87 size_t GetRunContainingPoint(const Point& point) const; 89 size_t GetRunContainingPoint(const Point& point) const;
88 90
89 // Given a |run|, returns the SelectionModel that contains the logical first 91 // Given a |run|, returns the SelectionModel that contains the logical first
90 // or last caret position inside (not at a boundary of) the run. 92 // or last caret position inside (not at a boundary of) the run.
91 // The returned value represents a cursor/caret position without a selection. 93 // The returned value represents a cursor/caret position without a selection.
92 SelectionModel FirstSelectionModelInsideRun(internal::TextRun*); 94 SelectionModel FirstSelectionModelInsideRun(internal::TextRun* run);
93 SelectionModel LastSelectionModelInsideRun(internal::TextRun*); 95 SelectionModel LastSelectionModelInsideRun(internal::TextRun* run);
94 96
95 // Get the selection model visually left/right of |selection| by one grapheme. 97 // Get the selection model visually left/right of |selection| by one grapheme.
96 // The returned value represents a cursor/caret position without a selection. 98 // The returned value represents a cursor/caret position without a selection.
97 SelectionModel LeftSelectionModel(const SelectionModel& selection); 99 SelectionModel LeftSelectionModel(const SelectionModel& selection);
98 SelectionModel RightSelectionModel(const SelectionModel& selection); 100 SelectionModel RightSelectionModel(const SelectionModel& selection);
99 101
100 // Draw the text, cursor, and selection. 102 // Draw the text, cursor, and selection.
101 void DrawSelection(Canvas* canvas); 103 void DrawSelection(Canvas* canvas);
102 void DrawVisualText(Canvas* canvas); 104 void DrawVisualText(Canvas* canvas);
103 void DrawCursor(Canvas* canvas); 105 void DrawCursor(Canvas* canvas);
104 106
105 bool text_is_dirty_;
106 bool style_is_dirty_;
107
108 // National Language Support native digit and digit substitution settings. 107 // National Language Support native digit and digit substitution settings.
109 SCRIPT_DIGITSUBSTITUTE digit_substitute_; 108 SCRIPT_DIGITSUBSTITUTE digit_substitute_;
110 109
111 SCRIPT_CONTROL script_control_; 110 SCRIPT_CONTROL script_control_;
112 SCRIPT_STATE script_state_; 111 SCRIPT_STATE script_state_;
113 112
114 SCRIPT_CACHE script_cache_;
115
116 std::vector<internal::TextRun*> runs_; 113 std::vector<internal::TextRun*> runs_;
117 int string_width_; 114 int string_width_;
118 115
119 scoped_array<int> visual_to_logical_; 116 scoped_array<int> visual_to_logical_;
120 scoped_array<int> logical_to_visual_; 117 scoped_array<int> logical_to_visual_;
121 118
122 DISALLOW_COPY_AND_ASSIGN(RenderTextWin); 119 DISALLOW_COPY_AND_ASSIGN(RenderTextWin);
123 }; 120 };
124 121
125 } // namespace gfx 122 } // namespace gfx
126 123
127 #endif // UI_GFX_RENDER_TEXT_WIN_H_ 124 #endif // UI_GFX_RENDER_TEXT_WIN_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698