-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
font-patcher: Cover alternate unicode encodings #1058
Conversation
Thanks for reporting and of course for the nice PR! I will have a closer look at the weekend. |
I wonder if the But then, that would probably be more work because we need to check more often. And the altuni bindings will not go away or something, so yes, probably this is best. |
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.
This looks good, thank you.
Feel free to add some more comment in the code and/or use list comprehension if you like 😬
Tell me if I shall merge or if you want to add something before.
Again your commit style and the thought you put into this 👍 💚
Ah I forgot, would be good to increase the script version. |
Done! Let me know if you have any more recommendations, or whether I introduced bugs etc |
Did you test it with Looks very good ❤️ |
I did, and the glyph that was previously broken seems to have been fixed! But if you do have the font in hand you might want to test it just to make sure I didn't mess anything up. If you do decide to merge, you'd want to change the version number as it's now outdated -- that's where the branch conflict is from |
[why] Issue #400 recently reoccurred with the latest build of Input font, and it turns out the dotless-j part of the small `j` now points to U+0237, which in turn has an alternate unicode encoding to U+F6BE; overwriting U+F6BE effectively overwrites U+0237, and in turn, alters the small `j`. This patch aims to fix that. [how] In addition to references, the patcher also checks for alternate unicode encodings which are returned by the glyph.altuni attribute, adds those to the essential set of glyphs, and in turn recursively searches for their references/alternate unicode encodings, making sure to handle circular references (for example: U+2010 and U+2011 in Input Mono)
[why] Using `continue` feels inelegant when there's a way to write the if conditions in add_glyphrefs_to_essential() without necessitating the use of `continue` while ensuring that the function still works as intended. [how] Change the `if` conditions and remove any usage of the `continue` keyword in add_glyphrefs_to_essential().
[why] List comprehension helps with readability. Also add comments that describe expected data structures of altuni and references. Also bump up the patcher version number. [how] Use list comprehension. Add comments. Change the version number.
Rebase on master, force push |
Tried to switch this to some kind of tail-recursion, but the code will end up very ugly. Also noticed that Very nice code and PR, thanks again. |
Sweet! I basically rely on Nerd Fonts for my day-to-day computer usage, so a little code is the least I can give back. Should I invoke the contributors bot as described here? |
*lauch* yes please, I just searched for that syntax also, to add you :-) |
Hey @all-contributors please add @nathanielevan for code |
I've put up a pull request to add @nathanielevan! 🎉 |
To be honest .. I really struggle to take Python seriously, and Nerd Fonts is the only project where I actually use it. 🤔 No, |
Thinking... Hope my release workflow will not break, because we added your contributor commit. |
font-patcher: Cover alternate unicode encodings
Description
[why]
As described in this comment, issue #400 recently reoccurred with the latest build of Input font, and it turns out the dotless-j part of the small
j
now points toU+0237
, which in turn has an alternate unicode encoding toU+F6BE
; overwritingU+F6BE
effectively overwritesU+0237
, and in turn, alters the smallj
. This patch aims to fix that.[how]
In addition to references, the patcher also checks for alternate unicode encodings which are returned by the
glyph.altuni
attribute, adds those to the essential set of glyphs, and in turn recursively searches for their references/alternate unicode encodings, making sure to handle circular references if they appear (for example:U+2010
andU+2011
in Input Mono).Fixes: #400
Requirements / Checklist
What does this Pull Request (PR) do?
Make
font-patcher
also check for alternate unicode encodings in addition to references so they won't be overwritten.How should this be manually tested?
Input Mono so far is the only font I've had this issue with, and this patch successfully prevents
font-patcher
from overwriting or altering those essential glyphs, but should work with most if not all fonts.What are the relevant tickets (if any)?
#400