1.将字体文件放入项目内

2.在项目的initialise中加入

Typeface::Ptr getTypefaceForFont(const Font &f);
LookAndFeel::setDefaultLookAndFeel(&customLookAndFeel);

EG:

void initialise (const String& commandLine) override
{
    // This method is where you should put your application's initialisation code..
    Typeface::Ptr getTypefaceForFont(const Font &f);
    LookAndFeel::setDefaultLookAndFeel(&customLookAndFeel);
    mainWindow.reset (new MainWindow (getApplicationName()));
}

然后在Main文件中的私有类加入

class CustomFontLookAndFeel : public LookAndFeel_V4 {
    public:
    CustomFontLookAndFeel() {
        LookAndFeel::setDefaultLookAndFeel(this);
    }

    static const Font getCustomFont() {
        static auto typeface = Typeface::createSystemTypefaceFor(BinaryData::SiHei_otf, BinaryData::SiHei_otfSize);
        return Font(typeface);
    }
    Typeface::Ptr getTypefaceForFont(const Font &f) override {
        return getCustomFont().getTypeface();
    }
    private:
} customLookAndFeel;

其中SiHei_otf是字体文件文件名称