| | 1 | | using TMPro; |
| | 2 | |
|
| | 3 | | public static class TMP_TextExtensions |
| | 4 | | { |
| | 5 | | public static string ReplaceUnsupportedCharacters(this TMP_Text text, string bodyText, char replacementChar) |
| | 6 | | { |
| 55 | 7 | | bool isBodyFormatSupported = text.font.HasCharacters(bodyText, out uint[] missing, searchFallbacks: true, tryAdd |
| | 8 | |
|
| 55 | 9 | | if (!isBodyFormatSupported) |
| | 10 | | { |
| 0 | 11 | | if (missing != null && missing.Length > 0) |
| | 12 | | { |
| 0 | 13 | | for (int i = 0; i < missing.Length; i++) |
| | 14 | | { |
| 0 | 15 | | bodyText = bodyText.Replace(((char)missing[i]), replacementChar); |
| | 16 | | } |
| | 17 | | } |
| | 18 | | } |
| | 19 | |
|
| 55 | 20 | | return bodyText; |
| | 21 | | } |
| | 22 | | } |