Browse Source

Dispose the DirectWrite TextFormat.

tabcontrol-bound-items
Steven Kirk 10 years ago
parent
commit
a90ce149b6
  1. 19
      src/Windows/Perspex.Direct2D1/Media/FormattedTextImpl.cs

19
src/Windows/Perspex.Direct2D1/Media/FormattedTextImpl.cs

@ -22,19 +22,20 @@ namespace Perspex.Direct2D1.Media
{
var factory = PerspexLocator.Current.GetService<DWrite.Factory>();
var format = new DWrite.TextFormat(
using (var format = new DWrite.TextFormat(
factory,
fontFamily,
(DWrite.FontWeight)fontWeight,
(DWrite.FontStyle)fontStyle,
(float)fontSize);
TextLayout = new DWrite.TextLayout(
factory,
text ?? string.Empty,
format,
float.MaxValue,
float.MaxValue);
(float)fontSize))
{
TextLayout = new DWrite.TextLayout(
factory,
text ?? string.Empty,
format,
float.MaxValue,
float.MaxValue);
}
TextLayout.TextAlignment = textAlignment.ToDirect2D();
}

Loading…
Cancel
Save