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_H_ | 5 #ifndef UI_GFX_RENDER_TEXT_H_ |
6 #define UI_GFX_RENDER_TEXT_H_ | 6 #define UI_GFX_RENDER_TEXT_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <cstring> | 9 #include <cstring> |
10 #include <string> | 10 #include <string> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 // Internal helper class used by derived classes to draw text through Skia. | 49 // Internal helper class used by derived classes to draw text through Skia. |
50 class SkiaTextRenderer { | 50 class SkiaTextRenderer { |
51 public: | 51 public: |
52 explicit SkiaTextRenderer(Canvas* canvas); | 52 explicit SkiaTextRenderer(Canvas* canvas); |
53 ~SkiaTextRenderer(); | 53 ~SkiaTextRenderer(); |
54 | 54 |
55 void SetDrawLooper(SkDrawLooper* draw_looper); | 55 void SetDrawLooper(SkDrawLooper* draw_looper); |
56 void SetFontRenderParams(const FontRenderParams& params, | 56 void SetFontRenderParams(const FontRenderParams& params, |
57 bool background_is_transparent); | 57 bool background_is_transparent); |
58 void SetFontHinting(SkPaint::Hinting hinting); | |
59 void SetTypeface(SkTypeface* typeface); | 58 void SetTypeface(SkTypeface* typeface); |
60 void SetTextSize(SkScalar size); | 59 void SetTextSize(SkScalar size); |
61 void SetFontFamilyWithStyle(const std::string& family, int font_style); | 60 void SetFontFamilyWithStyle(const std::string& family, int font_style); |
62 void SetForegroundColor(SkColor foreground); | 61 void SetForegroundColor(SkColor foreground); |
63 void SetShader(SkShader* shader, const Rect& bounds); | 62 void SetShader(SkShader* shader, const Rect& bounds); |
64 // Sets underline metrics to use if the text will be drawn with an underline. | 63 // Sets underline metrics to use if the text will be drawn with an underline. |
65 // If not set, default values based on the size of the text will be used. The | 64 // If not set, default values based on the size of the text will be used. The |
66 // two metrics must be set together. | 65 // two metrics must be set together. |
67 void SetUnderlineMetrics(SkScalar thickness, SkScalar position); | 66 void SetUnderlineMetrics(SkScalar thickness, SkScalar position); |
68 void DrawSelection(const std::vector<Rect>& selection, SkColor color); | 67 void DrawSelection(const std::vector<Rect>& selection, SkColor color); |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 // Lines computed by EnsureLayout. These should be invalidated with | 700 // Lines computed by EnsureLayout. These should be invalidated with |
702 // ResetLayout and on |display_rect_| changes. | 701 // ResetLayout and on |display_rect_| changes. |
703 std::vector<internal::Line> lines_; | 702 std::vector<internal::Line> lines_; |
704 | 703 |
705 DISALLOW_COPY_AND_ASSIGN(RenderText); | 704 DISALLOW_COPY_AND_ASSIGN(RenderText); |
706 }; | 705 }; |
707 | 706 |
708 } // namespace gfx | 707 } // namespace gfx |
709 | 708 |
710 #endif // UI_GFX_RENDER_TEXT_H_ | 709 #endif // UI_GFX_RENDER_TEXT_H_ |
OLD | NEW |