Skip to content

Commit

Permalink
Use Canvas.drawTextRun instead of drawText
Browse files Browse the repository at this point in the history
drawText does (very) basic BiDi, which causes inconsistent behaviour.
This ensures everything is LtR.
  • Loading branch information
MatanZ authored and KitsunedFox committed Dec 30, 2022
1 parent 251bdd4 commit 068e7af
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ private void drawTextRun(Canvas canvas, char[] text, int[] palette, float y, int
mTextPaint.setColor(foreColor);

// The text alignment is the default Paint.Align.LEFT.
canvas.drawText(text, startCharIndex, runWidthChars, left, y - fontLineSpacingAndAscent, mTextPaint);

canvas.drawTextRun(text, startCharIndex, runWidthChars, startCharIndex, runWidthChars, left, y - mFontLineSpacingAndAscent, false, mTextPaint);
}

if (savedMatrix) canvas.restore();
Expand Down

0 comments on commit 068e7af

Please sign in to comment.