ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Core Namespace / TextAndGraphicsElementsOptions Class / SetDefaultFont Method / SetDefaultFont(String) Method
The font family to set as the default
Example

In This Topic
    SetDefaultFont(String) Method
    In This Topic
    Sets the application default font family name and style. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void SetDefaultFont( 
       string familyName
    )
    Public Overloads Sub SetDefaultFont( _
       ByVal familyName As String _
    ) 

    Parameters

    familyName
    The font family to set as the default
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    font not found
    Remarks
    The default font style for the given font family will be assigned. Use SetDefaultFont(String,String) to set a specific font style.
    If the input font family name does not exist an System.ArgumentException will be thrown
    Example
    Get/Set Default Font
    //Must use QueuedTask.Run(...)
    var def_font = SymbolFactory.Instance.DefaultFont;
    System.Diagnostics.Debug.WriteLine($"{def_font.fontName}, styles: {def_font.styleName}");
    
    //set default font - set through application options
    //Must use QueuedTask
    ApplicationOptions.TextAndGraphicsElementsOptions.SetDefaultFont("tahoma");
    ApplicationOptions.TextAndGraphicsElementsOptions.SetDefaultFont("tahoma","bold");
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also