---
id: "T:cAlgo.API.FontStyle"
kind: "enum"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Controls/Styles/FontStyle/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# FontStyle (enum)

Specifies style information applied to text.

Environments: Desktop supported · CLI supported · Cloud supported.

## Definition

```csharp
public enum FontStyle
```

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo
{
    // This sample shows how to use a chart control font properties to set font size, style, and family
    public partial class FontSample : Indicator
    {
        protected override void Initialize()
        {
            var stackPanel = new StackPanel
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                BackgroundColor = Color.Gold,
                Opacity = 0.6
            };

            stackPanel.AddChild(new TextBlock
            {
                Text = "Thin Weight Size 10 FontStyle Normal Font Default",
                FontSize = 10,
                FontWeight = FontWeight.Thin,
                FontStyle = FontStyle.Normal,
                ForegroundColor = Color.Black,
                Margin = 10
            });

            stackPanel.AddChild(new TextBlock
            {
                Text = "Thin Weight Size 10 FontStyle Italic Font Default",
                FontSize = 10,
                FontWeight = FontWeight.Thin,
                FontStyle = FontStyle.Italic,
                ForegroundColor = Color.Black,
                Margin = 10
            });

            stackPanel.AddChild(new TextBlock
            {
                Text = "Thin Weight Size 10 FontStyle Oblique Font Default",
                FontSize = 10,
                FontWeight = FontWeight.Thin,
                FontStyle = FontStyle.Oblique,
                ForegroundColor = Color.Black,
                Margin = 10
            });

            stackPanel.AddChild(new TextBlock
            {
                Text = "Black Weight Size 10 FontStyle Normal Font Default",
                FontSize = 10,
                FontWeight = FontWeight.Black,
                FontStyle = FontStyle.Normal,
                ForegroundColor = Color.Black,
                Margin = 10
            });

            stackPanel.AddChild(new TextBlock
            {
                Text = "Bold Weight Size 10 FontStyle Normal Font Default",
                FontSize = 10,
                FontWeight = FontWeight.Bold,
                FontStyle = FontStyle.Normal,
                ForegroundColor = Color.Black,
                Margin = 10
            });

            stackPanel.AddChild(new TextBlock
            {
                Text = "Heavy Weight Size 10 FontStyle Normal Font Default",
                FontSize = 10,
                FontWeight = FontWeight.Heavy,
                FontStyle = FontStyle.Normal,
                ForegroundColor = Color.Black,
                Margin = 10
            });

            stackPanel.AddChild(new TextBlock
            {
                Text = "Bold Weight Size 12 FontStyle Normal Font Default",
                FontSize = 12,
                FontWeight = FontWeight.Bold,
                FontStyle = FontStyle.Normal,
                ForegroundColor = Color.Black,
                Margin = 10
            });

            stackPanel.AddChild(new TextBlock
            {
                Text = "Thin Weight Size 12 FontStyle Normal Font Calibri Light Italic",
                FontSize = 12,
                FontWeight = FontWeight.Thin,
                FontStyle = FontStyle.Normal,
                ForegroundColor = Color.Black,
                FontFamily = "Calibri Light Italic",
                Margin = 10
            });

            Chart.AddControl(stackPanel);
        }

        public override void Calculate(int index)
        {
        }
    }
}
```

Python:

```python
import clr
clr.AddReference("cAlgo.API")

from cAlgo.API import *

class Test():
    def get_text_block(self, text, fontSize, fontWeight, fontStyle, fontFamily = None):
        textBlock = TextBlock()
        textBlock.Text = text
        textBlock.FontSize = fontSize
        textBlock.FontWeight = fontWeight
        textBlock.FontStyle = fontStyle
        textBlock.ForegroundColor = Color.Black
        textBlock.Margin = Thickness(10)
        if fontFamily is not None:
            textBlock.FontFamily = fontFamily
        return textBlock

    def initialize(self):
        stackPanel = StackPanel()
        stackPanel.HorizontalAlignment = HorizontalAlignment.Center
        stackPanel.VerticalAlignment = VerticalAlignment.Center
        stackPanel.BackgroundColor = Color.Gold
        stackPanel.Opacity = 0.6

        stackPanel.AddChild(self.get_text_block("Thin Weight Size 10 FontStyle Normal Font Default", 10, FontWeight.Thin, FontStyle.Normal))
        stackPanel.AddChild(self.get_text_block("Thin Weight Size 10 FontStyle Italic Font Default", 10, FontWeight.Thin, FontStyle.Italic))
        stackPanel.AddChild(self.get_text_block("Thin Weight Size 10 FontStyle Oblique Font Default", 10, FontWeight.Thin, FontStyle.Oblique))
        stackPanel.AddChild(self.get_text_block("Black Weight Size 10 FontStyle Normal Font Default", 10, FontWeight.Black, FontStyle.Normal))
        stackPanel.AddChild(self.get_text_block("Bold Weight Size 10 FontStyle Normal Font Default", 10, FontWeight.Bold, FontStyle.Normal))
        stackPanel.AddChild(self.get_text_block("Heavy Weight Size 10 FontStyle Normal Font Default", 10, FontWeight.Heavy, FontStyle.Normal))
        stackPanel.AddChild(self.get_text_block("Bold Weight Size 12 FontStyle Normal Font Default", 12, FontWeight.Bold, FontStyle.Normal))
        stackPanel.AddChild(self.get_text_block("Thin Weight Size 12 FontStyle Normal Font Calibri Light Italic", 12, FontWeight.Thin, FontStyle.Normal, "Calibri Light Italic"))

        api.Chart.AddControl(stackPanel)
```

config.json:

```json
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true
}
```

## Values

- `FontStyle.Normal` — Normal text.
- `FontStyle.Oblique` — Oblique text.
- `FontStyle.Italic` — Italic text.

