-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
Cannot use both regular and solid fonts together in the same Qt/QML application #12787
Comments
Hi! Thanks for being part of the Font Awesome Community. Sorry but I cannot help. Let's wait for some feedback by the community
Please check with another font (with separate files for each style)
@robmadole is there something we can do about this? |
Hi @tagliala, thanks for the hint! I tried to reproduce this with another Font (I tried with Comfortaa) by doing the following:
The results:
as expected. And the rendering is as follows: Which looks as expected. Then, I tried the same with Font Awesome:
The result: On standard out it prints: qml: Font Awesome 5 Free And the result is this: Here, my expectation would have been that the lighter variants would use the icons from the regular font while the bolder ones use the one from the solid one. |
@mhoeher I'm not sure I can be of much use to you. Those fonts are using different weight classes. I'm not sure how Qt handles that. You might try using the .OTF files instead if that's possible. |
Hi @robmadole, I modified my sample from above and replaced the |
One of our application we are using is using the qt QFontDatabase (https://doc.qt.io/qt-5/qfontdatabase.html#addApplicationFont) class and we are having a similar problem with it not being able to distinguish between the light/regular/solid TTF webfonts. The developer of that software company informed us that the cause of the issue is because all these TTF fonts have the exact same name: "Font Awesome 5 Pro". Can you please add "Light", "Regular", and "Solid" to the name of these fonts so that libraries like Qt can distinguish them? |
Maybe this is the same issue as #13320 |
Hi @tagliala, after your hint I tried my example from above with the most recent release. The good news: Using the So it seems there were some fixes for these files :-) In addition, I tried with the |
Glad you've solved. .ttf files are not supposed to be used on the desktop, because they are generated for the web by a webfont script |
Okay, then I think this issue can be considered done ;-) |
the ttf file was modified to give it a unique font name. steps were: sudo apt install fonttools # to install '/usr/bin/ttx' ttx fa-solid-900.ttf # produces a TTX file sed -i 's/Font Awesome 5/Font Awesome Solid 5/' fa-solid-900.ttx rm fa-solid-900.ttf ttx fa-solid-900.ttx # converts back to TTF unique font name was assigned to avoid issues described at: FortAwesome/Font-Awesome#12787 https://stackoverflow.com/a/49956771/10278
the ttf file was modified to give it a unique font name. steps were: sudo apt install fonttools # to install '/usr/bin/ttx' ttx fa-solid-900.ttf # produces a TTX file sed -i 's/Font Awesome 5/Font Awesome Solid 5/' fa-solid-900.ttx rm fa-solid-900.ttf ttx fa-solid-900.ttx # converts back to TTF unique font name was assigned to avoid issues described at: FortAwesome/Font-Awesome#12787 https://stackoverflow.com/a/49956771/10278
the ttf file was modified to give it a unique font name. steps were: sudo apt install fonttools # to install '/usr/bin/ttx' ttx fa-solid-900.ttf # produces a TTX file sed -i 's/Font Awesome 5/Font Awesome Solid 5/' fa-solid-900.ttx rm fa-solid-900.ttf ttx fa-solid-900.ttx # converts back to TTF unique font name was assigned to avoid issues described at: FortAwesome/Font-Awesome#12787 https://stackoverflow.com/a/49956771/10278
the ttf file was modified to give it a unique font name. steps were: sudo apt install fonttools # to install '/usr/bin/ttx' ttx fa-solid-900.ttf # produces a TTX file sed -i 's/Font Awesome 5/Font Awesome Solid 5/' fa-solid-900.ttx rm fa-solid-900.ttf ttx fa-solid-900.ttx # converts back to TTF unique font name was assigned to avoid issues described at: FortAwesome/Font-Awesome#12787 https://stackoverflow.com/a/49956771/10278
I often use Font Awesome in Qt/QML applications. In v4, this was quite straightforward, all that needed to be done was using a FontLoader and then set the font.family attribute of text elements to the font family (which could be retrieved via the
FontLoader
).With v5, we now have several font files (e.g. there are 3
*.ttf
files in the Free version). Generally, it is possible to use multipleFontLoader
s to load all of them. However, I noticed that the font family for the regular and solid variants are the same. Hence, I cannot easily switch between the two by setting thefont.family
attribute of text objects.I would have expected to be able to select the variant by one of the following:
Solid
vsRegular
. However, this also did not work (because all the font files are set toRegular
).For the time being, I worked around the issue by editing the file
fa-solid-900.ttf
with FontForge and setting the font family to Font Awesome 5 Free Solid. With the modified*.ttf
file I can easily switch between the two styles in my QML application. It would however be cool if Font Awesome would work out of the box with Qt/QML ;-)Thanks for considering!
Btw: The brands font file seems to work just fine, however, this is probably due to it uses a different font family name compared to the other two.
The text was updated successfully, but these errors were encountered: