/ src / modules / cmdpal / Microsoft.Terminal.UI / FontIconGlyphClassifier.idl
FontIconGlyphClassifier.idl
 1  // Copyright (c) Microsoft Corporation.
 2  // Licensed under the MIT license.
 3  
 4  namespace Microsoft.Terminal.UI
 5  {
 6      /// <summary>
 7      /// Categorizes the type of a single grapheme cluster or input text.
 8      /// Used to determine how the input should be handled or rendered (for example,
 9      /// whether it should be treated as an emoji, an icon from a symbol font, plain text, etc.).
10      /// </summary>
11      enum FontIconGlyphKind
12      {
13          /// <summary>
14          /// Input is invalid or contains more than one grapheme cluster and therefore cannot be
15          /// treated as a single symbol. Typical for multi-character text like file paths
16          /// or composed strings that include separators.
17          /// </summary>
18          Invalid = -1,
19  
20          /// <summary>
21          /// No grapheme present (empty string). Indicates absence of a symbol.
22          /// </summary>
23          None = 0,
24  
25          /// <summary>
26          /// A single emoji grapheme cluster. This may consist of multiple Unicode code
27          /// points combined into one visible glyph (e.g., emoji with modifiers or ZWJ sequences).
28          /// </summary>
29          Emoji = 1,
30  
31          /// <summary>
32          /// A single glyph from the Segoe Fluent Icons / MDL2 Assets Private Use Area (PUA),
33          /// typically in the Unicode range U+E700–U+F8FF. These are font-based icons (Fluent/MDL2).
34          /// </summary>
35          FluentSymbol = 2,
36  
37          /// <summary>
38          /// A single non-emoji grapheme that is not a Fluent/MDL2 PUA symbol.
39          /// Covers ordinary characters, letters, numbers, or other single glyph symbols.
40          /// </summary>
41          Other = 3,
42      };
43  
44      /// <summary>
45      /// Static utility class for text and icon analysis
46      /// </summary>
47      static runtimeclass FontIconGlyphClassifier
48      {
49          /// <summary>
50          /// Determines if text represents a single grapheme cluster (emoji/symbol icon).
51          /// Uses ICU for Unicode boundary detection to distinguish icons from file paths.
52          /// </summary>
53          /// <param name="text">Text to analyze</param>
54          /// <returns>True if single grapheme cluster, false for multi-character text or paths</returns>
55          static Boolean IsLikelyToBeEmojiOrSymbolIcon(String text);
56  
57          /// <summary>
58          /// Classifies the input into a glyph kind suitable for icon or text rendering.
59          /// </summary>
60          static FontIconGlyphKind Classify(String text);
61      };
62  }