From 1f097a6d27b7cbe33f255f0fee4cb91d7f14809f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Fri, 27 Sep 2024 13:38:31 +0800 Subject: [PATCH] fix --- .../rendertext/textbrowser_imp/base.py | 17 ++++++++++------- plugins/CMakeLists.txt | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/base.py b/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/base.py index f48ef6ff..30ace68a 100644 --- a/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/base.py +++ b/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/base.py @@ -1,5 +1,6 @@ from qtsymbols import * from myutils.config import globalconfig +import unicodedata class base(QWidget): @@ -55,13 +56,15 @@ class base(QWidget): self.movedy = 0 dx, dy = self.moveoffset() text = self.text() - isarabic = lambda char: (ord(char) >= 0x0600 and ord(char) <= 0x06E0) - isfirstara = lambda text: len(text) and ( - isarabic(text[0]) - or (any(isarabic(_) for _ in text)) - and (isarabic(text[0]) or (ord(text[0]) in (32, 46))) - ) - if isfirstara(text): + al = False + for _ in text: + d = unicodedata.bidirectional(_) + if d == "AL" or d == "R": + al = True + break + if d == "L": + break + if al: self.movedx -= self.width() self.movedx += dx else: diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index c60958a6..958a1ef5 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -29,7 +29,7 @@ include(generate_product_version) set(VERSION_MAJOR 5) set(VERSION_MINOR 38) -set(VERSION_PATCH 13) +set(VERSION_PATCH 14) add_library(pch pch.cpp) target_precompile_headers(pch PUBLIC pch.h)