[PyQt] Amharic text and QtLineEdit

Zachary Scheuren angryjaga at gmail.com
Wed Mar 14 00:09:53 GMT 2018


Hi Tim,

I've had this problem before when trying to support multiple scripts and
customize them in different ways. In your example since the QLineEdit isn't
getting an appropriate font you can do it by explicitly setting a font or
setting up appropriate styles for fallback, etc as explained at
https://doc.qt.io/qt-5/qfont.html

For a quick test on macOS I added

le.setFont('Kefa')

and that forced the QLineEdit to use the installed Kefa font. I also tried
with 'Noto Sans Ethiopic' and that worked, too.
It does seem like a bug that the font matching algorithm fails to find a
suitable font when you know one exists, but I always just set it myself or
gave users the option to use whatever font they wanted.

Hope that helps.

Zachary


On Tue, Mar 13, 2018 at 9:31 AM, Timothy W. Grove <tim_grove at sil.org> wrote:

> Has anyone ever had trouble displaying Amharic text in a QLineEdit, or had
> similar issues with other scripts to what I'm describing below?
>
> When typing Amharic text into a QLineEdit on MacOS I'm not seeing the
> expected text but blocks of horizontal lines in place of each character. If
> I copy those blocks and paste them into some other (non-pyqt) application
> the Amharic text appears. Conversely, if I type well-formed Amharic text in
> another application and copy-and-paste that back into my pyqt application,
> only those blocks of lines appear.
>
> Something similar happens under Windows. (I can't repeat this myself, but
> it's reported by another user) When Amharic is typed blank spaces appear,
> like typing white text onto a white background. Again, the same results as
> above for copying and pasting.
>
> My input method for MacOS is Keyman with SIL-Ethiopic (
> https://keyman.com/macos/).
>
> I made a simple example below which only uses a dialog containing one
> QLineInput, where the problem can be seen.
>
> *from PyQt5.QtWidgets import QDialog, QApplication, QLineEdit*
>
> *class TestDlg(QDialog):*
> *    def __init__(self):        *
> *        super(TestDlg, self).__init__()*
> *        le = QLineEdit(self)*
>
> *app = QApplication([])        *
> *dlg = TestDlg()*
> *if dlg.exec_():*
> *    pass*
> *app.exec_()*
>
>
> Not much to go on, but I'm hoping that someone somewhere has seen
> something like this before.
>
> Best regards,
> Tim
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180313/32dcf027/attachment.html>


More information about the PyQt mailing list