UTF8 oddities

static String fromUTF8 (const char* utf8buffer, int bufferSizeBytes = -1);

This function will assert on invalid UTF8 data if bufferSizeBytes >= 0 otherwise it will silently accept invalid UTF8. In either case, invalid UTF8 will be stored in the string.

void getGlyphPositions (const String& text, Array<int>& resultGlyphs, Array<float>& xOffsets) override will crash if it is provided an invalid utf8 string.

The return value of auto cfText = text.toCFString(); is not checked for nullptr.

Can you provide an example that crashes?

If CFStringCreateWithBytes will return nullptr then we instead return an empty String, so I suspect things are going wrong elsewhere.

Sorry, I forgot the project I was working on wasn’t using the latest juce. You’ve already fixed it.