Question: We have just upgraded a .NET 4.6 project to .NET 4.8 and this function

```
Private Function MeasureTextSize(ByVal text As String, ByVal fontFamily As FontFamily, ByVal fontStyle As FontStyle, ByVal fontWeight As FontWeight, ByVal fontStretch As FontStretch, ByVal fontSize As Double) As Size

    Dim ft As New FormattedText(text, System.Globalization.CultureInfo.CurrentCulture, FlowDirection.LeftToRight, New Typeface(fontFamily, fontStyle, fontWeight, fontStretch), fontSize, Brushes.Black)
    Return New Size(ft.Width, ft.Height)
End Function

```

Is showing the following warning

```
warning BC40000: 'Public Overloads Sub New(textToFormat As String, culture As CultureInfo, flowDirection As FlowDirection, typeface As Typeface, emSize As Double, foreground As Brush)' is obsolete: 'Use the PixelsPerDip override'.

```

Bearing in mind this is a module, how can this be corrected?

Thank you

Answer: 
You have three options basically:

* Create a visual and use the `GetDpi` method to get a value for the `pixelsPerDip` parameter:

```
VisualTreeHelper.GetDpi(new Button()).PixelsPerDip

```
* Define a static value yourself, e.g. `1.25`.
* Ignore the warning and use the obsolete overload.
The warning message is telling you that the overload of `New FormattedText()` that you are using is obsolete, but there exists another overload of the same constructor which is not obsolete and you should use.

So, the solution you are looking for is to replace this:

```
New FormattedText( ... )

```

with this:

```
New FormattedText( ..., 1.0 );

```