Interface TextRenderer
- Namespace
- SharpDX.DirectWrite
- Assembly
- SharpDX.Direct2D1.dll
[Guid("ef8a8135-5cc6-45fe-8825-c5a0724eb819")]
public interface TextRenderer : PixelSnapping, IUnknown, ICallbackable, IDisposable
- Inherited Members
Methods
DrawGlyphRun(object, float, float, MeasuringMode, GlyphRun, GlyphRunDescription, ComObject)
IDWriteTextLayout::Draw calls this function to instruct the client to render a run of glyphs.
Result DrawGlyphRun(object clientDrawingContext, float baselineOriginX, float baselineOriginY, MeasuringMode measuringMode, GlyphRun glyphRun, GlyphRunDescription glyphRunDescription, ComObject clientDrawingEffect)
Parameters
clientDrawingContext
objectThe application-defined drawing context passed to
. baselineOriginX
floatThe pixel location (X-coordinate) at the baseline origin of the glyph run.
baselineOriginY
floatThe pixel location (Y-coordinate) at the baseline origin of the glyph run.
measuringMode
MeasuringModeThe measuring method for glyphs in the run, used with the other properties to determine the rendering mode.
glyphRun
GlyphRunPointer to the glyph run instance to render.
glyphRunDescription
GlyphRunDescriptionA pointer to the optional glyph run description instance which contains properties of the characters associated with this run.
clientDrawingEffect
ComObjectApplication-defined drawing effects for the glyphs to render. Usually this argument represents effects such as the foreground brush filling the interior of text.
Returns
- Result
If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
The
DrawInlineObject(object, float, float, InlineObject, bool, bool, ComObject)
IDWriteTextLayout::Draw calls this application callback when it needs to draw an inline object.
Result DrawInlineObject(object clientDrawingContext, float originX, float originY, InlineObject inlineObject, bool isSideways, bool isRightToLeft, ComObject clientDrawingEffect)
Parameters
clientDrawingContext
objectThe application-defined drawing context passed to IDWriteTextLayout::Draw.
originX
floatX-coordinate at the top-left corner of the inline object.
originY
floatY-coordinate at the top-left corner of the inline object.
inlineObject
InlineObjectThe application-defined inline object set using IDWriteTextFormat::SetInlineObject.
isSideways
boolA Boolean flag that indicates whether the object's baseline runs alongside the baseline axis of the line.
isRightToLeft
boolA 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.
clientDrawingEffect
ComObjectApplication-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
- Result
If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
DrawStrikethrough(object, float, float, ref Strikethrough, ComObject)
IDWriteTextLayout::Draw calls this function to instruct the client to draw a strikethrough.
Result DrawStrikethrough(object clientDrawingContext, float baselineOriginX, float baselineOriginY, ref Strikethrough strikethrough, ComObject clientDrawingEffect)
Parameters
clientDrawingContext
objectThe application-defined drawing context passed to IDWriteTextLayout::Draw.
baselineOriginX
floatThe pixel location (X-coordinate) at the baseline origin of the run where strikethrough applies.
baselineOriginY
floatThe pixel location (Y-coordinate) at the baseline origin of the run where strikethrough applies.
strikethrough
StrikethroughPointer to a structure containing strikethrough logical information.
clientDrawingEffect
ComObjectApplication-defined effect to apply to the strikethrough. Usually this argument represents effects such as the foreground brush filling the interior of a line.
Returns
- Result
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, ComObject)
IDWriteTextLayout::Draw calls this function to instruct the client to draw an underline.
Result DrawUnderline(object clientDrawingContext, float baselineOriginX, float baselineOriginY, ref Underline underline, ComObject clientDrawingEffect)
Parameters
clientDrawingContext
objectThe application-defined drawing context passed to IDWriteTextLayout::Draw.
baselineOriginX
floatThe pixel location (X-coordinate) at the baseline origin of the run where underline applies.
baselineOriginY
floatThe pixel location (Y-coordinate) at the baseline origin of the run where underline applies.
underline
UnderlinePointer to a structure containing underline logical information.
clientDrawingEffect
ComObjectApplication-defined effect to apply to the underline. Usually this argument represents effects such as the foreground brush filling the interior of a line.
Returns
- Result
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.