# InputFormat.GetFontSizes Method

> Returns all possible font sizes of a certain font.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 16.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl > InputFormat.GetFontSizes Method
- **1252 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/inputformat/getfontsizes-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/inputformat/getfontsizes-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/inputformat/getfontsizes-method/llms-full.txt

---

### Description

Returns all possible font sizes of a certain font.

### Syntax

#### GetFontSizes()

Returns an array of strings specifying all possible font sizes for the font at the text input position. If the font is free scalable, standard sizes are returned.

```csharp
public string[] GetFontSizes();
```

```vbnet
Public Function GetFontSizes() As String()
```

#### GetFontSizes(string)

Returns an array of strings specifying all possible font sizes for specified font. If the font is free scalable, standard sizes are returned.

```csharp
public string[] GetFontSizes(string fontName);
```

```vbnet
Public Function GetFontSizes(fontName As String) As String()
```

| Parameter | Description |
|---|---|
| fontName | Specifies the font the possible sizes of which are returned. It must be a font in the list of supported fonts which are returned through the [GetFontFamilies](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/inputformat/getfontfamilies-method/llms-full.txt) method. |

### Return Value

The return value is the list of possible font sizes. Null is returned, if the specified font is not supported or if text is selected and the selection contains several different fonts.

### Examples

The following XAML example shows how to bind a combo box to the [FontSize](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/inputformat/fontsize-property/llms-full.txt) property using GetFontSizes to fill the combo box with available font sizes.

```plaintext
…
xmlns:tx="clr-namespace:TXTextControl.WPF;assembly=TXTextControl.WPF"
…
<Window.Resources>
    <tx:MeasureConverter Unit="Point" Decimals="1" x:Key="twipsConv" />
</Window.Resources>
…
<ComboBox
    Name="cbFontSize"
    IsEditable="True"
    IsReadOnly="True"
    Width="50"
    DropDownOpened="cbFontSize_DropDownOpened"
    Text="{Binding
    ElementName=textControl1,
    Path=InputFormat.FontSize,
    Converter={StaticResource twipsConv}}" />
```

```csharp
private void cbFontSize_DropDownOpened(object sender, EventArgs e) {
    cbFontSize.ItemsSource = textControl1.InputFormat.GetFontSizes();
}
```

```vbnet
Private Sub cbFontSize_DropDownOpened(sender As Object, e As EventArgs)
    cbFontSize.ItemsSource = textControl1.InputFormat.GetFontSizes()
End Sub
```

The following example changes the formatting applied to text entered at the end of a document by using `InputFormat.GetFontSizes`.

```csharp
textControl.Text = "Project summary";
textControl.InputPosition = new InputPosition(textControl.Text.Length);
InputFormat inputFormat = textControl.InputFormat;

string[] results = inputFormat.GetFontSizes("Arial");
foreach (string text in results)
{
    Console.WriteLine(text);
}
```

```vbnet
textControl.Text = "Project summary"
textControl.InputPosition = New InputPosition(textControl.Text.Length)
Dim inputFormat As InputFormat = textControl.InputFormat

Dim results As String() = inputFormat.GetFontSizes("Arial")
For Each text As String In results
    Console.WriteLine(text)
Next
```

---

## Nearby

- **Previous:** [InputFormat.GetFontFamilies Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/inputformat/getfontfamilies-method/llms-full.txt)
- **Next:** [InputFormat.HangingIndent Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/inputformat/hangingindent-property/llms-full.txt)
