-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
PR: Use QRawFont and draw PainterPath of Glyph for animation to prevent tremulous spinning icons #202
Conversation
Hi @kumattau thanks for checking into this! Testing this locally seems like this also works for Windows 👍 Regarding the pros and cons maybe we could use Just in case what do you think @ccordoba12 ? |
721160a
to
37d6023
Compare
Thank you for testing @dalthviz On windows, "Stack, offset" bled quite a bit. this is because QPainterPath does not have hinting. On my ubuntu, example.py is here. The drawing method can be selected by "draw" option.
|
ad7aac7
to
dcab164
Compare
@dalthviz, I finished the update. This PR is ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kumattau for working on this! I left some suggestions regarding the comments in the code and also maybe we need to also update the docs (at least the example code in this PR) but otherwise this LGTM 👍
Thank you for review @dalthviz, I updated comment. |
Hi, @dalthviz
I try to drawImage a glyph of QRawfont. If the drawImage is okey, qtawesome does not require for QFont except for font() API. |
Hi again @kumattau, this is what I'm seeing on Windows with the latest changes: So, indeed the icon drawing locks cleaner 👍 However seems like the new code is not compatible with Qt <5.15. The tests are failling here since it our CI uses Qt 5.9.7 and locally I tried first testing with an env that had Qt 5.12.2 and the same error appeared. Could be possible to have a fallback in case |
Yes. I added fallback code and pushed it. |
Hi, @dalthviz
I found another issue. fonttools/fonttools#949 (comment) qtawesome cannot switch the drawing method from And the following error message output to the console if a glyph is missing, but this message cannot be stopped.
Should qtawesome support a font which does not have glyphs ? |
Hi again @kumattau !
I would say yes. Probably we need to find a reliable way to detect if the font does not have the needed glyphs, show some sort of warning letting users know that we were unable to use the specified config to draw the icon and then fallback to use the Maybe there are other ways to check for the character support more reliable than |
Hi @dalthviz
I got it.
I think fallback is possible.
It is quite annoying because it is always output when glyph is missing. I will do some more research on this matter. |
Hi again @kumattau , hope everything is going well! Since we will try to release v1.2.0 soon, just to know if we can make this part of the release a couple of questions: Did you find any other info that could help with the missing elements here? and also, would you like to finish this or is okay for me or someone else to try finish it? Let us know! |
@dalthviz Thank you for follow-up and I'm very sorry not to response.
The investigation has not progressed but I will reboot this PR soon (in this week or next week). |
Thanks for the prompt response @kumattau ! If you still want to finish this at some point then no problem, happy to hear that :) It would be nice to merge this for the next release v1.2.0 (which will be done probably mid-next week) but do not worry about the time, just knowing that this could be finished in the future and you are willing to keep checking on it are really good news 👍 |
Co-authored-by: Daniel Althviz Moré <[email protected]>
5906d03
to
378d009
Compare
I rebased master and fixed "load glyph failed err=24" problem by fall backing draw=text In my linux, it is better that draw=image is used for non-animation and draw=text is used for animation. |
* Fix QRawFont to be thread-local * Add public iconic.rawfont() same as iconic.font() * Use setCompositionMode instead of setAlphaChannel which is not supported on PyQt 5.9 * Add glyphrun to draw option * Add draw option in global_defaults * Add Fallback to text drawing if path/glyphrun/image drawing cannot be used * Refectoring CharIconPainter._paint_icon()
Looking to spin, I still think draw=path would be better when animation. |
Thanks for the quick update @kumattau ! Doing some testing on Windows: Default options (no args) -
|
Besides the suggestion above I think the only missing element is updating the And again, thanks @kumattau for taking the time to update this! |
Co-authored-by: Daniel Althviz Moré <[email protected]>
How about draw=glyphrun on windows ? On linux, The quality of draw=glyphrun seems to be same as draw=text.
|
Checking Looking more in detail the different draw options I would say that Thanks again @kumattau for the work here and checking all the draw options! I think this is ready to be merged then, right? Or maybe do you want to check something else on Windows? If is ready to be merged just mark the PR as |
My work has been finished. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the work done here @kumattau !
Maybe #39 can be fixed using QRawFont and draw PainterPath of Glyph.
Compared to QFont, QRawFont is available without registering to font database,
So this approach has
Pros:
Cons:
If qtawesome switches QFont to QRawFont, font patch in the update_font script ( #194 ) may not be needed.
How do you think, @dalthviz ?
Note: current code is example, so it needs refactoring, optimization, etc.
Edit:
Fixes #39