--- title: "Introduction to the GlyphRun Object and Glyphs Element" ms.date: "03/30/2017" helpviewer_keywords: - "typography [WPF], Glyphs element" - "Glyphs elements [WPF]" - "GlyphRun object [WPF]" - "text [WPF], glyphs" - "glyphs [WPF]" - "typography [WPF], GlyphRun object" ms.assetid: 746ca769-a331-4435-9b95-f72a883b67c1 --- # Introduction to the GlyphRun Object and Glyphs Element This topic describes the object and the element. ## Introduction to GlyphRun [!INCLUDE[TLA#tla_winclient](../../../includes/tlasharptla-winclient-md.md)] provides advanced text support including glyph-level markup with direct access to for customers who want to intercept and persist text after formatting. These features provide critical support for the different text rendering requirements in each of the following scenarios. 1. Screen display of fixed-format documents. 2. Print scenarios. - [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)] as a device printer language. - Microsoft XPS Document Writer. - Previous printer drivers, output from Win32 applications to the fixed format. - Print spool format. 3. Fixed-format document representation, including clients for previous versions of Windows and other computing devices. > [!NOTE] > and are designed for fixed-format document presentation and print scenarios. [!INCLUDE[TLA#tla_winclient](../../../includes/tlasharptla-winclient-md.md)] provides several elements for general layout and [!INCLUDE[TLA#tla_ui](../../../includes/tlasharptla-ui-md.md)] scenarios such as and . For more information on layout and [!INCLUDE[TLA2#tla_ui](../../../includes/tla2sharptla-ui-md.md)] scenarios, see the [Typography in WPF](typography-in-wpf.md). ## The GlyphRun Object The object represents a sequence of glyphs from a single face of a single font at a single size, and with a single rendering style. includes both font details such as glyph and individual glyph positions. It also includes the original Unicode code points the run was generated from, character-to-glyph buffer offset mapping information, and per-character and per-glyph flags. has a corresponding high-level , . can be used in the element tree and in [!INCLUDE[TLA2#tla_xaml](../../../includes/tla2sharptla-xaml-md.md)] markup to represent output. ## The Glyphs Element The element represents the output of a in [!INCLUDE[TLA2#tla_xaml](../../../includes/tla2sharptla-xaml-md.md)]. The following markup syntax is used to describe the element. [!code-xaml[GlyphsOvwSample1#1](~/samples/snippets/csharp/VS_Snippets_Wpf/GlyphsOvwSample1/CS/default.xaml#1)] The following property definitions correspond to the first four attributes in the sample markup. |Property|Description| |--------------|-----------------| ||Specifies a resource identifier: file name, Web uniform resource identifier (URI), or resource reference in the application .exe or container.| ||Specifies the font size in drawing surface units (default is .96 inches).| ||Specifies flags for bold and Italic styles.| ||Specifies the bidirectional layout level. Even-numbered and zero values imply left-to-right layout; odd-numbered values imply right-to-left layout.| ### Indices property The property is a string of glyph specifications. Where a sequence of glyphs forms a single cluster, the specification of the first glyph in the cluster is preceded by a specification of how many glyphs and how many code points combine to form the cluster. The property collects in one string the following properties. - Glyph indices - Glyph advance widths - Combining glyph attachment vectors - Cluster mapping from code points to glyphs - Glyph flags Each glyph specification has the following form. `[GlyphIndex][,[Advance][,[uOffset][,[vOffset][,[Flags]]]]]` ## Glyph Metrics Each glyph defines metrics that specify how it aligns with other . The following graphic defines the various typographic qualities of two different glyph characters. ![Diagraph of glyph measurements](./media/glyph-example.png "glyph_example") ## Glyphs Markup The following code example shows how to use various properties of the element in [!INCLUDE[TLA2#tla_xaml](../../../includes/tla2sharptla-xaml-md.md)]. [!code-xaml[GlyphsOvwSamp2#1](~/samples/snippets/csharp/VS_Snippets_Wpf/GlyphsOvwSamp2/CS/default.xaml#1)] ## See also - [Typography in WPF](typography-in-wpf.md) - [Documents in WPF](documents-in-wpf.md) - [Text](optimizing-performance-text.md)