Programming Guide

The following topics provide an overview of the DirectWrite API.

In this section

TopicDescription

Introducing DirectWrite

Tutorial: Getting Started with DirectWrite

This document shows you how to use DirectWrite and Direct2D to create simple text that contains a single format, and then text that contains multiple formats.

Text Formatting and Layout

DirectWrite provides two interfaces for formatting text: IDWriteTextFormat and IDWriteTextLayout. IDWriteTextFormat describes only the format for text and is used in cases when an entire string is to be the same font size, style, weight and so on. On the other hand, IDWriteTextLayout encapsulates both a text string and the formatting for specified ranges of the string. This document describes each interface and their uses. For more information about the creation and methods of these interfaces, see the IDWriteTextFormat and IDWriteTextLayout reference pages.

Justification, Kerning, and Spacing

Starting with Windows 8, DirectWrite provides a number of features that allow you to control basic typographic, layout, and spacing features, such as character spacing, pair kerning, and justification.

Vertical Text

Starting with the Windows 8, DirectWrite has a number of new APIs that allow you to use vertical text in your apps.

Performance

Performance for DirectWrite depends largely on how you render it. See the Improving the performance of Direct2D apps topic for info on rendering performance with Direct2D.

Text Metrics

In order to assist your layout, custom font selection, and other metric intensive operations, starting in Windows 8, DirectWrite has a number of new APIs to express all the info about fonts that you might require to develop rich text apps.

Rendering DirectWrite

How-to Topics

The following topics provide an overview of the DirectWrite API.

Glyphs and Glyph Runs

Glyphs and glyph runs are available at the lowest layer of functionality of the DirectWrite API, the glyph-rendering layer.

Custom Font Collections

DirectWrite provides access to the system font collection by using the IDWriteFactory::GetSystemFontCollection method. This is the font collection that is most frequently used. However some applications have to use fonts that are not installed on the system, such as from included font files or font files embedded in the application.

If the fonts that you want are not in the system font collection, you can create a custom font collection derived from IDWriteFontCollection.

Win32 Text API Comparison

For those developers that are migrating their Win32 application code, the following table lists the Win32 Text APIs and the approximate equivalent in DirectWrite.

Interoperating with GDI

DirectWrite provides a migration path from, and some interoperability with, GDI's font model, as well as interfaces for rendering text to a bitmap that can then be drawn on a window.

DirectWrite Glossary

 

 

 

Community Additions

ADD
Show:
© 2014 Microsoft