Freigeben über


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;

Parameter

  • glyphRun [in]
    A structure that contains the properties of the glyph run (font face, advances, and so on).

  • pixelsPerDip
    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]
    Optional transform applied to the glyphs and their positions. This transform is applied after the scaling specified the emSize and pixelsPerDip.

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

  • measuringMode
    Specifies the measuring mode to use with glyphs.

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

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

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

Rückgabewert

Ist Methode erfolgreich, wird "S_OK" zurückgegeben. Andernfalls wird ein HRESULT-Fehlercode zurückgegeben.

Hinweise

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.

Beispiele

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

Anforderungen

Mindestens unterstützter Client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista

Mindestens unterstützter Server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008

Header

Dwrite.h

Bibliothek

Dwrite.lib

DLL

Dwrite.dll

Siehe auch

IDWriteFactory