[PyQt] Rendering unicode 0x1D122 on Linu
Peter Howard
peterhoward42 at googlemail.com
Wed Aug 5 15:24:33 BST 2009
Hi Phil,
I wonder if you can shed any light on this problem – or suggest diagnostic
steps.
The program below successfully renders the bass cleff musical symbol on a
Windows/PyQt installation:
from PyQt4.QtGui import *
from PyQt4.QtCore import *
local_app = QApplication([])
buf = u"<font style='font-family: Euterpe; font-size:
40px;'>\U0001D122</font>"
lbl = QLabel()
lbl.setText(buf)
lbl.show()
local_app.exec_()
The same program on a Linux installation runs without complaint, but shows a
different character in place of the expected bass cleff symbol (I don't know
what it is).
Of course this is dependent on the cited font being available. In both cases
I have intalled the Euterpre truetype font:
http://openfontlibrary.org/media/files/Eimai/191
I have attempted to prove the successful installation of this font on the
Linux machine using the Gnome Character Map application. This sucessfully
shows a bunch of musical symbols in the preview pane when the Euterpre font
is selected, and with the music symbols unicode block selected. If I
uninstall/reinstall the font, this application's ability to preview the
musical symbols disappears / reappears accordingly. So it seems the font is
viable and available.
You will see that the unicode code point in question is > 0xFFFF, ie beyond
the basic multilingual plane, and thus requires surrogate-pair
representation in Python. (std build)
I have tried to reproduce the problem in straight C++ Qt (to rule out PyQt)
, but have fallen near the finishing post.
The program below is I believe equivalent to the Python - and this builds
and runs as expected. However my hurdle is that I am not confident about how
to insert the unicode string literal into the C++, and thus cannot quite
finish the job.
#include <QApplication>
#include <QLabel>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QString s("<font style='font-family: Euterpe; font-size: 40px;'>plain
text</font>");
QLabel label(s);
label.show();
return app.exec();
}
The Linux machine environment is: Ubuntu 9.04. Qt 4.5.0, Python 2.6, PyQt
4.5.4
Any advice gratefully received.
Peter Howard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090805/89819360/attachment.html
More information about the PyQt
mailing list