|
|
|
@@ -1280,15 +1280,25 @@ Typeface::Ptr Font::getDefaultTypefaceForFont (const Font& font) |
|
|
|
}
|
|
|
|
|
|
|
|
#if JUCE_CORETEXT_AVAILABLE
|
|
|
|
static bool containsNoMemoryTypefaces (const AttributedString& text)
|
|
|
|
static bool canAllTypefacesBeUsedInLayout (const AttributedString& text)
|
|
|
|
{
|
|
|
|
const int numCharacterAttributes = text.getNumAttributes();
|
|
|
|
|
|
|
|
for (int i = 0; i < numCharacterAttributes; ++i)
|
|
|
|
{
|
|
|
|
if (const Font* const f = text.getAttribute (i)->getFont())
|
|
|
|
{
|
|
|
|
if (OSXTypeface* tf = dynamic_cast<OSXTypeface*> (f->getTypeface()))
|
|
|
|
{
|
|
|
|
if (tf->isMemoryFont)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else if (dynamic_cast<CustomTypeface*> (f->getTypeface()) != nullptr)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
@@ -1299,7 +1309,7 @@ bool TextLayout::createNativeLayout (const AttributedString& text) |
|
|
|
#if JUCE_CORETEXT_AVAILABLE
|
|
|
|
// Seems to be an unfathomable bug in CoreText which prevents the layout working with
|
|
|
|
// typefaces that were loaded from memory, so have to fallback if we hit any of those..
|
|
|
|
if (containsNoMemoryTypefaces (text))
|
|
|
|
if (canAllTypefacesBeUsedInLayout (text))
|
|
|
|
{
|
|
|
|
CoreTextTypeLayout::createLayout (*this, text);
|
|
|
|
return true;
|
|
|
|
|