Skip to main content
.NET Framework Class Library
GlyphRun Class

Represents a sequence of glyphs from a single face of a single font at a single size, and with a single rendering style.

Inheritance Hierarchy
SystemObject
  System.Windows.MediaGlyphRun

Namespace:   System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Syntax
Public Class GlyphRun _
	Implements [%$TOPIC/ms635009_en-us_VS_110_2_0_0_0_0%]
public class GlyphRun : [%$TOPIC/ms635009_en-us_VS_110_2_0_1_0_0%]
public ref class GlyphRun : [%$TOPIC/ms635009_en-us_VS_110_2_0_2_0_0%]
type GlyphRun =  
    class 
        interface [%$TOPIC/ms635009_en-us_VS_110_2_0_3_0_0%] 
    end
public class GlyphRun implements [%$TOPIC/ms635009_en-us_VS_110_2_0_4_0_0%]

The GlyphRun type exposes the following members.

Constructors
  NameDescription
Public method GlyphRunInitializes a new instance of the GlyphRun class.
Public method GlyphRun(GlyphTypeface, Int32, Boolean, Double, IListUInt16, Point, IListDouble, IListPoint, IListChar, String, IListUInt16, IListBoolean, XmlLanguage)Initializes a new instance of the GlyphRun class by specifying properties of the class.
Top
Properties
  NameDescription
Public property AdvanceWidthsGets or sets the list of Double values that represent the advance widths corresponding to the glyph indices.
Public property BaselineOriginGets or sets the baseline origin of the GlyphRun.
Public property BidiLevelGets or sets the bidirectional nesting level of the GlyphRun.
Public property CaretStopsGets or sets the list of Boolean values that determine whether there are caret stops for every UTF16 code point in the Unicode representing the GlyphRun.
Public property CharactersGets or sets the list of UTF16 code points that represent the Unicode content of the GlyphRun.
Public property ClusterMapGets or sets the list of UInt16 values that maps characters in the GlyphRun to glyph indices.
Public property DeviceFontNameGets or sets the specific device font for which the GlyphRun has been optimized.
Public property FontRenderingEmSizeGets or sets the em size used for rendering the GlyphRun.
Public property GlyphIndicesGets or sets an array of UInt16 values that represent the glyph indices in the rendering physical font.
Public property GlyphOffsetsGets or sets an array of Point values representing the offsets of the glyphs in the GlyphRun.
Public property GlyphTypefaceGets or sets the GlyphTypeface for the GlyphRun.
Public property IsHitTestableGets a value indicating whether there are any valid caret character hits within the GlyphRun.
Public property IsSidewaysGets or sets a value indicating whether to rotate glyphs.
Public property LanguageGets or sets the XmlLanguage for the GlyphRun.
Top
Methods
  NameDescription
Public method BuildGeometryRetrieves the Geometry for the GlyphRun.
Public method ComputeAlignmentBoxRetrieves the alignment box for the GlyphRun.
Public method ComputeInkBoundingBoxRetrieves the ink bounding box for the GlyphRun.
Public method Equals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetCaretCharacterHitFromDistanceRetrieves the CharacterHit value that represents the character hit of the caret of the GlyphRun.
Public method GetDistanceFromCaretCharacterHitRetrieves the offset from the leading edge of the GlyphRun to the leading or trailing edge of a caret stop containing the specified character hit.
Public method GetHashCodeServes as the default hash function. (Inherited from Object.)
Public method GetNextCaretCharacterHitRetrieves the next valid caret character hit in the logical direction in the GlyphRun.
Public method GetPreviousCaretCharacterHitRetrieves the previous valid caret character hit in the logical direction in the GlyphRun.
Public method GetTypeGets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public method ToStringReturns a string that represents the current object. (Inherited from Object.)
Top
Explicit Interface Implementations
  NameDescription
Explicit interface implemetation Private method ISupportInitializeBeginInitFor a description of this member, see ISupportInitializeBeginInit.
Explicit interface implemetation Private method ISupportInitializeEndInitFor a description of this member, see ISupportInitializeEndInit.
Top
Remarks

The GlyphRun object includes font details such as glyph indices and individual glyph positions. In addition, The GlyphRun object contains the original Unicode code points the run was generated from, character to glyph buffer offset mapping information, and per-character and per-glyph flags.

The Glyphs element represents the output of a GlyphRun in XAML. The following markup syntax is used to describe the Glyphs element.

<!-- The example shows how to use a Glyphs object. -->
<Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  >

   <StackPanel Background="PowderBlue">

      <Glyphs
         FontUri             = "C:\WINDOWS\Fonts\TIMES.TTF"
         FontRenderingEmSize = "100"
         StyleSimulations    = "BoldSimulation"
         UnicodeString       = "Hello World!"
         Fill                = "Black"
         OriginX             = "100"
         OriginY             = "200"
      />

   </StackPanel>
</Page>

Each glyph defines metrics that specify how it aligns with other Glyphs. The following graphic defines the various typographic qualities of two different glyph characters.

Various typographic qualities of two different glyph characters

Diagraph of glyph measurements
Version Information

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.