ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Core Namespace / TextAndGraphicsElementsOptions Class / GetAvailableFonts Method
Example

In This Topic
    GetAvailableFonts Method (TextAndGraphicsElementsOptions)
    In This Topic
    Gets the list of available fonts in the application for the Pro session. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax

    Return Value

    A list of tuples where tuple.fontName is the font family name and tuple.fontStyles is a list of available styles for the given font family
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Get All Available Fonts
    //Note: see also SymbolFactory.Instance.GetAvailableFonts() which returns the
    //same list. Use for TextAndGraphicsElementsOptions.GetAvailableFonts() convenience
    
    QueuedTask.Run(() =>
    {
      //A list of tuples of Font name + associated Font Styles, one tuple per
      //font, is returned
      var fonts = ApplicationOptions.TextAndGraphicsElementsOptions.GetAvailableFonts();
      StringBuilder sb = new StringBuilder();
      sb.AppendLine("Pro Fonts\r\n============================");
      foreach (var font in fonts)
      {
        var styles = string.Join(",", font.fontStyles);
        sb.AppendLine($"{font.fontName}, [{styles}]");
      }
      System.Diagnostics.Debug.WriteLine(sb.ToString());
    });
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also