[PyQt] Rendering unicode 0x1D122 on Linu
peterhoward42 at googlemail.com
Wed Aug 5 15:24:33 BST 2009
I wonder if you can shed any light on this problem – or suggest diagnostic
The program below successfully renders the bass cleff musical symbol on a
from PyQt4.QtGui import *
from PyQt4.QtCore import *
local_app = QApplication()
buf = u"<font style='font-family: Euterpe; font-size:
lbl = QLabel()
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:
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.
int main(int argc, char *argv)
QApplication app(argc, argv);
QString s("<font style='font-family: Euterpe; font-size: 40px;'>plain
The Linux machine environment is: Ubuntu 9.04. Qt 4.5.0, Python 2.6, PyQt
Any advice gratefully received.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt