Ubuntu - JUCE Not Reading OTF Fonts


It seems that JUCE is not reading any OTF font I install (or copy) in Ubuntu, regardless of the default font folder I put such in. (Followed this… and yes I made sure to rebuild the font information with sudo fc-cache -f -v) The Juce Demo straight up doesn’t list them.

Am I missing a flag or library of some kind to get this happening?

Example font: Source Code Pro


Here is an example of Source Code Pro being read in Ubuntu - by NetBeans’ Font Chooser:


The class to look at would be LinuxFontFileIterator… It was written a long time ago, so maybe things have moved on and it needs to be updated to look for its fonts in a different location?


I placed my OTF fonts in /usr/local/share/fonts/opentype, yet the TrueType fonts are listed in /usr/local/share/fonts/truetype.

Here are the font directories given to me by that iterator:


Not sure then… Presumably truetype can actually open OTF fonts? (I don’t really know anything about OTF)


Info can be found here in regards to using FreeType and OTF fonts.

I think I found the solution to this, now… Sadly looked over the LinuxFontFileIterator::next method; you have to add OTF as an extension to check for. :slight_smile:

 bool next()
    if (iter != nullptr)
        while (iter->next())
            if (getFile().hasFileExtension ("ttf;pfb;pcf;otf")) //Added 'otf' here
                return true;

    if (index >= fontDirs.size())
        return false;

    iter = new DirectoryIterator (File::getCurrentWorkingDirectory()
                                     .getChildFile (fontDirs [index++]), true);
    return next();


doh! Thanks! At least it’s an easy fix!


Thankfully, yes! I’m surprised nobody else has encountered this… I guess there are few JUCE + Linux apps out there? Oh well