Represents an absolute reference to a font face which contains font face type, appropriate file references, face identification data and various font data such as metrics, names and glyph outlines.
Members
The IDWriteFontFace interface inherits from the IUnknown interface. IDWriteFontFace also has these types of members:
Methods
The IDWriteFontFace interface has these methods.
| Method | Description |
|---|---|
| GetDesignGlyphMetrics |
Obtains ideal (resolution-independent) glyph metrics in font design units. |
| GetFiles |
Obtains the font files representing a font face. |
| GetGdiCompatibleGlyphMetrics |
Obtains glyph metrics in font design units with the return values compatible with what GDI would produce. |
| GetGdiCompatibleMetrics |
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. |
| GetGlyphCount |
Obtains the number of glyphs in the font face. |
| GetGlyphIndices |
Returns the nominal mapping of UCS4 Unicode code points to glyph indices as defined by the font 'CMAP' table. |
| GetGlyphRunOutline |
Computes the outline of a run of glyphs by calling back to the outline sink interface. |
| GetIndex |
Obtains the index of a font face in the context of its font files. |
| GetMetrics |
Obtains design units and common metrics for the font face. These metrics are applicable to all the glyphs within a font face and are used by applications for layout calculations. |
| GetRecommendedRenderingMode |
Determines the recommended rendering mode for the font, using the specified size and rendering parameters. |
| GetSimulations |
Obtains the algorithmic style simulation flags of a font face. |
| GetType |
Obtains the file format type of a font face. |
| IsSymbolFont |
Determines whether the font is a symbol font. |
| ReleaseFontTable |
Releases the table obtained earlier from TryGetFontTable. |
| TryGetFontTable |
Finds the specified OpenType font table if it exists and returns a pointer to it. The function accesses the underlying font data through the IDWriteFontFileStream interface implemented by the font file loader. |
Examples
The following code example demonstrates creating a font face from a font file's file name.
HRESULT CreateFontFaceFromFontFile(wchar_t* filename, IDWriteFontFace **ppFontFace) { HRESULT hr = S_OK; IDWriteFactory* pDWriteFactory = NULL; IDWriteFontFace* pFontFace = NULL; IDWriteFontFile* pFontFiles = NULL; // Create the DirectWrite factory. hr = DWriteCreateFactory( DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), reinterpret_cast<IUnknown**>(&pDWriteFactory) ); // Gets a filename from a application directory UINT curDirLength = GetCurrentDirectory( MAX_PATH, fontFolderPath ); if (curDirLength == 0) { return E_UNEXPECTED; } if (SUCCEEDED(hr)) { hr = StringCchCatW( fontFolderPath, MAX_PATH, L"\\" ); } if (SUCCEEDED(hr)) { hr = StringCchCatW( fontFolderPath, MAX_PATH, (STRSAFE_LPCWSTR)filename ); if (SUCCEEDED(hr)) { hr = pDWriteFactory->CreateFontFileReference( fontFolderPath, NULL, &pFontFiles); } IDWriteFontFile* fontFileArray[] = {pFontFiles}; if (SUCCEEDED(hr)) { hr = pDWriteFactory->CreateFontFace( DWRITE_FONT_FACE_TYPE_TRUETYPE, 1, // file count fontFileArray, 0, DWRITE_FONT_SIMULATIONS_NONE, &pFontFace ); } //Return the pointer to the caller *ppFontFace = pFontFace; SafeRelease(&pDWriteFactory); SafeRelease(&pFontFiles); return hr; }
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] |
|
Header |
|
|
Library |
|
|
DLL |
|
Send comments about this topic to Microsoft
Build date: 11/22/2012