Fix ShapeResult::Bounds() when runs are split
HarfBuzzShaper calls ShapeResult::InsertRun() for each run RunSegmenter segmented. This patch fixes ShapeResult::InsertRun() to compute ShapeResult::glyph_bounding_box_ when there are more than one run. Before this fix, it computes glyph bounding box of each run from (0,0) then unite all bounding boxes. So if input text is "englishARABIC", RunSegmenter creates 2 runs and each InsertRun computes: Run 1: "english", width 70, bounding box (0,0,70,10) (x,y,w,h) Run 2: "ARABIC", width 80, bounding box (0,0,80,10) then the united result would be (0,0,80,0) while the total width is 150. This patch fixes InsertRun() to compute bounding box from the current point, so that: Run 1: "english", width 70, bounding box (0,0,70,10) Run 2: "ARABIC", width 80, bounding box (70,0,80,10) and the united result would be (0,0,150,0). This patch also removes incorrect fix made to ShapeResult::CopyRange(). This was done to pass tests in a previous CL[1], but turned out that the original glyph bounds is incorrect and the fix was wrong. [1] r487410, https://chromium-review.googlesource.com/c/574508/ BUG=746904, 636993 Change-Id: Iec147e5e9b9853a60489e23355ede730ce918c36 Reviewed-on: https://chromium-review.googlesource.com/577970Reviewed-by:Emil A Eklund <eae@chromium.org> Reviewed-by:
Dominik Röttsches <drott@chromium.org> Commit-Queue: Koji Ishii <kojii@chromium.org> Cr-Commit-Position: refs/heads/master@{#488626}
Showing
Please register or sign in to comment