-
-
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
High chance of font family conflicts with bundled fonts #188
Comments
Hi @kumattau thanks for the feedback! Makes sense to me to somehow differentiate by some sort of prefix the font names that are being bundled here to help reduce the possibility of collisions when adding custom fonts 👍 Just in case, what do you think @ccordoba12 ? |
Yeah, I think that's a good idea. However, I don't know if simply renaming the fonts could do that, or if there's something that's necessary. |
Thanks @ccordoba12,
I think changing family is enough to resolve the collision. https://doc.qt.io/qt-5/qfont.html says the font is matched as follows:
I think, by above acondition 1, changing family of the qtawesome's font, user's choice does not match qtawesome's font and qtawesome's choice does not match user's font, so the collision does not occur. Also, changing family was used to resolve the following qtawesome internal collision and seems to be working fine.
|
Ok, great! Could you give us a hand with that? |
Yes, I will try it soon. |
It is better that updating font and changing family can be processed with update script, not manually. For example, 5.x and 6.x material design icons are bundled in fonts. To realize updating font and changing family, I think it it better to change the directory structures as follows.
"qta+9a2f45@" is prefix to avoid the collision. Additionally, the all charset is seems to be destributed in the form of css file, so I think it is better to can parse css file directly. https://pypi.org/project/cssutils may be useful for the purpose. Above changes aren't affect public API but it is much big. |
Thanks @kumattau for checking! I would say that adding the prefix when using the updating script automatically would be nice. Just in case you think the current folder structure makes it difficult because you will need to use a different font file name? I think that is done by the update script for material design 6.x when downloading the font file ( Anyhow not totally sure of the need of changing the folder structure, but if you think that will make the font updates easier I guess is ok. Just in case, what do you think @ccordoba12 ? Regarding the CSS file parsing not sure if needed with an external dependency (my guess is that the way is currently working is to avoid using an external dependency). Is that causing also conflicts somehow? If not maybe that is something to review in another issue. Thanks again for sharing what you were thinking for the implementation! |
I think it's fine as long as updating to new font versions remains easy. |
Thank you @dalthviz , @ccordoba12.
Yes, material design icon has same filename between 5.x and 6.x. so I need to rename them to avoid filename collision.
Yes. if update script knows that materialdesignicons-webfont.ttf should be saved as materialdesignicons6-webfont.ttf, the collision is avoided. Here's a way I came up with to avoid file name collisions.
Of these, I thought the sub-directory method was easier to understand because the original file name can be kept and there is no need to define it in the script.
Currently, regular expression is used for the conversion from css to json. I'll look into how to implement it more. |
I've tried prototyping it, but the process of updating each font (downloading, adding prefix to family, updating checksum, etc.) is duplicated, so I think I should also refactor setupbase.py. It may take some time, but I will send a PR when I have a draft. |
Can I use dictionary ordering support or dataclass which requires python 3.7 or later to implement font updater simply? |
I think it should be fine 👍 I think we should drop support for Python 3.6 in the future (probably before merging the improvements you are working on). Thanks for asking @kumattau ! |
Hi,
For some fonts that qtawesome has, family remains the default.
This may break the user application or qtawesome if the user adds a different version of the font.
For example, in the following code, if the different version of "Material Design Icon" by
QtGui.QFontDatabase.addApplicationFont("materialdesignicons-webfont.ttf")
is added, qtawesome icon disappers.QtGui.QFontDatabase.addApplicationFont
affects application-wide, so qtawesome's internal "Materinal Design Icon" seems to be overwritten by user's one.I think it's a good idea to add a unique string (e.g "(qtawesome)") to all families of qtawesome's internal icons to avoid the confliction.
QtGui.QFontDatabase.addApplicationFont("materialdesignicons-webfont.ttf")
is not executedQtGui.QFontDatabase.addApplicationFont("materialdesignicons-webfont.ttf")
is executedThe text was updated successfully, but these errors were encountered: