Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IDWriteFactory::CreateGlyphRunAnalysis method

Creates a glyph run analysis object, which encapsulates information used to render a glyph run.

Syntax


virtual HRESULT CreateGlyphRunAnalysis(
  [in]           const DWRITE_GLYPH_RUN        * glyphRun,
                       FLOAT                    pixelsPerDip,
  [in, optional] const DWRITE_MATRIX           * transform,
                       DWRITE_RENDERING_MODE    renderingMode,
                       DWRITE_MEASURING_MODE   measuringMode,
                       FLOAT                    baselineOriginX,
                       FLOAT                    baselineOriginY,
  [out]                IDWriteGlyphRunAnalysis ** glyphRunAnalysis
) = 0;

Parameters

glyphRun [in]

Type: const DWRITE_GLYPH_RUN*

A structure that contains the properties of the glyph run (font face, advances, and so on).

pixelsPerDip

Type: FLOAT

Number of physical pixels per DIP (device independent pixel). For example, if rendering onto a 96 DPI bitmap then pixelsPerDip is 1. If rendering onto a 120 DPI bitmap then pixelsPerDip is 1.25.

transform [in, optional]

Type: const DWRITE_MATRIX*

Optional transform applied to the glyphs and their positions. This transform is applied after the scaling specified the emSize and pixelsPerDip.

renderingMode

Type: DWRITE_RENDERING_MODE

A value that specifies the rendering mode, which must be one of the raster rendering modes (that is, not default and not outline).

measuringMode

Type: DWRITE_MEASURING_MODE

Specifies the measuring mode to use with glyphs.

baselineOriginX

Type: FLOAT

The horizontal position (X-coordinate) of the baseline origin, in DIPs.

baselineOriginY

Type: FLOAT

Vertical position (Y-coordinate) of the baseline origin, in DIPs.

glyphRunAnalysis [out]

Type: IDWriteGlyphRunAnalysis**

When this method returns, contains an address of a pointer to the newly created glyph run analysis object.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

The glyph run analysis object contains the results of analyzing the glyph run, including the positions of all the glyphs and references to all of the rasterized glyphs in the font cache.

Examples

The following code example shows how to create a glyph run analysis object. In this example, an empty glyph run is being used.


HRESULT CreateGlyphRunAnalysis(IDWriteFontFace *pFontFace, IDWriteGlyphRunAnalysis **ppGlyphRunAnalysis)
{
    HRESULT hr = S_OK;
    IDWriteFactory* pDWriteFactory = NULL;

    // Create the DirectWrite factory.
    hr = DWriteCreateFactory(
            DWRITE_FACTORY_TYPE_SHARED,
            __uuidof(IDWriteFactory),
            reinterpret_cast<IUnknown**>(&pDWriteFactory)
            );

    DWRITE_GLYPH_RUN emptyGlyphRun = { 0 };
    UINT16 glyphIndex = 0;
    
    emptyGlyphRun.fontFace = pFontFace;
    emptyGlyphRun.glyphIndices = &glyphIndex;
    emptyGlyphRun.glyphCount = 0;
   
    emptyGlyphRun.fontEmSize = 12;

    IDWriteGlyphRunAnalysis* pGlyphRunAnalysis = NULL;

    if (SUCCEEDED(hr))
    {
        hr = pDWriteFactory->CreateGlyphRunAnalysis(
            &emptyGlyphRun,
            1.0f, // pixelsPerDip,
            NULL, // transform,
            DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC,
            DWRITE_MEASURING_MODE_GDI_CLASSIC,
            0.0f, // baselineOriginX,
            0.0f, // baselineOriginY,
            &pGlyphRunAnalysis);
    }
    
    *ppGlyphRunAnalysis = pGlyphRunAnalysis;

    SafeRelease(&pDWriteFactory);

    return S_OK;
}


Requirements

Minimum supported client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | Windows Store apps]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Header

Dwrite.h

Library

Dwrite.lib

DLL

Dwrite.dll

See also

IDWriteFactory

 

 

Show:
© 2016 Microsoft