Skip to main content
Featured Samples

This section contains information about samples for DirectWrite distributed with the Microsoft Windows Software Development Kit (SDK).

The full code for these examples is also available on the DirectWrite Resource Page on MSDN Code Gallery.

The following table shows the sample names and descriptions.

SampleDescription
DirectWrite Hello World Sample Displays the text "Hello World Using DirectWrite!" by using the DirectWrite API. This application has three child windows, each a different class, that displays the text with increasingly complex style and formatting.
Simple Hello World Sample A version of the DirectWrite Hello World Sample with a single window writing only simple, single format text.
GDI Interoperation Sample A sample that shows how to draw DirectWrite text to a GDI surface and convert from a GDI? LOGFONT to a DirectWrite IDWriteFont object.
Text Dialog Sample A text dialog that updates font face, style, weight, and size in real time.
Font Enumeration Sample Enumerates the fonts in the system font collection, and outputs the font family name to the console.
Choose Font Sample A font chooser dialog.
Custom Font Sample Illustrates how to distribute custom fonts in your application executable, load the fonts, and then display text in the loaded fonts.
Custom Layout Sample Uses a custom, application implemented text layout object to display text in a non-rectangular region.
PadWrite Layout Sample A text editor demonstrating the DirectWrite layout API, ranged text formatting, text metrics, hit testing, inline images, drawing effects, and more.
Text Rendering Sample Demonstrates various rendering modes, measuring modes, and methods of rendering that are available with DirectWrite. Also shows transforms (rotation), font selection, and has an optional magnifier for seeing text both scaled up and zoomed in to view pixels and subpixels.