IDWriteFontFace1

<summary> The interface that represents an absolute reference to a font face. It contains font face type, appropriate file references and face identification data. Various font data such as metrics, names and glyph outlines is obtained from IDWriteFontFace. </summary>

Members

Functions

GetCaretMetrics
void GetCaretMetrics(DWRITE_CARET_METRICS* caretMetrics)

<summary> Gets caret metrics for the font in design units. These are used by text editors for drawing the correct caret placement/slant. </summary> <param name="caretMetrics">Metrics structure to fill in.</param>

GetDesignGlyphAdvances
HRESULT GetDesignGlyphAdvances(UINT32 glyphCount, const(UINT16)* glyphIndices, INT32* glyphAdvances, BOOL isSideways = FALSE)

<summary> Returns the advances in design units for a sequences of glyphs. </summary> <param name="glyphCount">Number of glyphs to retrieve advances for.</param> <param name="glyphIndices">Array of glyph id's to retrieve advances for.</param> <param name="glyphAdvances">Returned advances in font design units for each glyph.</param> <param name="isSideways">Retrieve the glyph's vertical advance height rather than horizontal advance widths.</param> <remarks> This is equivalent to calling GetGlyphMetrics and using only the advance width/height. </remarks> <returns> Standard HRESULT error code. </returns>

GetGdiCompatibleGlyphAdvances
HRESULT GetGdiCompatibleGlyphAdvances(FLOAT emSize, FLOAT pixelsPerDip, const(DWRITE_MATRIX)* transform, BOOL useGdiNatural, BOOL isSideways, UINT32 glyphCount, const(UINT16)* glyphIndices, INT32* glyphAdvances)

<summary> Returns the pixel-aligned advances for a sequences of glyphs, the same as GetGdiCompatibleGlyphMetrics would return. </summary> <param name="emSize">Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch.</param> <param name="pixelsPerDip">Number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96 this value is 1.0f. If the DPI is 120, this value is 120.0f/96.</param> <param name="transform">Optional transform applied to the glyphs and their positions. This transform is applied after the scaling specified by the font size and pixelsPerDip.</param> <param name="useGdiNatural">When FALSE, the metrics are the same as GDI aliased text (DWRITE_MEASURING_MODE_GDI_CLASSIC). When TRUE, the metrics are the same as those measured by GDI using a font using CLEARTYPE_NATURAL_QUALITY (DWRITE_MEASURING_MODE_GDI_NATURAL).</param> <param name="isSideways">Retrieve the glyph's vertical advances rather than horizontal advances.</param> <param name="glyphCount">Total glyphs to retrieve adjustments for.</param> <param name="glyphIndices">Array of glyph id's to retrieve advances.</param> <param name="glyphAdvances">Returned advances in font design units for each glyph.</param> <remarks> This is equivalent to calling GetGdiCompatibleGlyphMetrics and using only the advance width/height. Like GetGdiCompatibleGlyphMetrics, these are in design units, meaning they must be scaled down by

GetGdiCompatibleMetrics
HRESULT GetGdiCompatibleMetrics(FLOAT emSize, FLOAT pixelsPerDip, const(DWRITE_MATRIX)* transform, DWRITE_FONT_METRICS1* fontMetrics)

<summary> Gets common metrics for the font in design units. These metrics are applicable to all the glyphs within a font, and are used by applications for layout calculations. </summary> <param name="emSize">Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch.</param> <param name="pixelsPerDip">Number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96 this value is 1.0f. If the DPI is 120, this value is 120.0f/96.</param> <param name="transform">Optional transform applied to the glyphs and their positions. This transform is applied after the scaling specified by the font size and pixelsPerDip.</param> <param name="fontMetrics">Font metrics structure to fill in.</param> <returns> Standard HRESULT error code. </returns>

GetKerningPairAdjustments
HRESULT GetKerningPairAdjustments(UINT32 glyphCount, const(UINT16)* glyphIndices, INT32* glyphAdvanceAdjustments)

<summary> Retrieves the kerning pair adjustments from the font's kern table. </summary> <param name="glyphCount">Number of glyphs to retrieve adjustments for.</param> <param name="glyphIndices">Array of glyph id's to retrieve adjustments for.</param> <param name="glyphAdvanceAdjustments">Returned advances in font design units for each glyph. The last glyph adjustment is zero.</param> <remarks> This is not a direct replacement for GDI's character based GetKerningPairs, but it serves the same role, without the client needing to cache them locally. It also uses glyph id's directly rather than UCS-2 characters (how the kern table actually stores them) which avoids glyph collapse and ambiguity, such as the dash and hyphen, or space and non-breaking space. </remarks> <remarks> Newer fonts may have only GPOS kerning instead of the legacy pair table kerning. Such fonts, like Gabriola, will only return 0's for adjustments. This function does not virtualize and flatten these GPOS entries into kerning pairs. </remarks> <returns> Standard HRESULT error code. </returns>

GetMetrics
void GetMetrics(DWRITE_FONT_METRICS1* fontMetrics)

<summary> Gets common metrics for the font in design units. These metrics are applicable to all the glyphs within a font, and are used by applications for layout calculations. </summary> <param name="fontMetrics">Metrics structure to fill in.</param>

GetRecommendedRenderingMode
HRESULT GetRecommendedRenderingMode(FLOAT fontEmSize, FLOAT dpiX, FLOAT dpiY, const(DWRITE_MATRIX)* transform, BOOL isSideways, DWRITE_OUTLINE_THRESHOLD outlineThreshold, DWRITE_MEASURING_MODE measuringMode, DWRITE_RENDERING_MODE* renderingMode)

<summary> Determines the recommended text rendering mode to be used based on the font, size, world transform, and measuring mode. </summary> <param name="fontEmSize">Logical font size in DIPs.</param> <param name="dpiX">Number of pixels per logical inch in the horizontal direction.</param> <param name="dpiY">Number of pixels per logical inch in the vertical direction.</param> <param name="transform">Specifies the world transform.</param> <param name="outlineThreshold">Specifies the quality of the graphics system's outline rendering, affects the size threshold above which outline rendering is used.</param> <param name="measuringMode">Specifies the method used to measure during text layout. For proper glyph spacing, the function returns a rendering mode that is compatible with the specified measuring mode.</param> <param name="renderingMode">Receives the recommended rendering mode.</param> <remarks> This method should be used to determine the actual rendering mode in cases where the rendering mode of the rendering params object is DWRITE_RENDERING_MODE_DEFAULT. </remarks> <returns> Standard HRESULT error code. </returns>

GetUnicodeRanges
HRESULT GetUnicodeRanges(UINT32 maxRangeCount, DWRITE_UNICODE_RANGE* unicodeRanges, UINT32* actualRangeCount)

<summary> Returns the list of character ranges supported by the font, which is useful for scenarios like character picking, glyph display, and efficient font selection lookup. This is similar to GDI's GetFontUnicodeRanges, except that it returns the full Unicode range, not just 16-bit UCS-2. </summary> <param name="maxRangeCount">Maximum number of character ranges passed in from the client.</param> <param name="unicodeRanges">Array of character ranges.</param> <param name="actualRangeCount">Actual number of character ranges, regardless of the maximum count.</param> <remarks> These ranges are from the cmap, not the OS/2::ulCodePageRange1. </remarks> <returns> Standard HRESULT error code. </returns>

GetVerticalGlyphVariants
HRESULT GetVerticalGlyphVariants(UINT32 glyphCount, const(UINT16)* nominalGlyphIndices, UINT16* verticalGlyphIndices)

<summary> Retrieves the vertical forms of the nominal glyphs retrieved from GetGlyphIndices, using the font's 'vert' table. This is used in CJK vertical layout so the correct characters are shown. </summary> <param name="glyphCount">Number of glyphs to retrieve.</param> <param name="nominalGlyphIndices">Original glyph indices from cmap.</param> <param name="verticalGlyphIndices">The vertical form of glyph indices.</param> <remarks> Call GetGlyphIndices to get the nominal glyph indices, followed by calling this to remap the to the substituted forms, when the run is sideways, and the font has vertical glyph variants. </remarks> <returns> Standard HRESULT error code. </returns>

HasKerningPairs
BOOL HasKerningPairs()

<summary> Returns whether or not the font supports pair-kerning. </summary> <remarks> If the font does not support pair table kerning, there is no need to call GetKerningPairAdjustments (it would be all zeroes). </remarks> <returns> Whether the font supports kerning pairs. </returns>

HasVerticalGlyphVariants
BOOL HasVerticalGlyphVariants()

<summary> Returns whether or not the font has any vertical glyph variants. </summary> <remarks> For OpenType fonts, this will return true if the font contains a 'vert' feature. </remarks> <returns> True if the font contains vertical glyph variants. </returns>

IsMonospacedFont
BOOL IsMonospacedFont()

<summary> Returns true if the font is monospaced, meaning its characters are the same fixed-pitch width (non-proportional). </summary>

Inherited Members

From IDWriteFontFace

GetType
DWRITE_FONT_FACE_TYPE GetType()

<summary> Obtains the file format type of a font face. </summary>

GetFiles
HRESULT GetFiles(UINT32* numberOfFiles, IDWriteFontFile* fontFiles)

<summary> Obtains the font files representing a font face. </summary> <param name="numberOfFiles">The number of files representing the font face.</param> <param name="fontFiles">User provided array that stores pointers to font files representing the font face. This parameter can be NULL if the user is only interested in the number of files representing the font face. This API increments reference count of the font file pointers returned according to COM conventions, and the client should release them when finished.</param> <returns> Standard HRESULT error code. </returns>

GetIndex
UINT32 GetIndex()

<summary> Obtains the zero-based index of the font face in its font file or files. If the font files contain a single face, the return value is zero. </summary>

GetSimulations
DWRITE_FONT_SIMULATIONS GetSimulations()

<summary> Obtains the algorithmic style simulation flags of a font face. </summary>

IsSymbolFont
BOOL IsSymbolFont()

<summary> Determines whether the font is a symbol font. </summary>

GetMetrics
void GetMetrics(DWRITE_FONT_METRICS* fontFaceMetrics)

<summary> Obtains design units and common metrics for the font face. These metrics are applicable to all the glyphs within a fontface and are used by applications for layout calculations. </summary> <param name="fontFaceMetrics">Points to a DWRITE_FONT_METRICS structure to fill in. The metrics returned by this function are in font design units.</param>

GetGlyphCount
UINT16 GetGlyphCount()

<summary> Obtains the number of glyphs in the font face. </summary>

GetDesignGlyphMetrics
HRESULT GetDesignGlyphMetrics(const(UINT16)* glyphIndices, UINT32 glyphCount, DWRITE_GLYPH_METRICS* glyphMetrics, BOOL isSideways = FALSE)

<summary> Obtains ideal glyph metrics in font design units. Design glyphs metrics are used for glyph positioning. </summary> <param name="glyphIndices">An array of glyph indices to compute the metrics for.</param> <param name="glyphCount">The number of elements in the glyphIndices array.</param> <param name="glyphMetrics">Array of DWRITE_GLYPH_METRICS structures filled by this function. The metrics returned by this function are in font design units.</param> <param name="isSideways">Indicates whether the font is being used in a sideways run. This can affect the glyph metrics if the font has oblique simulation because sideways oblique simulation differs from non-sideways oblique simulation.</param> <returns> Standard HRESULT error code. If any of the input glyph indices are outside of the valid glyph index range for the current font face, E_INVALIDARG will be returned. </returns>

GetGlyphIndices
HRESULT GetGlyphIndices(const(UINT32)* codePoints, UINT32 codePointCount, UINT16* glyphIndices)

<summary> Returns the nominal mapping of UTF-32 Unicode code points to glyph indices as defined by the font 'cmap' table. Note that this mapping is primarily provided for line layout engines built on top of the physical font API. Because of OpenType glyph substitution and line layout character substitution, the nominal conversion does not always correspond to how a Unicode string will map to glyph indices when rendering using a particular font face. Also, note that Unicode Variation Selectors provide for alternate mappings for character to glyph. This call will always return the default variant. </summary> <param name="codePoints">An array of UTF-32 code points to obtain nominal glyph indices from.</param> <param name="codePointCount">The number of elements in the codePoints array.</param> <param name="glyphIndices">Array of nominal glyph indices filled by this function.</param> <returns> Standard HRESULT error code. </returns>

TryGetFontTable
HRESULT TryGetFontTable(UINT32 openTypeTableTag, const(void**) tableData, UINT32* tableSize, void** tableContext, BOOL* exists)

<summary> Finds the specified OpenType font table if it exists and returns a pointer to it. The function accesses the underlying font data via the IDWriteFontFileStream interface implemented by the font file loader. </summary> <param name="openTypeTableTag">Four character tag of table to find. Use the DWRITE_MAKE_OPENTYPE_TAG() macro to create it. Unlike GDI, it does not support the special TTCF and null tags to access the whole font.</param> <param name="tableData"> Pointer to base of table in memory. The pointer is only valid so long as the FontFace used to get the font table still exists (not any other FontFace, even if it actually refers to the same physical font). </param> <param name="tableSize">Byte size of table.</param> <param name="tableContext"> Opaque context which must be freed by calling ReleaseFontTable. The context actually comes from the lower level IDWriteFontFileStream, which may be implemented by the application or DWrite itself. It is possible for a NULL tableContext to be returned, especially if the implementation directly memory maps the whole file. Nevertheless, always release it later, and do not use it as a test for function success. The same table can be queried multiple times, but each returned context can be different, so release each separately. </param> <param name="exists">True if table exists.</param> <returns> Standard HRESULT error code. If a table can not be found, the function will not return an error, but the size will be 0, table NULL, and exists = FALSE. The context does not need to be freed if the table was not found. </returns> <remarks> The context for the same tag may be different for each call, so each one must be held and released separately. </remarks>

ReleaseFontTable
void ReleaseFontTable(void* tableContext)

<summary> Releases the table obtained earlier from TryGetFontTable. </summary> <param name="tableContext">Opaque context from TryGetFontTable.</param>

GetGlyphRunOutline
HRESULT GetGlyphRunOutline(FLOAT emSize, const(UINT16)* glyphIndices, const(FLOAT)* glyphAdvances, const(DWRITE_GLYPH_OFFSET)* glyphOffsets, UINT32 glyphCount, BOOL isSideways, BOOL isRightToLeft, IDWriteGeometrySink geometrySink)

<summary> Computes the outline of a run of glyphs by calling back to the outline sink interface. </summary> <param name="emSize">Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch.</param> <param name="glyphIndices">Array of glyph indices.</param> <param name="glyphAdvances">Optional array of glyph advances in DIPs.</param> <param name="glyphOffsets">Optional array of glyph offsets.</param> <param name="glyphCount">Number of glyphs.</param> <param name="isSideways">If true, specifies that glyphs are rotated 90 degrees to the left and vertical metrics are used. A client can render a vertical run by specifying isSideways = true and rotating the resulting geometry 90 degrees to the right using a transform.</param> <param name="isRightToLeft">If true, specifies that the advance direction is right to left. By default, the advance direction is left to right.</param> <param name="geometrySink">Interface the function calls back to draw each element of the geometry.</param> <returns> Standard HRESULT error code. </returns>

GetRecommendedRenderingMode
HRESULT GetRecommendedRenderingMode(FLOAT emSize, FLOAT pixelsPerDip, DWRITE_MEASURING_MODE measuringMode, IDWriteRenderingParams renderingParams, DWRITE_RENDERING_MODE* renderingMode)

<summary> Determines the recommended rendering mode for the font given the specified size and rendering parameters. </summary> <param name="emSize">Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch.</param> <param name="pixelsPerDip">Number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96 this value is 1.0f. If the DPI is 120, this value is 120.0f/96.</param> <param name="measuringMode">Specifies measuring mode that will be used for glyphs in the font. Renderer implementations may choose different rendering modes for given measuring modes, but best results are seen when the corresponding modes match: DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL for DWRITE_MEASURING_MODE_NATURAL DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC for DWRITE_MEASURING_MODE_GDI_CLASSIC DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL for DWRITE_MEASURING_MODE_GDI_NATURAL </param> <param name="renderingParams">Rendering parameters object. This parameter is necessary in case the rendering parameters object overrides the rendering mode.</param> <param name="renderingMode">Receives the recommended rendering mode to use.</param> <returns> Standard HRESULT error code. </returns>

GetGdiCompatibleMetrics
HRESULT GetGdiCompatibleMetrics(FLOAT emSize, FLOAT pixelsPerDip, const(DWRITE_MATRIX)* transform, DWRITE_FONT_METRICS* fontFaceMetrics)

<summary> Obtains design units and common metrics for the font face. These metrics are applicable to all the glyphs within a fontface and are used by applications for layout calculations. </summary> <param name="emSize">Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch.</param> <param name="pixelsPerDip">Number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96 this value is 1.0f. If the DPI is 120, this value is 120.0f/96.</param> <param name="transform">Optional transform applied to the glyphs and their positions. This transform is applied after the scaling specified by the font size and pixelsPerDip.</param> <param name="fontFaceMetrics">Points to a DWRITE_FONT_METRICS structure to fill in. The metrics returned by this function are in font design units.</param>

GetGdiCompatibleGlyphMetrics
HRESULT GetGdiCompatibleGlyphMetrics(FLOAT emSize, FLOAT pixelsPerDip, const(DWRITE_MATRIX)* transform, BOOL useGdiNatural, const(UINT16)* glyphIndices, UINT32 glyphCount, DWRITE_GLYPH_METRICS* glyphMetrics, BOOL isSideways = FALSE)

<summary> Obtains glyph metrics in font design units with the return values compatible with what GDI would produce. Glyphs metrics are used for positioning of individual glyphs. </summary> <param name="emSize">Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch.</param> <param name="pixelsPerDip">Number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96 this value is 1.0f. If the DPI is 120, this value is 120.0f/96.</param> <param name="transform">Optional transform applied to the glyphs and their positions. This transform is applied after the scaling specified by the font size and pixelsPerDip.</param> <param name="useGdiNatural"> When set to FALSE, the metrics are the same as the metrics of GDI aliased text. When set to TRUE, the metrics are the same as the metrics of text measured by GDI using a font created with CLEARTYPE_NATURAL_QUALITY. </param> <param name="glyphIndices">An array of glyph indices to compute the metrics for.</param> <param name="glyphCount">The number of elements in the glyphIndices array.</param> <param name="glyphMetrics">Array of DWRITE_GLYPH_METRICS structures filled by this function. The metrics returned by this function are in font design units.</param> <param name="isSideways">Indicates whether the font is being used in a sideways run. This can affect the glyph metrics if the font has oblique simulation because sideways oblique simulation differs from non-sideways oblique simulation.</param> <returns> Standard HRESULT error code. If any of the input glyph indices are outside of the valid glyph index range for the current font face, E_INVALIDARG will be returned. </returns>

Meta