Skip to content

Commit 496383f

Browse files
committed
paint orthogonal text flow in logical order
oops... 9e531cd
1 parent 9990a39 commit 496383f

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/layout-text.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2640,7 +2640,7 @@ export function positionIfcItems(
26402640
}
26412641

26422642
if (isFirstOccurance) inlineSideAdvance(inline, 'start');
2643-
const offset = Math.max(item.offset, mark);
2643+
const offset = Math.max(item.offset, inline.textStart);
26442644
boxBuilder?.open(inline, offset, isFirstOccurance, bgcursor, y - baselineShift);
26452645

26462646
if (isFirstOccurance) {

test/paint.spec.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,19 @@ describe('Painting', function () {
771771
]);
772772
});
773773

774+
it('paints orthogonal flow in logical order', function () {
775+
this.reflow(`
776+
<div style="direction: rtl; font-size: 10px;">
777+
<span style="background-color: #000;">snow</span>
778+
</div>
779+
`);
780+
781+
expect(this.paint().getCalls()).to.deep.equal([
782+
{t: 'rect', x: 600, y: 0, width: 40, height: 10, fillColor: '#000'},
783+
{t: 'text', x: 600, y: 8, text: 'snow', fillColor: '#000'}
784+
]);
785+
});
786+
774787
// TODO: would go better in a general box.spec.js
775788
describe('Pixel snapping', function () {
776789
it('snaps the border box', function () {

0 commit comments

Comments
 (0)