-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add Support for INAV OSD Fonts #27
base: master
Are you sure you want to change the base?
Conversation
* Fix an issue that caused certain fonts to not work with the tool * Add some default fonts to resources/osd for Betaflight, ArduPilot and INAV * Add a tool for converting INAV font character directories into font files
@avsaase I forgot to add you as a reviewer and I can't seem to do it now. So I'll make a ping here instead. |
You can find bunch of OSD fonts at https://sites.google.com/view/sneaky-fpv/home |
That's helpful. I hadn't come across that before. However I'm seeing some differences in the png's from that site versus from my tool. Maybe this is because I'm using a newer version of INAV, but I'm not sure. Here is a video demonstrating the differences. Either way, I think it's probably a good idea to have an open source tool for converting any INAV font directory to a png for use in this tool. I also think it would be great to include some of the fonts for BF, Ardu and INAV in this project itself, as it saves users from having to find them theirselves. Or at least link to a site such as SNEAKY_FPV's or the official walksnail fonts. Here is a video that shows the differences in the font pngs. I simply took my inav_36 png that I made with my tool using the images in the INAV 36x54 directory as well as one of the INAV 36 pngs from the SNEAKY_FPV link you provided above and compared them side by side in photoshop. You should notice that at the top for the more commonly used icons, they appear the same. But as you get further down, there are some differences that would cause errors in OSD output in use for this tool. The dimensions of the SNEAKY_FPV images also seem a bit strange. There is a bunch of extra space at the bottom that is not being utilized. I'm not sure the reason for this. I could take my font file that I made and add some extra spaces as well, to make the Inav.differences.mp4 |
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.
Hi, thanks for taking the time for making a PR and apologies for taking this long to review.
You're right that there was a bug in verify_dimensions
which I just fixed in 9338c21. I guess it was just luck that this bug didn't show with the most common font files floating around the internet.
As for the other changes you suggested, I agree that it would be much better if there where some font files included with the tool. But I would like to make the font file selectable from the tool itself instead of making users download it from the repository. I would like to keep this tool as accessible for non-technical people as possible. The downside of doing this is keeping it up to date with changes made in the flight controller firmware (the same applies to checking them in the repository). We would also need permission from the font file authors to include their work.
Similarly, I think a file conversion tool would be useful but I would like to include it in the main program instead of adding a separate script.
Reason for this work
I found this tool earlier this week and it's been very useful! Unfourtunatley, since I primarily use INAV, I ran into a few problems. I will outline these issues below.
Where are all the osd files?
I'm not sure if I'm missing something but I coudn't seem to find any OSD files in this project itself. I did however find some located here, which is also how I found this project. It wasn't until some more research and time later that I realized these files originated from the Walksnail downoads page under
FC osd fonts update
. Because of this, I decided to add these files into the resources folder of this project directly and add a note about this in theREADME.md
. I think this will help new users of this tool save some time. (If this is not a desireable location, I'd be happy to move it elsewhere).I can't find an INAV OSD file for the life of me!
I scraped around the internet, but I couldn't seem to find any INAV OSD file in the format that this project uses. Inside of the INAV repo, in the OSD directory, I found that their OSD characters are separated into individual files. This is why I wrote the
Inav OSD tool.py
helper tool. The tool converts these INAV image directories into a Walksnail OSD Tool readable OSD file(png).Why won't the generated OSD file work in the Walksnail OSD Tool! 😭
When trying to open my newly geneated INAV OSD file into the Walksnail OSD Tool, it would not show up and I was unable to render.
At this point I had sunk enough time into this work to fully commit to gettting this working! After figuring out how to build and run the Walksnail OSD Tool project, I was able to find the issue. Inside of
font_file.rs
there was what I assume to be an error in theverify_dimensions
method.I'm assuming that the idea behind this method is to prevent files with bad dimensions that don't make sense from being used, since this could result in a bad array (vec) lookup later on.
However, the check for if the OSD file height is divisible by the files width doesn't make a lot of sense. This just happens to work with the Betaflight and ArduPilot fonts, however if just 1 more charactere was added to the end of those, it would fail too.
To fix this issue, I modified the condition so that it checks that the OSD image height is divisible by the
CharacterSize
height. This way we verify that the dimensions are not bad and there won't be a bad array lookup later on. This fixed the issue I was having and I could finally start rendering my INAV flight footage! 🎉 I also added my newly generated INAV OSD file into the osd directory that I made and mentioned above.Please let me know if you have any feedback / questions about these changes. I'm happy to work to get these improvements into master.