process(text) {
    if (!isValidLabel(text)) {
      return this.lines.finalize();
    }

    const font = this.parent.fontOptions;

    // Normalize the end-of-line's to a single representation - order important
    text = text.replace(/\r\n/g, "\n"); // Dos EOL's
    text = text.replace(/\r/g, "\n"); // Mac EOL's

    // Note that at this point, there can be no \r's in the text.
    // This is used later on splitStringIntoLines() to split multifont texts.

    const nlLines = String(text).split("\n");
    const lineCount = nlLines.length;

    if (font.multi) {
      // Multi-font case: styling tags active
      for (let i = 0; i < lineCount; i++) {
        const blocks = this.splitBlocks(nlLines[i], font.multi);
        // Post: Sequences of tabs and spaces are reduced to single space

        if (blocks === undefined) continue;

        if (blocks.length === 0) {
          this.lines.newLine("");
          continue;
        }

        if (font.maxWdt > 0) {
          // widthConstraint.maximum defined
          //console.log('Running widthConstraint multi, max: ' + this.fontOptions.maxWdt);
          for (let j = 0; j < blocks.length; j++) {
            const mod = blocks[j].mod;
            const text = blocks[j].text;
            this.splitStringIntoLines(text, mod, true);
          }
        } else {
          // widthConstraint.maximum NOT defined
          for (let j = 0; j < blocks.length; j++) {
            const mod = blocks[j].mod;
            const text = blocks[j].text;
            this.lines.append(text, mod);
          }
        }

        this.lines.newLine();
      }
    } else {
      // Single-font case
      if (font.maxWdt > 0) {
        // widthConstraint.maximum defined
        // console.log('Running widthConstraint normal, max: ' + this.fontOptions.maxWdt);
        for (let i = 0; i < lineCount; i++) {
          this.splitStringIntoLines(nlLines[i]);
        }
      } else {
        // widthConstraint.maximum NOT defined
        for (let i = 0; i < lineCount; i++) {
          this.lines.newLine(nlLines[i]);
        }
      }
    }

    return this.lines.finalize();
  }
Split passed text of a label into lines and blocks.

# NOTE

The handling of spacing is option dependent:

- if `font.multi : false`, all spaces are retained
- if `font.multi : true`, every sequence of spaces is compressed to a single space

This might not be the best way to do it, but this is as it has been working till now.
In order not to break existing functionality, for the time being this behaviour will
be retained in any code changes.
@param {string} text  text to split
@returns {Array<line>}