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

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

Issue 385463002: Support FontRenderParams on Win; fix RenderTextHarfBuzz. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix header guards. Created 6 years, 5 months 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
OLDNEW
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 #include "ui/gfx/render_text_win.h" 5 #include "ui/gfx/render_text_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/i18n/break_iterator.h" 9 #include "base/i18n/break_iterator.h"
10 #include "base/i18n/char_iterator.h" 10 #include "base/i18n/char_iterator.h"
11 #include "base/i18n/rtl.h" 11 #include "base/i18n/rtl.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/win/windows_version.h" 15 #include "base/win/windows_version.h"
16 #include "third_party/icu/source/common/unicode/uchar.h" 16 #include "third_party/icu/source/common/unicode/uchar.h"
17 #include "ui/gfx/canvas.h" 17 #include "ui/gfx/canvas.h"
18 #include "ui/gfx/font_fallback_win.h" 18 #include "ui/gfx/font_fallback_win.h"
19 #include "ui/gfx/font_smoothing_win.h" 19 #include "ui/gfx/font_render_params.h"
20 #include "ui/gfx/platform_font_win.h" 20 #include "ui/gfx/platform_font_win.h"
21 #include "ui/gfx/utf16_indexing.h" 21 #include "ui/gfx/utf16_indexing.h"
22 22
23 namespace gfx { 23 namespace gfx {
24 24
25 namespace { 25 namespace {
26 26
27 // The maximum length of text supported for Uniscribe layout and display. 27 // The maximum length of text supported for Uniscribe layout and display.
28 // This empirically chosen value should prevent major performance degradations. 28 // This empirically chosen value should prevent major performance degradations.
29 // TODO(msw): Support longer text, partial layout/painting, etc. 29 // TODO(msw): Support longer text, partial layout/painting, etc.
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 void RenderTextWin::DrawVisualText(Canvas* canvas) { 802 void RenderTextWin::DrawVisualText(Canvas* canvas) {
803 DCHECK(!needs_layout_); 803 DCHECK(!needs_layout_);
804 DCHECK(!lines().empty()); 804 DCHECK(!lines().empty());
805 805
806 std::vector<SkPoint> pos; 806 std::vector<SkPoint> pos;
807 807
808 internal::SkiaTextRenderer renderer(canvas); 808 internal::SkiaTextRenderer renderer(canvas);
809 ApplyFadeEffects(&renderer); 809 ApplyFadeEffects(&renderer);
810 ApplyTextShadows(&renderer); 810 ApplyTextShadows(&renderer);
811 811
812 bool smoothing_enabled; 812 renderer.SetFontRenderParams(GetDefaultFontRenderParams(),
813 bool cleartype_enabled; 813 background_is_transparent());
814 GetCachedFontSmoothingSettings(&smoothing_enabled, &cleartype_enabled);
815 // Note that |cleartype_enabled| corresponds to Skia's |enable_lcd_text|.
816 renderer.SetFontSmoothingSettings(
817 smoothing_enabled, cleartype_enabled && !background_is_transparent(),
818 smoothing_enabled /* subpixel_positioning */);
819 814
820 ApplyCompositionAndSelectionStyles(); 815 ApplyCompositionAndSelectionStyles();
821 816
822 for (size_t i = 0; i < lines().size(); ++i) { 817 for (size_t i = 0; i < lines().size(); ++i) {
823 const internal::Line& line = lines()[i]; 818 const internal::Line& line = lines()[i];
824 const Vector2d line_offset = GetLineOffset(i); 819 const Vector2d line_offset = GetLineOffset(i);
825 820
826 // Skip painting empty lines or lines outside the display rect area. 821 // Skip painting empty lines or lines outside the display rect area.
827 if (!display_rect().Intersects(Rect(PointAtOffsetFromOrigin(line_offset), 822 if (!display_rect().Intersects(Rect(PointAtOffsetFromOrigin(line_offset),
828 line.size))) 823 line.size)))
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 size_t position = LayoutIndexToTextIndex(run->range.end()); 1275 size_t position = LayoutIndexToTextIndex(run->range.end());
1281 position = IndexOfAdjacentGrapheme(position, CURSOR_BACKWARD); 1276 position = IndexOfAdjacentGrapheme(position, CURSOR_BACKWARD);
1282 return SelectionModel(position, CURSOR_FORWARD); 1277 return SelectionModel(position, CURSOR_FORWARD);
1283 } 1278 }
1284 1279
1285 RenderText* RenderText::CreateNativeInstance() { 1280 RenderText* RenderText::CreateNativeInstance() {
1286 return new RenderTextWin; 1281 return new RenderTextWin;
1287 } 1282 }
1288 1283
1289 } // namespace gfx 1284 } // namespace gfx
OLDNEW
« ui/gfx/font_render_params_win.cc ('K') | « ui/gfx/render_text_pango.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698