spyder-ide / qtawesome

Iconic fonts in PyQt and PySide applications

Home Page:https://qtawesome.readthedocs.io/en/latest/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unicode 32 fonts (Material Design -mdi) are not rendering properly with PySide2

mhamid3d opened this issue · comments

All the fonts provided in qtawesome are using Unicode 16 BMP fonts except for Material Design which is using Unicode 32. For some reason the unicodes are getting truncated in some QT versions and all the icons show up as the garbage "?" icon.

This is happening in PySide2 v5.15.6 if you want to try to reproduce the bug.

I made a bug with QT but they are claiming that this issue is with how we are handling the unicode characters in python, causing them to be truncated. At this point I am making this issue here to see if there are any ideas of how we can adjust the code to find a solution for this.

Hi @mhamid3d thank you for the feedback! I was able to reproduce this behavior on Windows with PySide2 v5.15.6. Checked also on Windows with PyQt5 v5.15.6 but with that setup I'm able to see the icons correctly.

Checked with QtAwesome 0.7.3, 1.0.3 and current dev (1.3.0.dev0) and the result is the same except for v0.7.3 (so maybe the problem started when we changed MDI from 4.x to 5.x?) 🤔

Previews:

PySide2 v5.15.6

QtAwesome v0.7.3

imagen

QtAwesome v1.0.3

imagen

Current QtAwesome dev

imagen

PyQt5 5.15.6

QtAwesome v0.7.3

imagen

QtAwesome v1.0.3

imagen

Current QtAwesome dev

imagen

Not totally sure what could be happening :/ but maybe this means we need to check how the material design font is generated at source? We take the font from https://raw.githubusercontent.com/Templarian/MaterialDesign-Webfont/master/fonts/materialdesignicons-webfont.ttf and seems like is generated using https://github.com/fontello/svg2ttf

Maybe @ccordoba12 or @kumattau have suggestions to further debug or fix this?

This seems to me a bug in PySide2 given that QtAwesome works just fine in PyQt5.

Hey @dalthviz @ccordoba12, I was able to confirm this is an issue on how PySide2 was built, a flag is omitted on build that would've allowed support for 32bit unicode, instead now they are being truncated to 16-bit. Since MDI uses 32bit, it is the only font with issues (I tried to ask them for a 16-bit alternative but they are fully committed to 32-bit at this point).

I asked on the QT bug thread and they confirmed there is nothing we can do on the python end to work around this bug, as such I will close this. Thanks a lot for checking that!

https://bugreports.qt.io/browse/PYSIDE-1835

Thanks @mhamid3d for the new info! Hope you find a way to make this to work in the future