Atm.. im trying todo the following
However the IconsFamily font used by NT8 to draw icons is an embedded resource. It seems that SimpleFont does not work with embedded resources.
Is there some other way to get this to work ?
private void DrawTextLabel(ChartControl chartControl, ChartScale chartScale, string txt, float x, float y, float w) { var family = System.Windows.Application.Current.TryFindResource("IconsFamily") as System.Windows.Media.FontFamily; var wpfFont = new SimpleFont(family.ToString(), 32); var textFormat = wpfFont.ToDirectWriteTextFormat(); textFormat.TextAlignment = SharpDX.DirectWrite.TextAlignment.Center; textFormat.WordWrapping = WordWrapping.NoWrap; var textLayout = new TextLayout(Globals.DirectWriteFactory, txt, textFormat, w, textFormat.FontSize); var textBrush = Brushes.Black.ToDxBrush(RenderTarget); RenderTarget.DrawTextLayout(new Vector2(x, y), textLayout, textBrush, DrawTextOptions.NoSnap); textBrush.Dispose(); textFormat.Dispose(); textLayout.Dispose(); }
Comment