While investigating using glyph_boudning_box_ for LayoutNG[1], I found there are a few cases where we compute it incorrectly. They're less visible in the current layout thanks to word cache, but is more visible to LayoutNG where we shape longer text.
1. When runs are split, glyph bounds of each run starts at (0, 0) and
united, resulting much smaller width.[2]
2. The usage of offset looks incorrect.
3. In vertical flow, physical and logical coordinates are mixed and
united.
#1 affects when a word (in current layout engine, a block of text in LayoutNG) contains more than one font, script, orientation, or such properties that causes runs to split. We compute bounds of each run at (0,0) and unite, so the bounds is much smaller.
#2 affects when glyph offset is non-zero. This happens in some complex scripts, and in vertical flow.
#3 affects vertical flow, and needs rather larger fix than #1/#2.
[1] r487410, https://chromium-review.googlesource.com/c/574508/
Comment 1 by kojii@chromium.org
, Jul 20 2017