Maybe it's just me, but after spending a day searching this forum and reading everything here couldn't find exact answers for these question, so thought to ask here, maybe somebody can clarify them:
I would like to use my own embedded TTF in my plugin so I made the next few steps:
MyLookAndFeel::MyLookAndFeel() : m_fontRegular(Typeface::createSystemTypefaceFor(BinaryData::FontRegular_ttf, BinaryData::FontRegular_ttfSize)), m_fontRegularItalic(Typeface::createSystemTypefaceFor(BinaryData::FontRegularIt_ttf, BinaryData::FontRegularIt_ttfSize)), m_fontBold(Typeface::createSystemTypefaceFor(BinaryData::FontBold_ttf, BinaryData::FontBold_ttfSize)), m_fontBoldItalic(Typeface::createSystemTypefaceFor(BinaryData::FontBoldIt_ttf, BinaryData::FontBoldIt_ttfSize)) {} Typeface::Ptr MyLookAndFeel::getTypefaceForFont(const juce::Font & font) { if (font.getTypefaceName() == "My Font Name") { if (font.isBold() && font.isItalic()) return m_fontBoldItalic; if (font.isBold()) return m_fontBold; if (font.isItalic()) return m_fontRegularItalic; return m_fontRegular; } return LookAndFeel::getTypefaceForFont(font); }
And I add the LookAndFeel object to my editor this way:
MyplayerAudioProcessorEditor::MyplayerAudioProcessorEditor (MyplayerAudioProcessor& p) { setLookAndFeel(&m_lookAndFeel); Desktop::getInstance().setDefaultLookAndFeel(&m_lookAndFeel); ... }
Now the questions:
1, if I don't use this line: "Desktop::getInstance().setDefaultLookAndFeel(&m_lookAndFeel);", my "getTypefaceForFont()" never will be called. Why?
2, If I want this to work, then I should add that line and replace "My Font Name" with "<Sans-Serif>" in my "getTypeFaceForFont()" function. It seems a bit hacky, but would be interested why this works and if this is the way it should work? I found this solution in this thread and it is working now: http://www.juce.com/forum/topic/embedded-fonts-os-x-truetype
3, In my own Components if I call this method: "g.getCurrentFont().findAllTypefaceNames()" my typefaces aren't listed. Is it normal as this function only lists the system fonts and doesn't list the plugin's own registered fonts?
Thanks in advance,
Kevin