The article is really much more about the programming style made possible by using std:: The library include a set of classes that wraps the functionality of Direct2D and DirectWrite, adding a few significant features: Errors are converted into exceptions Transparent management of COM interface lifetimes The demo application implements the same functionality as one of the DirectWrite SDK examples, with a significant reduction in the size of the code. Now, those of us that develop applications that display 3D content are used to having the power of the GPU at our disposal.
Yi Multiple Layers of Functionality DirectWrite provides factored layers of functionality, with each layer interacting seamlessly with the next. The API design gives application developers the freedom and flexibility to adopt individual layers depending on their needs and schedule.
The following diagram shows the relationship between these layers. It provides services for the application to measure, display, and interact with richly formatted text strings. Text-intensive applications that implement their own layout engine may use the next layer down: The script processor breaks down a chunk of text into script blocks and handles the mapping between Unicode representations to the appropriate glyph representation in the font so the text of the script can be correctly displayed in the correct language.
The layout system used by the text layout API layer is built upon the font and script processing system. The glyph-rendering layer is the lowest layer of functionality and provides glyph-rendering functionality for applications that implement their own text layout engine.
The glyph rendering layer is also useful for applications that implement a custom renderer to modify the glyph-drawing behavior through the callback function in the DirectWrite text-formatting API. The DirectWrite font system is available to all the DirectWrite functional layers and enables an application to access font and glyph information.
It is designed to handle common font technologies and data formats. The DirectWrite font model follows the common typographic practice of supporting any number of weights, styles, and stretches in the same font family.
This model, the same model followed by WPF and CSS, specifies that fonts differing only in weight bold, light, and so onstyle upright, italic, or oblique or stretch narrow, condensed, wide, and so on are considered to be members of a single font family.
Improved Text Rendering with ClearType Improving readability on the screen is a key requirement for all Windows applications.
The evidence from research in cognitive psychology indicates that we need to be able to recognize every letter accurately and that even spacing between letters is critical for fast processing. Letters and words that are not symmetrical are perceived as ugly and degrade the reading experience.
The article is called "The Technology of Text" http: Text in DirectWrite is rendered using Microsoft ClearType, which enhances the clarity and readability of text. Before these ClearType enhancements, text with a "reading" size of 10 or 12 points was difficult to display: Using the extra resolution in the subpixels provides us with fractional spacing, which improves the evenness and symmetry of the entire page.
The following two illustration show how glyphs may begin on any sub-pixel boundary when sub-pixel positioning is used. The following illustration is rendered using the GDI version of the ClearType renderer, which did not employ sub-pixel positioning.
The following illustration is rendered using the DirectWrite version of the ClearType renderer, which uses sub-pixel positioning.
Note that the spacing between the letters h and n is more even in the second image and the letter o is spaced further from the letter n, more even with the letter l. Also note how the stems on the letters l are more natural looking.
The subpixel ClearType positioning offers the most accurate spacing of characters on screen, especially at small sizes where the difference between a sub-pixel and a whole pixel represents a significant proportion of glyph width. It enables text to be measured in ideal resolution space and rendered at its natural position at the LCD color stripe, with subpixel granularity.
Text measured and rendered using this technology is, by definition, resolution-independent, meaning that the exact same layout of text is achieved across the range of various display resolutions. The Text String API adopts sub-pixel text rendering by default, which means it measures text at its ideal resolution independent of the current display resolution, and produces the glyph positioning result based on the truly scaled glyph advance widths and positioning offsets.Introduction to DirectWrite.
Microsoft has added two interesting new API's to Windows 7: Direct2D and kaja-net.com2D replaces GDI and GDI+.
It can render more accurate results and has support for hardware acceleration on your graphics hardware. Apr 15, · Introducing the DirectWrite Font System In this post, I’d like to talk about some of the thinking behind the design of the font API in DirectWrite, and how it differs from GDI.
Save my name, email, and website in this browser for the next time I comment.
SWB says. The following sections describe the DirectWrite API in detail. API Reference (Windows) Try Microsoft Edge A fast and secure browser that's designed for . Applications can use DirectWrite to render richly formatted text for their UI and documents with the layout API.
For more complex scenarios, an application can work directly with glyphs, access fonts, and so on, and harness the power of DirectWrite to deliver high-quality typography. Direct2D save to image file sample This sample shows how to render to the screen using Direct2D and DirectWrite and then save the rendered image to disk using the WIC API.
The demo application is a simple image viewer using MFC support for Direct2D and WIC to load/save images from/into into files. Download: Save Direct2D bitmap in a file - .