[PyQt] Amharic text and QtLineEdit

Timothy W. Grove tim_grove at sil.org
Wed Mar 14 08:40:12 GMT 2018


Hello Zachary,

Thank you for your reply and for your solution; it works great! The only 
amendment to your quick test needed was to create a QFont object first 
and then set it:

f = QFont('Kefa')
le.setFont(f)

Best regards,

Tim


On 14/03/2018 00:09, Zachary Scheuren wrote:
> 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 
> <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 
> <mailto: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
>     <mailto:PyQt at riverbankcomputing.com>
>     https://www.riverbankcomputing.com/mailman/listinfo/pyqt
>     <https://www.riverbankcomputing.com/mailman/listinfo/pyqt>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180314/0c0c0510/attachment-0001.html>


More information about the PyQt mailing list