From 6c00f1fc61e75df9e3b74ab42e2421623b646ca7 Mon Sep 17 00:00:00 2001 From: Matan Ziv-Av Date: Mon, 19 Sep 2022 10:56:21 +0300 Subject: [PATCH] Fixed: 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();