Embedding Custom Fonts OTF, TTF

I want to embed a custom font into my JUCE project.
I added the OTF file as a resource and i’m using Typeface::createSystemTypefaceFor() to load the font.
so far everything is working fine on macOS. but when trying to run this on windows i don’t get the right font!
but changing the Font from OTF to TTF on windows solved the problem. is it not possible to use OTFs on windows? or am i doing something wrong? whats the best font format the works on windows and macOS?


Yes, we had similar issues:

Using TTF solved it in our case too.

Yeah, we’ve heard about this from various sources. Seems that there’s some quirk in the Windows font engine that stops OTFs working when loaded from memory. Don’t know of any workaround other than changing the file type, I’m afraid!

I’ve been trying to add custom fonts for the past day and whatever I do, nothing seems to work.

I’ve added both .otf and (converted) .ttf files. Added these methods to my custom LookAndFeel class:

		defaultOutlineCol = Colours::darkgrey;
		defaultFillCol = Colours::black;
		setColour(ToggleButton::tickColourId, darkThumb);

		static Typeface::Ptr customTypeface = Typeface::createSystemTypefaceFor(BinaryData::NowBlack_ttf, BinaryData::NowBlack_ttfSize);

    Typeface::Ptr getTypefaceForFont(const Font& f) override
		static Typeface::Ptr myFont = Typeface::createSystemTypefaceFor(BinaryData::NowBlack_ttf,
		return myFont;

…but to no avail. Is there something I’m overlooking? Haven’t tested it on Mac, only on Windows.