How do I import a TrueType font?

I purchased a license to bundle an embedded TrueType font to use solely for my application’s usage to display its interface (Helvetica Neue fyi).

Using Juce, how do I import the outlines so that I can use the font? I can’t require that the user add the font to their Windows Fonts (or Macintosh, or Linux) since its a license only to allow embedded usage.

Do I need to use FreeType somehow?

Have a look at the CustomTypeface class.

Thanks for getting back to me. I saw the CustomTypeface class but it seems I have to manually add each glyph, producing my own juce_Path object for each glyph?

No. Look at addGlyphsFromOtherTypeface() and writeToStream().

Hmm…I think there is some confusion

I want to go from my Truetype Font —> to a juce_Typeface

All I have is the font as a binary true type font file. I use the juce binarybuilder to turn it into a byte array in my application and I would like to load that up into a juce_Typeface so I can use it to draw.

did you run across this post when searching the forum?

it’s a nice round-up of all the steps required to convert, embed and use a custom font in your app.

Oh! That is quite informative.

So they are saying, I should first install the font on my development system, export it using the provided command line application into a “Juce-formatted font file” and then embed that in my application so I can produce a juce_Typeface.

Where does the hinting come into play?

The hinting usually takes place when you render the typeface, not when saving it. And AFAIK, there’s no hinting in the JUCE font rendering.

How can I install a truetype font file into the Windows or Mac operating system at startup, so that Juce will recognize it during enumeration?

I tried AddFontResource on Windows but juce did recognize it.

There's nothing in juce that will help install a font file, you'd need to use OS-specific calls.

The way I normally work is to load custom fonts from memory using Typeface::createSystemTypefaceFor()