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

In This Topic
    SetDefaultFont(String,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,
       string styleName
    )
    Public Overloads Sub SetDefaultFont( _
       ByVal familyName As String, _
       ByVal styleName As String _
    ) 

    Parameters

    familyName
    The font family to set as the default
    styleName
    The default style to use in the font family
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    font not found
    Remarks
    If the input font family name does not exist an System.ArgumentException will be thrown. If the provided style is not found in the input font family the style will default to default font style for the given font family.
    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, Windows 8.1

    See Also