DirectWrite API Reference
The DirectWrite API provides a high-quality, high-performance direct-write API for text rendering on Windows.
Core Interfaces
This section covers the fundamental interfaces used for text layout and rendering with DirectWrite.
IDWriteFactory
The factory object is the entry point for all DirectWrite operations. You use it to create other DirectWrite objects.
Creates a text format object that contains font-related properties such as font face, weight, style, and size.
IDWriteTextLayout
Represents a block of text that has been fully analyzed for layout, including line breaks, word wrapping, and text effects.
Sets the maximum width of the text layout. Text will wrap to the next line if it exceeds this width.
IDWriteTextRenderer
An interface implemented by the application to receive drawing commands for text. This interface is used by IDWriteTextLayout::Draw.
Implementations typically involve methods like DrawGlyphRun, DrawUnderline, and DrawStrikethrough.
Key Concepts
- Font Fallback: Mechanisms for handling characters that are not present in the requested font.
- Text Analysis: The process of analyzing text for glyphs, formatting, and layout metrics.
- Glyph Run: A contiguous sequence of characters that are represented by the same font face, size, and style.
Rendering and Layout
Explore the classes and methods involved in drawing text to the screen.
IDWriteTextAnalyzer
Provides services for text analysis, such as determining script analysis and locale-sensitive string comparison.
IDWritePixelSnapping
Interface for controlling pixel snapping behavior during text rendering.
IDWriteGlyphRunAnalysis
Represents the results of text analysis for a single glyph run.
Typography Features
Leverage advanced typographic features for richer text rendering.
IDWriteTypography
Interface for controlling OpenType typographic features like ligatures, stylistic sets, and alternates.
Configures font feature settings. For example, to enable small caps.
Related Topics
- Direct2D: For drawing primitives and images alongside text.
- DirectWrite Concepts
- DirectWrite Samples