| Index: ui/gfx/render_text_win.h
|
| diff --git a/ui/gfx/render_text_win.h b/ui/gfx/render_text_win.h
|
| index 829888b9ff416df98bd8b76497b80846d02390f6..b6eb6680399b53fea4a18c2a90c3c26956bd265a 100644
|
| --- a/ui/gfx/render_text_win.h
|
| +++ b/ui/gfx/render_text_win.h
|
| @@ -6,17 +6,121 @@
|
| #define UI_GFX_RENDER_TEXT_WIN_H_
|
| #pragma once
|
|
|
| +#include <usp10.h>
|
| +
|
| +#include "base/memory/scoped_ptr.h"
|
| #include "ui/gfx/render_text.h"
|
|
|
| namespace gfx {
|
|
|
| +namespace internal {
|
| +
|
| +struct TextRun {
|
| + TextRun();
|
| +
|
| + ui::Range range;
|
| + Font font;
|
| + // TODO(msw): Disambiguate color, strike, etc. from TextRuns.
|
| + // Otherwise, this breaks the glyph shaping process.
|
| + // See the example at: http://www.catch22.net/tuts/neatpad/12.
|
| + SkColor foreground;
|
| + bool strike;
|
| +
|
| + int width;
|
| + // The cumulative widths of preceding runs.
|
| + int preceding_run_widths;
|
| +
|
| + SCRIPT_ANALYSIS script_analysis;
|
| +
|
| + scoped_array<WORD> glyphs;
|
| + scoped_array<WORD> logical_clusters;
|
| + scoped_array<SCRIPT_VISATTR> visible_attributes;
|
| + int glyph_count;
|
| +
|
| + scoped_array<int> advance_widths;
|
| + scoped_array<GOFFSET> offsets;
|
| + ABC abc_widths;
|
| +
|
| + scoped_array<SCRIPT_LOGATTR> logical_attributes;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(TextRun);
|
| +};
|
| +
|
| +} // namespace internal
|
| +
|
| // RenderTextWin is the Windows implementation of RenderText using Uniscribe.
|
| class RenderTextWin : public RenderText {
|
| public:
|
| RenderTextWin();
|
| virtual ~RenderTextWin();
|
|
|
| + // Overridden from RenderText:
|
| + virtual void SetText(const string16& text) OVERRIDE;
|
| + virtual void SetDisplayRect(const Rect& r) OVERRIDE;
|
| + virtual void ApplyStyleRange(StyleRange style_range) OVERRIDE;
|
| + virtual void ApplyDefaultStyle() OVERRIDE;
|
| + virtual int GetStringWidth() OVERRIDE;
|
| + virtual void Draw(Canvas* canvas) OVERRIDE;
|
| + virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE;
|
| + virtual std::vector<Rect> GetSubstringBounds(size_t from, size_t to) OVERRIDE;
|
| + virtual Rect GetCursorBounds(const SelectionModel& selection,
|
| + bool insert_mode) OVERRIDE;
|
| +
|
| + protected:
|
| + // Overridden from RenderText:
|
| + virtual SelectionModel GetLeftSelectionModel(const SelectionModel& current,
|
| + BreakType break_type) OVERRIDE;
|
| + virtual SelectionModel GetRightSelectionModel(const SelectionModel& current,
|
| + BreakType break_type) OVERRIDE;
|
| +
|
| + // TODO(msw): Implement this with complex script support.
|
| + // virtual size_t GetIndexOfPreviousGrapheme(size_t position) OVERRIDE;
|
| +
|
| private:
|
| + void ItemizeLogicalText();
|
| + void LayoutVisualText(HDC hdc);
|
| +
|
| + // Return the run index that contains the argument; or the length of the
|
| + // |runs_| vector if argument exceeds the text length or width.
|
| + size_t GetRunContainingPosition(size_t position) const;
|
| + size_t GetRunContainingPoint(const Point& point) const;
|
| +
|
| + // Get the neighboring selection model, which may not be at a valid stop.
|
| + SelectionModel LeftSelectionModel(const SelectionModel& selection) const;
|
| + SelectionModel RightSelectionModel(const SelectionModel& selection) const;
|
| +
|
| + // Get the SelectionModels corresponding to the left and right text ends.
|
| + SelectionModel LeftEndSelectionModel() const;
|
| + SelectionModel RightEndSelectionModel() const;
|
| +
|
| + // Draw the text, cursor, and selection.
|
| + void DrawSelection(Canvas* canvas);
|
| + void DrawVisualText(Canvas* canvas);
|
| + void DrawCursor(Canvas* canvas);
|
| +
|
| + // Convert points from the text space to the view space and back.
|
| + // Handles the display area, display offset, and the application LTR/RTL mode.
|
| + Point RenderTextWin::ToTextPoint(const Point& point);
|
| + Point RenderTextWin::ToViewPoint(const Point& point);
|
| +
|
| + bool text_is_dirty_;
|
| + bool style_is_dirty_;
|
| +
|
| + // National Language Support native digit and digit substitution settings.
|
| + SCRIPT_DIGITSUBSTITUTE digit_substitute_;
|
| +
|
| + SCRIPT_CONTROL script_control_;
|
| + SCRIPT_STATE script_state_;
|
| +
|
| + SCRIPT_CACHE script_cache_;
|
| +
|
| + std::vector<internal::TextRun*> runs_;
|
| + int string_width_;
|
| +
|
| + scoped_array<int> visual_to_logical_;
|
| + scoped_array<int> logical_to_visual_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(RenderTextWin);
|
| };
|
|
|
|
|