I'm making a datagrid like control with lots of rows and columns. the problem was loading time that was solved with using glyphs instead of textblock.
now the problem is when I give it a font from applications pack it slows down and remains in memory and each time control reloads it gets slower and consumes much more memory:
Glyphs glyph = new Glyphs()
{
FlowDirection = FlowDirection.LeftToRight,
UnicodeString = "text",
FontUri = fnt,
FontRenderingEmSize = 15,
Fill = Brushes.Black,
HorizontalAlignment = HorizontalAlignment.Center
};
now what causing problem is :
Uri fnt = new Uri("pack://application:,,,/myapp;component/Fonts/times.ttf");
everything is okay if I do this:
Uri fnt = new Uri(@"C:\Windows\Fonts\times.ttf");
but I'm going to use a font that does not exist on other systems and it needs to be with my app.