Strategies for background-thread text rendering


Since the jassert in Font::getGlyphPositions() it isn’t possible to draw text on a image without locking the MessageManagerLock.

I can’t use the MML for several reasons, what are possible alternatives to draw text on a background thread?


just skip the call to Font::getGlyphPositions:

Array<int> pos;
Array<int> xOffsets;
Font f;
String text = "hello";
f.getTypeface()->getGlyphPositions (text, pos, xOffsets);
Path p;
f.getTypeface()->getOutlineForGlyphs(pos[0], p); //store the outline for 'h' in Path p;


Hi makatmusic,

thanks! Unfortunately there is no getOutlineForGlyphs function, only getOutlineForGlyph.
I tried to reconstruct functionality from the juce classes, to allow simple text-rendering, but it seems much more complicated then i thought.

…also it seems the functionally already exists, for example in the CustomFont rendering classes (Is there anyway to use them with build-In fonts?)

Any help appreciated…