Class FontFace4
- Namespace
- SharpDX.DirectWrite
- Assembly
- SharpDX.Direct2D1.dll
[Guid("27F2A904-4EB8-441D-9678-0563F53E3E2F")]
public class FontFace4 : FontFace3
- Inheritance
-
FontFace4
- Inherited Members
Constructors
FontFace4(nint)
public FontFace4(nint nativePtr)
Parameters
nativePtr
nint
Methods
GetGlyphImageData(short, int, GlyphImageFormatS, out GlyphImageData, out nint)
Gets a reference to the glyph data based on the desired image format.
public void GetGlyphImageData(short glyphId, int pixelsPerEm, GlyphImageFormatS glyphImageFormat, out GlyphImageData glyphData, out nint glyphDataContext)
Parameters
glyphId
shortThe ID of the glyph to retrieve image data for.
pixelsPerEm
intRequested pixels per em.
glyphImageFormat
GlyphImageFormatSSpecifies which formats are supported in the font.
glyphData
GlyphImageDataOn return contains data for a glyph.
glyphDataContext
nint
Remarks
The glyphDataContext must be released via ReleaseGlyphImageData when done if the data is not empty, similar to IDWriteFontFileStream::ReadFileFragment and IDWriteFontFileStream::ReleaseFileFragment. The data reference is valid so long as the FontFace exists and ReleaseGlyphImageData has not been called.
The DWRITE_GLYPH_IMAGE_DATA::uniqueDataId is valuable for caching purposes so that if the same resource is returned more than once, an existing resource can be quickly retrieved rather than needing to reparse or decompress the data.
The function only returns SVG or raster data - requesting TrueType/CFF/COLR data returns DWRITE_E_INVALIDARG. Those must be drawn via DrawGlyphRun or queried using GetGlyphOutline instead. Exactly one format may be requested or else the function returns DWRITE_E_INVALIDARG. If the glyph does not have that format, the call is not an error, but the function returns empty data.
GetGlyphImageFormats()
Gets the available image formats of a specific glyph and ppem.
public GlyphImageFormatS GetGlyphImageFormats()
Returns
- GlyphImageFormatS
If this method succeeds, it returns SharpDX.Result.Ok. Otherwise, it returns an SharpDX.Result error code.
Remarks
Glyphs often have at least TrueType or CFF outlines, but they may also have SVG outlines, or they may have only bitmaps with no TrueType/CFF outlines. Some image formats, notably the PNG/JPEG ones, are size specific and will return no match when there isn't an entry in that size range.
Glyph ids beyond the glyph count return DWRITE_GLYPH_IMAGE_FORMATS_NONE.
GetGlyphImageFormats(short, int, int, out GlyphImageFormatS)
Gets the available image formats of a specific glyph and ppem.
public void GetGlyphImageFormats(short glyphId, int pixelsPerEmFirst, int pixelsPerEmLast, out GlyphImageFormatS glyphImageFormats)
Parameters
glyphId
shortThe ID of the glyph.
pixelsPerEmFirst
intpixelsPerEmLast
intglyphImageFormats
GlyphImageFormatSSpecifies which formats are supported in the font.
Remarks
Glyphs often have at least TrueType or CFF outlines, but they may also have SVG outlines, or they may have only bitmaps with no TrueType/CFF outlines. Some image formats, notably the PNG/JPEG ones, are size specific and will return no match when there isn't an entry in that size range.
Glyph ids beyond the glyph count return DWRITE_GLYPH_IMAGE_FORMATS_NONE.
ReleaseGlyphImageData(nint)
Releases the table data obtained from ReadGlyphData.
public void ReleaseGlyphImageData(nint glyphDataContext)
Parameters
glyphDataContext
nintOpaque context from ReadGlyphData.
Operators
explicit operator FontFace4(nint)
public static explicit operator FontFace4(nint nativePtr)
Parameters
nativePtr
nint