Skip to content

Latest commit

 

History

History
172 lines (120 loc) · 5.67 KB

nf-dwrite-idwritefactory-createglyphrunanalysis.md

File metadata and controls

172 lines (120 loc) · 5.67 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:dwrite.IDWriteFactory.CreateGlyphRunAnalysis
IDWriteFactory::CreateGlyphRunAnalysis (dwrite.h)
Creates a glyph run analysis object, which encapsulates information used to render a glyph run. (IDWriteFactory.CreateGlyphRunAnalysis)
CreateGlyphRunAnalysis
CreateGlyphRunAnalysis method [Direct Write]
CreateGlyphRunAnalysis method [Direct Write]
IDWriteFactory interface
IDWriteFactory interface [Direct Write]
CreateGlyphRunAnalysis method
IDWriteFactory.CreateGlyphRunAnalysis
IDWriteFactory::CreateGlyphRunAnalysis
directwrite.IDWriteFactory_CreateGlyphRunAnalysis
dwrite/IDWriteFactory::CreateGlyphRunAnalysis
directwrite\IDWriteFactory_CreateGlyphRunAnalysis.htm
DirectWrite
fcc6fe70-84ef-43ac-82ff-3f09d977220f
12/05/2018
CreateGlyphRunAnalysis, CreateGlyphRunAnalysis method [Direct Write], CreateGlyphRunAnalysis method [Direct Write],IDWriteFactory interface, IDWriteFactory interface [Direct Write],CreateGlyphRunAnalysis method, IDWriteFactory.CreateGlyphRunAnalysis, IDWriteFactory::CreateGlyphRunAnalysis, directwrite.IDWriteFactory_CreateGlyphRunAnalysis, dwrite/IDWriteFactory::CreateGlyphRunAnalysis
dwrite.h
Windows
Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps \| UWP apps]
Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps \| UWP apps]
Dwrite.lib
Dwrite.dll
Windows
19H1
IDWriteFactory::CreateGlyphRunAnalysis
dwrite/IDWriteFactory::CreateGlyphRunAnalysis
c++
APIRef
kbSyntax
COM
dwrite.dll
IDWriteFactory.CreateGlyphRunAnalysis

IDWriteFactory::CreateGlyphRunAnalysis

-description

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

-parameters

-param glyphRun [in]

Type: const DWRITE_GLYPH_RUN*

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

-param 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.

-param 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.

-param 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).

-param measuringMode

Type: DWRITE_MEASURING_MODE

Specifies the measuring mode to use with glyphs.

-param baselineOriginX

Type: FLOAT

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

-param baselineOriginY

Type: FLOAT

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

-param glyphRunAnalysis [out]

Type: IDWriteGlyphRunAnalysis**

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

-returns

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;
}

-see-also

IDWriteFactory