Fix infinite loop in TextRenderer