Browse Source

Dispose the DirectWrite TextFormat.

tabcontrol-bound-items
Steven Kirk 11 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 factory = PerspexLocator.Current.GetService<DWrite.Factory>();
var format = new DWrite.TextFormat( using (var format = new DWrite.TextFormat(
factory, factory,
fontFamily, fontFamily,
(DWrite.FontWeight)fontWeight, (DWrite.FontWeight)fontWeight,
(DWrite.FontStyle)fontStyle, (DWrite.FontStyle)fontStyle,
(float)fontSize); (float)fontSize))
{
TextLayout = new DWrite.TextLayout( TextLayout = new DWrite.TextLayout(
factory, factory,
text ?? string.Empty, text ?? string.Empty,
format, format,
float.MaxValue, float.MaxValue,
float.MaxValue); float.MaxValue);
}
TextLayout.TextAlignment = textAlignment.ToDirect2D(); TextLayout.TextAlignment = textAlignment.ToDirect2D();
} }

Loading…
Cancel
Save