Typeface::Ptr getTypefaceForFont(const Font &f); LookAndFeel::setDefaultLookAndFeel(&customLookAndFeel);
EG:
voidinitialise(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 (newMainWindow (getApplicationName())); }
然后在Main文件中的私有类加入
classCustomFontLookAndFeel : public LookAndFeel_V4 { public: CustomFontLookAndFeel() { LookAndFeel::setDefaultLookAndFeel(this); }
staticconst Font getCustomFont(){ staticauto typeface = Typeface::createSystemTypefaceFor(BinaryData::SiHei_otf, BinaryData::SiHei_otfSize); returnFont(typeface); } Typeface::Ptr getTypefaceForFont(const Font &f)override{ returngetCustomFont().getTypeface(); } private: } customLookAndFeel;