toCalligraphic static method

String toCalligraphic(
  1. String text
)

Converts to Calligraphic - \mathcal Mapping range: A-Z (U+1D49C)

Implementation

static String toCalligraphic(String text) {
  return text.runes
      .map((runes) {
        if (runes >= 65 && runes <= 90) {
          // 'A' to 'Z'
          switch (runes) {
            case 66:
              return "ℬ"; // 'B'
            case 69:
              return "ℰ"; // 'E'
            case 70:
              return "ℱ"; // 'F'
            case 72:
              return "ℋ"; // 'H'
            case 73:
              return "ℐ"; // 'I'
            case 76:
              return "ℒ"; // 'L'
            case 77:
              return "ℳ"; // 'M'
            case 82:
              return "ℛ"; // 'R'
            default:
              return _codePointToString(0x1D49C + (runes - 65));
          }
        }
        return String.fromCharCode(runes);
      })
      .join("");
}