In particularly unfortunate cases, the fonts used for laying out and
drawing an AttributedString could end up differing, meaning that
incorrect glyph indices would be used during rendering. The rendered
text would end up using incorrect character symbols, making it
unreadable.
The problem seems to be:
- The AttributedString fetched a typeface during the getOrCreateFont
call in createCFAttributedString.
- Details of the typeface (its style and name) were stored into the
CFAttributedString.
- During `createLayout`, a new `Font` object was created using the
stored typeface name and style.
- When calling `getTypeface` on this new font, during rendering,
a different typeface was returned.
The fix implemented here stores the Font objects used during the
creating of the CFAttributedString, so that the fonts written to
the juce::AttributedString are guaranteed to match the fonts used
to compute the layout.