Skip to content
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

generated new regular.rs file using the font version of v3.2.1 and bump self version to v0.1.4 #4

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

CtByte
Copy link

@CtByte CtByte commented Jun 12, 2024

@bernsteining I could not resist and I ended up updating the font using the latest version, since you included the python script.

The lines in the regular.rs file are ordered alphabetically and I also removed duplicates using Notepad++

I removed a few more issues I found when trying to build the project.

The following characters were not replaced when generating the symbol_name: (, ), ., /.
There were a few "icons" that had the same symbol_name, but different codes. I renamed them all.

@bernsteining
Copy link
Owner

Really good idea, thanks for pointing that out.

Shouldn't we add the:

  • alphabetical sort
  • duplicates removal
  • renaming

to the python script logic?

In order not to do it by hand each time nerdfonts gets updated.

Also, shouldn't we also update the fonts/nerdfonts_regular.ttf file, as it is used by src/variants/mod.rs ?

@CtByte
Copy link
Author

CtByte commented Jun 13, 2024

It would be great to automate these tasks for sure. I did not use python much before, but I am confident that it is possible.

The renaming could be difficult, as I manually checked the code on the cheet-sheet, but all that can be added to the script like a big "switch-case" and expand on it when new duplicates are found.

I missed the font, will fix that, thanks for pointing it out. I will also add the script as a file to the project.

I will do what I can as soon as I get the time.

@CtByte
Copy link
Author

CtByte commented Jun 14, 2024

I found a few more changes I would like to add soon to the script

@CtByte
Copy link
Author

CtByte commented Jun 14, 2024

@bernsteining I added the following to the script:

  • alphabetical sort
  • duplicates removal
  • renaming name duplicates
  • renaming most of the UNI* symbol names with a fitting name from the cheet-sheet

One thing I could not figure out is how to generate a UTF-8 file. It ends up being a UTF-16 encoded. I just use Notepad++ to convert to UTF-8.
If you know how, I can add that to the script, else I think that the rest is up to you now 😄

@CtByte
Copy link
Author

CtByte commented Jun 25, 2024

@bernsteining No hurry, just want to know if there is anything more you would like me to add and if you have any comments on my changes so far.

@bernsteining
Copy link
Owner

In my opinion the script.py is way too long with hardcoded logic on symbols.

I'd rather prefer a small logic that produces the same output, or a JSON file loaded by the python script. Because adding a new renaming implies adding a new if/else statement and I don't like it :/

Maybe we also can do it all on the rust side at build time of the crate.

Gotta find time to check that. :(

@CtByte
Copy link
Author

CtByte commented Jul 15, 2024

@bernsteining I agree with the hardcoded logic being large.

The names that are duplicated could be given an auto-generated name like ANGLE_RIGHT_F0939 instead of ANGLE_RIGHT_MD or something like that.

My real issue is with the ones that are named like UNI**, since getting the name had to be manual. I can only think of loading the CSS file perhaps and getting the name from there by matching it to the content. That is how I found a name.

elif symbol_name == "UNIE0A0" and code == r"\u{E0A0}": symbol_name = "BRANCH";

https://www.nerdfonts.com/cheat-sheet (search E0A0)

.nf-pl-branch::before {
  content: "\e0a0";
}

Something could be improved here, but I will wait for your answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants