From ea3426860cd98b5183baefd886e6bd68d6da4646 Mon Sep 17 00:00:00 2001 From: Matan Ziv-Av Date: Mon, 19 Sep 2022 10:56:21 +0300 Subject: [PATCH] Use Canvas.drawTextRun instead of drawText drawText does (very) basic BiDi, which causes inconsistent behaviour. This ensures everything is LtR. --- .../src/main/java/com/termux/view/TerminalRenderer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminal-view/src/main/java/com/termux/view/TerminalRenderer.java b/terminal-view/src/main/java/com/termux/view/TerminalRenderer.java index 307e422694..a4bef7d37c 100644 --- a/terminal-view/src/main/java/com/termux/view/TerminalRenderer.java +++ b/terminal-view/src/main/java/com/termux/view/TerminalRenderer.java @@ -233,7 +233,7 @@ 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 - mFontLineSpacingAndAscent, mTextPaint); + canvas.drawTextRun(text, startCharIndex, runWidthChars, startCharIndex, runWidthChars, left, y - mFontLineSpacingAndAscent, false, mTextPaint); } if (savedMatrix) canvas.restore();