I’ve seen some discussion about fonts, and how they may legally be re-distributed in a VCV module. But all the issues are not entirely clear to me.
We seem to have an expert here in the form of @dreamer , but I don’t think @dreamer has every told us what a good or best practice would be.
I’m not being facetious when I say I would be interested to learn more about this. So is anyone willing to explain this topic?
I’m not an expert at all haha. Just seem to be more aware with all the distributable issues than most, apparently.
The issue is not just with fonts of course, but with any file you take from a different source and include into your project. Be it fonts, graphics, code. Without proper licensing (and “public domain” also counts here!) it just makes everything much more difficult in the long run.
In the case of fonts the best/easiest is to use fonts with the Open Font License, as it gives full freedom to modify and distribute the font files → SIL Open Font License - Wikipedia
Other licenses that are used by some fonts:
- Bitstream-Vera (the OG before OFL was formalized)
- CC0-1.0 (essentially “public domain”)
- Apache-2.0 (well known opensource license)
- Ubuntu Font License (based on OFL)
- custom licenses that still allow free usage and distribution
If you can’t find any license for the font you want to include be wary that you likely do not have any rights to use or distribute it.
I have a license to use Proxima Nova, but not to distribute it. So I convert my text to paths when building the SVGs. If I needed the fonts at runtime, I think I’d have to either switch fonts (which I tried once, and failed to find anything I like) or renegotiate the license.
distributed fonts are required if you have a display panel on your module, like an LED or LCD display. not needed for the usual lables on panels
All of my module panel labels are done at runtime via distributed fonts.
most of my panels render the fonts into the SVG, but there are a few places where I need to draw dynamic text, so I use fonts for that. And of course for music notation.
Yep, there are a number of varieties of panel graphics, some of which absolutely require distributed fonts, so this topic.
Personally, I would like to see a small collection of open source/license fonts included in the VCV Rack SDK, so that each developer who needs fonts doesn’t have to reinvent the wheel of discovery.
Well, there are SOME in there. The default ui font is not terrible.
Is that the DejaVuSans.ttf and ShareTechMono-Regular.ttf fonts? I’m looking in the V1 SDK since I have not downloaded the V2 SDK source. That may be part of my problem, that I didn’t realize there were some UI fonts in the SDK.
I’ve never loaded them directly, but I think DevjaVu is what you get in you context, unless you change it.
Well, I learned something! I have been distributing DejaVuSansMono.ttf and license with my plugin And, I actually load that font in one draw() function. I confirmed that I do not need to load that font since as you said, it is the default context font. I also do not need to load the Ubuntu font nor distribute it, but if I use the context default font, I would need to tweak font sizes.
So, I will leave it as is for the time being, but it is good to know.
Do you know where it is documented that DejaVuSansMono.ttf is the Rack default context font and so does not need to be distributed or loaded?
Edit: Well, DejaVuSans.ttf is probably the default context font.
They are in the main program folder.
Ah, I see those 9 fonts now. I probably should have known these are available at runtime by default within Rack. But, where would I have learned that?
Thank you for teaching me this.
Very good idea, this would make some such choices a bit more standardized (with “sane defaults”) and somewhat reduce the amount of duplicate files in the library.
Once you start digging into modules you see several of the same fonts come back over and over.
I kind of doubt that redundant loading of fonts is a significant performance issue… But for sure the ones in VCV or OK. I’ll stick with my Robato, thought, thanks. Well, If I still made modules…
I have sort of a dumb question, but what is the best practice for using the 9 included fonts in plugins? Should we duplicate each needed font into our plugin /res folder? Or, should we load the font via a path to the Rack.exe /res/fonts folder? If the latter, what is the proper path syntax?
Something like this:
font = APP->window->loadFont(asset::system(“res/fonts/ShareTechMono-Regular.ttf”));
In Rack itself, these fonts are called the following way:
std::string fontPath = asset::system("res/fonts/Nunito-Bold.ttf");
fontPath = asset::system("res/fonts/ShareTechMono-Regular.ttf");