This commit is contained in:
恍兮惚兮 2024-07-13 22:25:18 +08:00
parent 9296699635
commit b86f69da74
2 changed files with 6 additions and 5 deletions

View File

@ -40,7 +40,8 @@ if __name__ == "__main__":
) )
font = QFont() font = QFont()
font.setStyleStrategy(QFont.StyleStrategy.PreferAntialias) font.setStyleStrategy(QFont.StyleStrategy.PreferAntialias)
font.setHintingPreference(QFont.HintingPreference.PreferNoHinting) font.setHintingPreference(QFont.HintingPreference.PreferFullHinting)
# 必须PreferFullHinting不能PreferNoHinting否则阿拉伯语显示不出来
QApplication.setFont(font) QApplication.setFont(font)
app = QApplication(sys.argv) app = QApplication(sys.argv)

View File

@ -58,10 +58,10 @@ class base(QLabel):
def move(self, point: QPoint): def move(self, point: QPoint):
self.movedx = 0 self.movedx = 0
self.movedy = 0 self.movedy = 0
text = self.text() # text = self.text()
isarabic = any((ord(char) >= 0x0600 and ord(char) <= 0x06E0) for char in text) # isarabic = any((ord(char) >= 0x0600 and ord(char) <= 0x06E0) for char in text)
if isarabic: # if isarabic:
self.movedx -= self.width() # self.movedx -= self.width()
x, y = self.moveoffset() x, y = self.moveoffset()
self.movedx -= x self.movedx -= x
self.movedy -= y self.movedy -= y