Font import issue?

#1

Hi,

I’m trying to add a custom font to my project, and whilst searching online through other threads, I came across the ability to add the font into Projucer, then use the following:

Font getLabelFont(Label &) override
{
    return Font(Typeface::createSystemTypefaceFor(BinaryData::robotoblack_ttf, BinaryData::robotoblack_ttfSize));
}

This method is is constructed in my custom slider class.

However, it displays an error saying: Use of undeclared ‘BinaryData’.

Is the the current / correct way of using a custom font? Or have I missed a step

Thanks in advance :slight_smile:

0 Likes

#2

Have you included the header that declares robotoblack_ttf and robotoblack_ttfSize in namespace BinaryData?

0 Likes

#3

How did you add the font to your project, using the Projucer?

0 Likes

#4

Excuse me if I did this incorrectly, but I added it using the following method:

Added a new GUI Component inside Projucer, then added new resource, and chose the font file. I couldn’t find a tutorial importing specific files like fonts.

0 Likes