[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] Amharic text and QtLineEdit
From: "Timothy W. Grove" <tim_grove () sil ! org>
Date: 2018-03-14 8:40:12
Message-ID: 971821cd-01e1-793e-b6e6-aa63fe41a002 () sil ! org
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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@sil.org
> <mailto:tim_grove@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@riverbankcomputing.com
> <mailto:PyQt@riverbankcomputing.com>
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
> <https://www.riverbankcomputing.com/mailman/listinfo/pyqt>
>
>
[Attachment #5 (text/html)]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hello Zachary,</p>
<p>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:</p>
<p>f = QFont('Kefa')<br>
le.setFont(f)</p>
<p>Best regards,</p>
<p>Tim<br>
</p>
<br>
<div class="moz-cite-prefix">On 14/03/2018 00:09, Zachary Scheuren
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAFBf+HdzdeQLDZfgM757nF6U4PWLE_iGXbwX-MXuVOFqiEJKjg@mail.gmail.com">
<div dir="ltr"><span
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font- \
variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-ali \
gn:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-colo \
r:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Hi
Tim,</span>
<div
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font- \
variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-ali \
gn:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-colo \
r:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br> </div>
<div
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font- \
variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-ali \
gn:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-colo \
r:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">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 <a
href="https://doc.qt.io/qt-5/qfont.html" target="_blank"
style="color:rgb(17,85,204)" \
moz-do-not-send="true">https://doc.qt.io/qt-5/<wbr>qfont.html</a></div> <div
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font- \
variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-ali \
gn:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-colo \
r:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br> <div>For \
a quick test on macOS I added</div> <div><br>
</div>
<div>le.setFont('Kefa') </div>
<div><br>
</div>
<div>and that forced the QLineEdit to use the installed Kefa
font. I also tried with 'Noto Sans Ethiopic' and that
worked, too. </div>
<div>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.</div>
<div><br>
</div>
<div>Hope that helps.</div>
<div><br>
</div>
<div>Zachary</div>
</div>
<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Mar 13, 2018 at 9:31 AM,
Timothy W. Grove <span dir="ltr"><<a
href="mailto:tim_grove@sil.org" target="_blank"
moz-do-not-send="true">tim_grove@sil.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<p>Has anyone ever had trouble displaying Amharic text in
a QLineEdit, or had similar issues with other scripts to
what I'm describing below?</p>
<p>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. <br>
</p>
<p>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.</p>
<p>My input method for MacOS is Keyman with SIL-Ethiopic (<a
class="m_4022434960405102886moz-txt-link-freetext"
href="https://keyman.com/macos/" target="_blank"
moz-do-not-send="true">https://keyman.com/macos/</a>).
<br>
</p>
<p>I made a simple example below which only uses a dialog
containing one QLineInput, where the problem can be
seen.<br>
</p>
<blockquote>
<p><font size="-2"><i>from PyQt5.QtWidgets import
QDialog, QApplication, QLineEdit</i><i><br>
</i><i><br>
</i><i>class TestDlg(QDialog):</i><i><br>
</i><i> def __init__(self): </i><i><br>
</i><i> super(TestDlg, self).__init__()</i><i><br>
</i><i> le = QLineEdit(self)</i><i><br>
</i><i> </i><i><br>
</i><i>app = QApplication([]) </i><i><br>
</i><i>dlg = TestDlg()</i><i><br>
</i><i>if dlg.exec_():</i><i><br>
</i><i> pass</i><i> </i><i><br>
</i><i>app.exec_()</i></font></p>
<p><font size="-2"><i><br>
</i></font></p>
</blockquote>
<p>Not much to go on, but I'm hoping that someone
somewhere has seen something like this before.</p>
<p>Best regards,<br>
Tim<br>
</p>
</div>
<br>
______________________________<wbr>_________________<br>
PyQt mailing list <a
href="mailto:PyQt@riverbankcomputing.com"
moz-do-not-send="true">PyQt@riverbankcomputing.com</a><br>
<a
href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt"
rel="noreferrer" target="_blank" \
moz-do-not-send="true">https://www.<wbr>riverbankcomputing.com/<wbr>mailman/listinfo/pyqt</a><br>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>
[Attachment #6 (text/plain)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic