-
-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some FontAwesome icons do not match #107
Comments
Thanks for reporting @jnsebgosselin. Quick question: does this happen if you downgrade to 0.5.3? |
This happens with version 0.5.3 and 0.5.5. |
Hello there! 👋 Upon closer inspection, it would appear it might be an issue specific to Windows. I checked your icon names that appeared wrongly for you:
...so at the very least I can confirm it is not a bad character mapping. Just checked on my side with this code: (Almost same as @jnsebgosselin 's just with red icons due to my dark OS theme and the missing "QSize" imported.) import sys
import qtawesome as qta
from PyQt5.QtCore import QSize
from PyQt5.QtWidgets import (QApplication, QWidget, QGridLayout,
QToolButton, QLabel)
app = QApplication(sys.argv)
window = QWidget()
layout = QGridLayout(window)
names = ['fa5s.grip-horizontal', 'fa5s.file-export', 'fa5s.file-import']
for i, name in enumerate(names):
qicon = qta.icon(name, scale_factor=1.3, color='red')
btn = QToolButton()
btn.setIcon(qicon)
btn.setIconSize(QSize(32, 32))
layout.addWidget(btn, i, 0)
layout.addWidget(QLabel(name), i, 1)
window.show()
sys.exit(app.exec_()) with PyQt 5.6 on Python 2.7 running Linux CentOS 7.4, and I got this window: If anyone else is reading this, care to confirm if any Windows system is affected or if it's an isolated issue to the issue creator? @jnsebgosselin can you tell us more about your environment? What Python version? And what PyQt or PySide/PySide2 version are you using? (Also, did you use an online installer or compiled it yourself?) Also, is your system locale in normal US English or something more uncommon? (Sometimes certain locales can make code behave funny.) |
I'm in Windows 10. Executing Below are the details of a conda environment with which I can reproduce the issue:
|
@CAM-Gerlach would you be so kind to test this code on Windows and post back the results please?
|
Sure @jnsebgosselin . Under Windows 8.1 x64, Python 3.6.7, QtAwesome 0.5.5, and PyQt 5.9.2/Qt 5.9.6:
Full
|
Ouch. Thanks @CAM-Gerlach! |
I retested on Python 3.7, and UTF-8 mode had no effect on either output, BTW. |
For what it's worth, |
Hey guys, what do you get from this: import sys
print sys.maxunicode
|
Also if either of you wouldn't mind pasting your adjusted code using I sadly live in the world of Python 2.7 for my professional day-to-day as we haven't began touching 3.x yet due to lack of support in the softwares of the industry I'm in. Perhaps there's something unusual behaviour happening in 3.x land. Furthermore, would you mind giving a try to the repro snippets on Python 2.7 or higher but less than 3.x? I'm curious if this is a Windows issue or a Python 2 vs 3 issue. If it renders the same then maybe it's a Windows problem. If it renders properly, we'll know something's different with Py3k's execution of the module. Just trying to narrow the focus on where things could be going wrong. 🤞 |
|
Trying this with Python 2.7.15 on Windows results in the same problem. |
🤦♂️ 🤦♂️ 🤦♂️
The change is rather trivial (and in a production setting you'd want to use
I'd suggest you just grab Miniconda and test it with that; it shouldn't take more than a few minutes to install and get QtAwesome running.
Quite sad, indeed. I would strongly recommend you begin at least getting familiar with
I dug out my old Py2.7 environment, updated to QtAwesome 0.5.5 and somewhat more modern versions of the main deps (Python 2.7.14, PyQt 5.6.0, Qt 5.6.2, QtPy 1.5.2) and I got the same result as under Py3k: |
Thanks for trying in Python 2, guys.
For context, in my industry (visual effects for film and tv), all our principal software formed a mini consortium called the VFX Platform that agrees every year on future versions of libraries/dependencies that everybody should match. Python 3 is was supposed to come this year but vendors missed the mark. Now it's slated for 2020. I sense a bumpy road ahead. Anyway, I digress... @ccordoba12: any ideas where the bug may lie? |
Ah, that's something I am actually obliquely familiar with, since way back in the day when I was in high school I used to work side gigs in video production for various smaller-time clients (corporate, education, etc) and VFX (particularly layer-based compositing-type work in AE) was my "specialty" per say, and I wrote plenty of simple Python scripts for that (in fact, I think that was the first time I ever used Python).
Uh... should we tell him? :D |
Since it appears to be not the source of the issue, please let's focus on the issue and stop discussing the state of Python2 versus Python3 stuff here. There is gitter for that :) |
Fair point; I removed most of that from my post, other than a short aside responding to his aside. For the record, I thought Gitter was for getting help and questions about Spyder, not idle chatter? |
You can talk about whatever you want in private chat. Anyway, that is not my point. |
Mmmh, @CAM-Gerlach, @jnsebgosselin, what happens if you install the fontawesome fonts in your system (as with a regular font)? Does that fix the problem? |
@ccordoba12 Same result. I installed all three OTF files from the FA Free desktop font download on my system, and then re-ran both versions of the test script, and nothing changed. |
Then I don't know. |
@darkvertex I can try changing my system locale and see if that affects the results (since @jnsebgosselin has both a different locale and is getting different results), but it requires a restart which I can't really do right now... |
I will investigate further in the next few days about this until I find what is going on because I really need this to work. |
@ccordoba12 @darkvertex Running this with Python 3: import sys
import os.path as osp
from PyQt5.QtWidgets import (QApplication, QWidget, QGridLayout, QLabel)
from qtpy.QtGui import QFontDatabase, QFont
app = QApplication(sys.argv)
root = "C:/Anaconda3/envs/gwhat-dev/Lib/site-packages/qtawesome/fonts/"
ttf_filenames = ["elusiveicons-webfont.ttf",
"fontawesome4.7-webfont.ttf",
"fontawesome5-brands-webfont.ttf",
"fontawesome5-regular-webfont.ttf",
"fontawesome5-solid-webfont.ttf",
"materialdesignicons-webfont.ttf"]
for ttf_filename in ttf_filenames:
id_ = QFontDatabase.addApplicationFont(osp.join(root, ttf_filename))
font_family = QFontDatabase.applicationFontFamilies(id_)
print('{} - {:<32s} :'.format(id_, ttf_filename), *font_family)
font = QFont('Font Awesome 5 Free')
font.setPixelSize(24)
window = QWidget()
layout = QGridLayout(window)
pairs = [('grip-horizontal', chr(0xf58d)),
('file-export', chr(0xf56e)),
('file-import', chr(0xf56f))]
for name, char in pairs:
label = QLabel(char + ' = ' + name)
label.setFont(font)
label.setStyleSheet("QLabel { background-color: black; color: red; }")
layout.addWidget(label)
window.show()
sys.exit(app.exec_()) results in :
In my code above, if I remove |
So in the example above, I have not used Running this: import sys
from PyQt5.QtWidgets import QApplication
import qtawesome as qta
app = QApplication(sys.argv)
print('fa5b :', qta.font('fa5b', 24).family())
print('fa5s :', qta.font('fa5s', 24).family())
print('fa5 :', qta.font('fa5', 24).family())
sys.exit(app.exec_()) returns:
|
So yeah, for the moment, that is the most plausible explanation I have for this issue, i.e. that the |
same as #97 it appears. Solution was renaming the font with specific tool. This is a windows specific issue though. Edit : Updating fonts after v0.5.1 made issue reappear. |
Yes, I confirm this. Everything works as expected with |
@darkvertex is it possible that you did not renamed the fonts when you updated FontAwesome? |
Test that each font used by qtawesome has a unique name. Regression test for Issue spyder-ide#107
I definitely did not rename any fonts. They are as-is from what the released zip files give you. When introducing FA5 we saw that the doubled font name between solid and regular was an issue in Linux (and we assumed other platforms) and someone committed this fix: I suppose I could mess with the fonts with: |
@darkvertex I'm confused. I thought you actually renamed the font names in PR #98 with the This seems to have fixed the problem in v0.5.1 and v0.5.2. At least, when I use these versions, everything is working as expected for me in Windows. |
Sorry, seems I'm confused also. It appears I forgot the renaming step in the last update to the newest FA version. 🤦♂️ My apologies. PR incoming! |
@darkvertex Alright thank you very much! I'm in the process of adding a test in PR #108 to cover this in the future. |
Great idea, thanks for writing the test. |
PR #109 has the renamed fonts. Care to give it a try when you have a minute, @jnsebgosselin / @CAM-Gerlach ? |
Yes, this is working, thanks. |
Awesome! \o/ |
@darkvertex Looks like it works for me too; I commented over on the PR. |
Upon returning to work from the US Government shutdown, and updating all my libraries I discovered that my icons were broken and it looks like it is this issue. I was the one who suggested the font renaming in the previous issue. Should font renaming be part of a build / packaging / deploy script? Should we look at fixing this "upstream" by talking to the Font Awesome people? Edit: Or add a test that fails if the names are the same. |
Hi there @flutefreak7 - happy to hear your government is alive again.
It's not part of deployment exactly, but as part of the "update_fa5" command used for updating the FontAwesome version within the package, there is a font renaming step since PR #110 so all future updates will have unique font names.
Maybe? Here's their repo: 👉 https://github.com/FortAwesome/Font-Awesome/issues
Actually it's already done since PR #108. |
Here is an minimal working example showing three problematic icons:
https://fontawesome.com/icons/grip-horizontal?style=solid
https://fontawesome.com/icons/file-export?style=solid
https://fontawesome.com/icons/file-import?style=solid
The text was updated successfully, but these errors were encountered: