0

I have been using the GlyphRun class to do low-level display of text on a Canvas panel. I just recently became aware of the Glyphs class. I do not understand the reason for the existence of the Glyphs class, given that the GlyphRun class is already available.

I have not tried using the Glyphs class. I have not been able to find a non-XAML sample, but that is really not the reason why I haven't tried it. Even if I did get a Glyphs-based sample working, I don't understand its utility over GlyphRun, based on the very little documentation there is in MSDN.

C#, Windows 7, WPF, any .NET version.

Sabuncu
  • 5,095
  • 5
  • 55
  • 89
  • 2
    `Glyphs` is a `FrameworkElement` and can hence be used directly in XAML. From the Remarks section [here](http://msdn.microsoft.com/en-us/library/system.windows.documents.glyphs.aspx): *The Glyphs element represents the output of a GlyphRun in XAML*. – Clemens Nov 12 '14 at 12:10
  • Hey @Clemens, thanks so much. I do much of my coding in code-behind, my XAML is usually empty (except for styles). Does that mean I really don't need the `Glyphs` class? Can it provide me with anything extra in code-behind over `GlyphRun`? – Sabuncu Nov 12 '14 at 12:12
  • 1
    I guess you could as well use it in code-behind like any other UI element. You might for example add a Glyphs instance to the Children collection of a Panel. That is something you can't do with a GlyphRun. – Clemens Nov 12 '14 at 12:17
  • @Clemens True, I have been wrapping GlyphRun in my own custom class to achieve exactly what you just described. – Sabuncu Nov 12 '14 at 12:20
  • @Clemens The problem is that the MSDN entry for Glyphs is absimal, mostly no help. It may be more powerful than GlyphRun but the information is obscure. – Sabuncu Nov 12 '14 at 12:23
  • That's certainly because there is hardly any reason to actually use GlyphRun or Glyphs at all, if you are not programming at the Visual level. You could just use a TextBlock instead of a Glyphs instance. – Clemens Nov 12 '14 at 12:26

0 Answers0