> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ninjatrader.com/_mcp/server.

# SimpleFont

## Definition

Defines a particular font configuration.

Note: SimpleFont objects are used for various **Drawing** methods, and can be used when defining UI element for Add-ons.

## Constructors

| Constructor                                 | Description                                                                   |
| ------------------------------------------- | ----------------------------------------------------------------------------- |
| **SimpleFont()**                            | Creates a SimpleFont object using a family name of "Arial" and a size of "12" |
| **SimpleFont(string familyName, int size)** | Creates a SimpleFont object using the specified family name and size          |

## Methods and Properties

| Property                                                                                                     | Description                                                                                                                                                                                                                                                                        |
| ------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Bold**                                                                                                     | A bool value determining if the Font is bold style                                                                                                                                                                                                                                 |
| **Family**                                                                                                   | A **FontFamily** representing a family of Fonts                                                                                                                                                                                                                                    |
| **Italic**                                                                                                   | A bool value determining if the Font is italic style                                                                                                                                                                                                                               |
| **Size**                                                                                                     | A **double** value determining the size of font in WPF units (please see the tip below)                                                                                                                                                                                            |
| **Typeface**                                                                                                 | A **Typeface** used to represent the variation of the font used                                                                                                                                                                                                                    |
| **[ApplyTo()](/developer/desktop-sdk/references/common/simplefont/applyto)**                                 | Applies a custom [SimpleFont](/developer/desktop-sdk/references/common/simplefont) object's properties (family, size, and style) to a [Windows Control](https://learn.microsoft.com/en-us/dotnet/api/system.windows.controls.control?view=windowsdesktop-9.0\&redirectedfrom=MSDN) |
| **[ToDirectWriteTextFormat()](/developer/desktop-sdk/references/common/simplefont/todirectwritetextformat)** | Converts a SimpleFont object to a SharpDX compatible font which can be used for chart rendering.                                                                                                                                                                                   |

The WPF unit used is the default px one, so device independent pixels. With a default system DPI setting of 96, the physical pixel on the screen would be identical in size, but can vary if a custom DPI is employed. Both should not be confused with the points based font sizing known from other familiar Windows applications like Word, the advantage here is that the non points based size measurement will increase / decrease in size if the system DPI is changed - a more detailed discussion is located [here](https://blogs.msdn.microsoft.com/text/2009/12/11/wpf-text-measurement-units/).

## Examples

```csharp
// create custom Courier New, make it big and bold
NinjaTrader.Gui.Tools.SimpleFont myFont = new NinjaTrader.Gui.Tools.SimpleFont("Courier New", 12) { Size = 50, Bold = true };

Draw.Text(this, "myTag", false, "Hi There!", 0, Low[0], 5, Brushes.Blue, myFont, TextAlignment.Center, Brushes.Black, null, 1);
```