IDWriteTextAnalyzer1::GetJustifiedGlyphs method (dwrite_1.h)

Fills in new glyphs for complex scripts where justification increased the advances of glyphs, such as Arabic with kashida.

Syntax

HRESULT GetJustifiedGlyphs(
                  IDWriteFontFace                       *fontFace,
                  FLOAT                                 fontEmSize,
                  DWRITE_SCRIPT_ANALYSIS                scriptAnalysis,
                  UINT32                                textLength,
                  UINT32                                glyphCount,
                  UINT32                                maxGlyphCount,
  [in, optional]  UINT16 const                          *clusterMap,
  [in]            UINT16 const                          *glyphIndices,
  [in]            FLOAT const                           *glyphAdvances,
  [in]            FLOAT const                           *justifiedGlyphAdvances,
  [in]            DWRITE_GLYPH_OFFSET const             *justifiedGlyphOffsets,
  [in]            DWRITE_SHAPING_GLYPH_PROPERTIES const *glyphProperties,
  [out]           UINT32                                *actualGlyphCount,
  [out, optional] UINT16                                *modifiedClusterMap,
  [out]           UINT16                                *modifiedGlyphIndices,
  [out]           FLOAT                                 *modifiedGlyphAdvances,
  [out]           DWRITE_GLYPH_OFFSET                   *modifiedGlyphOffsets
);

Parameters

fontFace

Type: IDWriteFontFace*

Font face used for shaping.

May be NULL.

fontEmSize

Type: FLOAT

Font em size used for the glyph run.

scriptAnalysis

Type: DWRITE_SCRIPT_ANALYSIS

Script of the text from the itemizer.

textLength

Type: UINT32

Length of the text.

glyphCount

Type: UINT32

Number of glyphs.

maxGlyphCount

Type: UINT32

Maximum number of output glyphs allocated by caller.

[in, optional] clusterMap

Type: const UINT16*

Clustermap produced from shaping.

[in] glyphIndices

Type: const UINT16*

Original glyphs produced from shaping.

[in] glyphAdvances

Type: const FLOAT*

Original glyph advances produced from shaping.

[in] justifiedGlyphAdvances

Type: const FLOAT*

Justified glyph advances from IDWriteTextAnalyzer1::JustifyGlyphAdvances.

[in] justifiedGlyphOffsets

Type: const DWRITE_GLYPH_OFFSET*

Justified glyph offsets from IDWriteTextAnalyzer1::JustifyGlyphAdvances.

[in] glyphProperties

Type: const DWRITE_SHAPING_GLYPH_PROPERTIES*

Properties of each glyph, from IDWriteTextAnalyzer::GetGlyphs.

[out] actualGlyphCount

Type: UINT32*

The new glyph count written to the modified arrays, or the needed glyph count if the size is not large enough.

[out, optional] modifiedClusterMap

Type: UINT16*

Updated clustermap.

[out] modifiedGlyphIndices

Type: UINT16*

Updated glyphs with new glyphs inserted where needed.

[out] modifiedGlyphAdvances

Type: FLOAT*

Updated glyph advances.

[out] modifiedGlyphOffsets

Type: DWRITE_GLYPH_OFFSET*

Updated glyph offsets.

Return value

Type: HRESULT

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

Remarks

You call GetJustifiedGlyphs after the line has been justified, and it is per-run.

You should call GetJustifiedGlyphs if IDWriteTextAnalyzer1::GetScriptProperties returns a non-null DWRITE_SCRIPT_PROPERTIES.justificationCharacter for that script.

Use GetJustifiedGlyphs mainly for cursive scripts like Arabic. If maxGlyphCount is not large enough, GetJustifiedGlyphs returns the error E_NOT_SUFFICIENT_BUFFER and fills the variable to which actualGlyphCount points with the needed glyph count.

Requirements

Requirement Value
Minimum supported client Windows 8 and Platform Update for Windows 7 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 and Platform Update for Windows Server 2008 R2 [desktop apps | UWP apps]
Target Platform Windows
Header dwrite_1.h
Library Dwrite.lib
DLL Dwrite.dll

See also

IDWriteTextAnalyzer1

IDWriteTextAnalyzer1::GetScriptProperties

IDWriteTextAnalyzer1::JustifyGlyphAdvances

IDWriteTextAnalyzer::GetGlyphs