[]
        
(Showing Draft Content)

GrapeCity.Documents.DX.DirectWrite.TextRendererBase

Class TextRendererBase

Namespace
GrapeCity.Documents.DX.DirectWrite
Assembly
GcDocs.DX.Windows.dll

Default implementation of TextRenderer. Need to implement at least a DrawXXX method to use it.

public class TextRendererBase : CallbackBase, ITextRenderer, IPixelSnapping, ICallbackable, IDisposable
Inheritance
object
TextRendererBase
Implements
System.IDisposable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Constructors

TextRendererBase()

public TextRendererBase()

Methods

DrawGlyphRun(object, float, float, MeasuringMode, GlyphRun, GlyphRunDescription, IntPtr)

IDWriteTextLayout::Draw calls this function to instruct the client to render a run of glyphs.

public virtual HResult DrawGlyphRun(object clientDrawingContext, float baselineOriginX, float baselineOriginY, MeasuringMode measuringMode, GlyphRun glyphRun, GlyphRunDescription glyphRunDescription, IntPtr clientDrawingEffectPtr)

Parameters

clientDrawingContext object

The application-defined drawing context passed to Draw(object, ITextRenderer, float, float).

baselineOriginX float

The pixel location (X-coordinate) at the baseline origin of the glyph run.

baselineOriginY float

The pixel location (Y-coordinate) at the baseline origin of the glyph run.

measuringMode MeasuringMode

The measuring method for glyphs in the run, used with the other properties to determine the rendering mode.

glyphRun GlyphRun

Pointer to the glyph run instance to render.

glyphRunDescription GlyphRunDescription

A pointer to the optional glyph run description instance which contains properties of the characters associated with this run.

clientDrawingEffectPtr System.IntPtr

Application-defined drawing effects for the glyphs to render. Usually this argument represents effects such as the foreground brush filling the interior of text.

Returns

HResult

If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

DrawInlineObject(object, float, float, IInlineObject, bool, bool, IntPtr)

IDWriteTextLayout::Draw calls this application callback when it needs to draw an inline object.

public virtual HResult DrawInlineObject(object clientDrawingContext, float originX, float originY, IInlineObject inlineObject, bool isSideways, bool isRightToLeft, IntPtr clientDrawingEffectPtr)

Parameters

clientDrawingContext object

The application-defined drawing context passed to IDWriteTextLayout::Draw.

originX float

X-coordinate at the top-left corner of the inline object.

originY float

Y-coordinate at the top-left corner of the inline object.

inlineObject IInlineObject

The application-defined inline object set using IDWriteTextFormat::SetInlineObject.

isSideways bool

A Boolean flag that indicates whether the object's baseline runs alongside the baseline axis of the line.

isRightToLeft bool

A Boolean flag that indicates whether the object is in a right-to-left context, hinting that the drawing may want to mirror the normal image.

clientDrawingEffectPtr System.IntPtr

Application-defined drawing effects for the glyphs to render. Usually this argument represents effects such as the foreground brush filling the interior of a line.

Returns

HResult

If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

DrawStrikethrough(object, float, float, ref Strikethrough, IntPtr)

IDWriteTextLayout::Draw calls this function to instruct the client to draw a strikethrough.

public virtual HResult DrawStrikethrough(object clientDrawingContext, float baselineOriginX, float baselineOriginY, ref Strikethrough strikethrough, IntPtr clientDrawingEffectPtr)

Parameters

clientDrawingContext object

The application-defined drawing context passed to IDWriteTextLayout::Draw.

baselineOriginX float

The pixel location (X-coordinate) at the baseline origin of the run where strikethrough applies.

baselineOriginY float

The pixel location (Y-coordinate) at the baseline origin of the run where strikethrough applies.

strikethrough Strikethrough

Pointer to a structure containing strikethrough logical information.

clientDrawingEffectPtr System.IntPtr

Application-defined effect to apply to the strikethrough. Usually this argument represents effects such as the foreground brush filling the interior of a line.

Returns

HResult

If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

A single strikethrough can be broken into multiple calls, depending on how the formatting changes attributes. Strikethrough is not averaged across font sizes/styles changes. To get an appropriate starting pixel position, add strikethrough::offset to the baseline. Like underlines, the x coordinate will always be passed as the left side, regardless of text directionality.

DrawUnderline(object, float, float, ref Underline, IntPtr)

IDWriteTextLayout::Draw calls this function to instruct the client to draw an underline.

public virtual HResult DrawUnderline(object clientDrawingContext, float baselineOriginX, float baselineOriginY, ref Underline underline, IntPtr clientDrawingEffectPtr)

Parameters

clientDrawingContext object

The application-defined drawing context passed to IDWriteTextLayout::Draw.

baselineOriginX float

The pixel location (X-coordinate) at the baseline origin of the run where underline applies.

baselineOriginY float

The pixel location (Y-coordinate) at the baseline origin of the run where underline applies.

underline Underline

Pointer to a structure containing underline logical information.

clientDrawingEffectPtr System.IntPtr

Application-defined effect to apply to the underline. Usually this argument represents effects such as the foreground brush filling the interior of a line.

Returns

HResult

If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

A single underline can be broken into multiple calls, depending on how the formatting changes attributes. If font sizes/styles change within an underline, the thickness and offset will be averaged weighted according to characters. To get an appropriate starting pixel position, add underline::offset to the baseline. Otherwise there will be no spacing between the text. The x coordinate will always be passed as the left side, regardless of text directionality. This simplifies drawing and reduces the problem of round-off that could potentially cause gaps or a double stamped alpha blend. To avoid alpha overlap, round the end points to the nearest device pixel.

GetCurrentTransform(object)

Gets a transform that maps abstract coordinates to DIPs.

public virtual Matrix3x2 GetCurrentTransform(object clientDrawingContext)

Parameters

clientDrawingContext object

The drawing context passed to GrapeCity.Documents.DX.DirectWrite.TextLayout.Draw_(System.IntPtr,System.IntPtr,System.Single,System.Single).

Returns

Matrix3x2

a structure which has transform information for pixel snapping.

GetPixelsPerDip(object)

Gets the number of physical pixels per DIP.

public virtual float GetPixelsPerDip(object clientDrawingContext)

Parameters

clientDrawingContext object

The drawing context passed to GrapeCity.Documents.DX.DirectWrite.TextLayout.Draw_(System.IntPtr,System.IntPtr,System.Single,System.Single).

Returns

float

the number of physical pixels per DIP

Remarks

Because a DIP (device-independent pixel) is 1/96 inch, the pixelsPerDip value is the number of logical pixels per inch divided by 96.

IsPixelSnappingDisabled(object)

Determines whether pixel snapping is disabled. The recommended default is FALSE, unless doing animation that requires subpixel vertical placement.

public virtual bool IsPixelSnappingDisabled(object clientDrawingContext)

Parameters

clientDrawingContext object

The context passed to IDWriteTextLayout::Draw.

Returns

bool

Receives TRUE if pixel snapping is disabled or FALSE if it not.