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

Unified Diff: ui/gfx/render_text_harfbuzz.cc

Issue 923973003: Fix the x-offset calculation when drawing the text. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text_harfbuzz.cc
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc
index 7e916ff3ae21142a633c45521e402b3b1b44ebc8..f24732b7ff3f203bb9a300660c30b6b991ca0ba8 100644
--- a/ui/gfx/render_text_harfbuzz.cc
+++ b/ui/gfx/render_text_harfbuzz.cc
@@ -1012,8 +1012,10 @@ void RenderTextHarfBuzz::DrawVisualText(Canvas* canvas) {
background_is_transparent());
Range glyphs_range = run.CharRangeToGlyphRange(segment.char_range);
scoped_ptr<SkPoint[]> positions(new SkPoint[glyphs_range.length()]);
- SkScalar offset_x =
- preceding_segment_widths - run.positions[glyphs_range.start()].x();
+ SkScalar offset_x = preceding_segment_widths -
+ ((glyphs_range.GetMin() != 0)
+ ? run.positions[glyphs_range.GetMin()].x()
+ : 0);
for (size_t j = 0; j < glyphs_range.length(); ++j) {
positions[j] = run.positions[(glyphs_range.is_reversed()) ?
(glyphs_range.start() - j) :
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698