Strategies for background-thread text rendering


#1

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?


#2

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;

#3

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…