//+-------------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // Abstract: // DirectX Typography Services public API definitions. // //---------------------------------------------------------------------------- #ifndef DWRITE_2_H_INCLUDED #define DWRITE_2_H_INCLUDED #if _MSC_VER > 1000 #pragma once #endif #include interface IDWriteFontFallback; /// /// How to align glyphs to the margin. /// enum DWRITE_OPTICAL_ALIGNMENT { /// /// Align to the default metrics of the glyph. /// DWRITE_OPTICAL_ALIGNMENT_NONE, /// /// Align glyphs to the margins. Without this, some small whitespace /// may be present between the text and the margin from the glyph's side /// bearing values. Note that glyphs may still overhang outside the /// margin, such as flourishes or italic slants. /// DWRITE_OPTICAL_ALIGNMENT_NO_SIDE_BEARINGS, }; /// /// Whether to enable grid-fitting of glyph outlines (a.k.a. hinting). /// enum DWRITE_GRID_FIT_MODE { /// /// Choose grid fitting base on the font's gasp table information. /// DWRITE_GRID_FIT_MODE_DEFAULT, /// /// Always disable grid fitting, using the ideal glyph outlines. /// DWRITE_GRID_FIT_MODE_DISABLED, /// /// Enable grid fitting, adjusting glyph outlines for device pixel display. /// DWRITE_GRID_FIT_MODE_ENABLED }; /// /// Overall metrics associated with text after layout. /// All coordinates are in device independent pixels (DIPs). /// struct DWRITE_TEXT_METRICS1 : DWRITE_TEXT_METRICS { /// /// The height of the formatted text taking into account the /// trailing whitespace at the end of each line, which will /// matter for vertical reading directions. /// FLOAT heightIncludingTrailingWhitespace; }; /// /// The text renderer interface represents a set of application-defined /// callbacks that perform rendering of text, inline objects, and decorations /// such as underlines. /// interface DWRITE_DECLARE_INTERFACE("D3E0E934-22A0-427E-AAE4-7D9574B59DB1") IDWriteTextRenderer1 : public IDWriteTextRenderer { /// /// IDWriteTextLayout::Draw calls this function to instruct the client to /// render a run of glyphs. /// /// The context passed to /// IDWriteTextLayout::Draw. /// X-coordinate of the baseline. /// Y-coordinate of the baseline. /// Orientation of the glyph run. /// Specifies measuring method for glyphs in /// the run. Renderer implementations may choose different rendering /// modes for given measuring methods, but best results are seen when /// the rendering mode matches the corresponding measuring mode: /// 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 /// /// The glyph run to draw. /// Properties of the characters /// associated with this run. /// The drawing effect set in /// IDWriteTextLayout::SetDrawingEffect. /// /// Standard HRESULT error code. /// /// /// If a non-identity orientation is passed, the glyph run should be /// rotated around the given baseline x and y coordinates. The function /// IDWriteAnalyzer2::GetGlyphOrientationTransform will return the /// necessary transform for you, which can be combined with any existing /// world transform on the drawing context. /// STDMETHOD(DrawGlyphRun)( _In_opt_ void* clientDrawingContext, FLOAT baselineOriginX, FLOAT baselineOriginY, DWRITE_GLYPH_ORIENTATION_ANGLE orientationAngle, DWRITE_MEASURING_MODE measuringMode, _In_ DWRITE_GLYPH_RUN const* glyphRun, _In_ DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription, _In_opt_ IUnknown* clientDrawingEffect ) PURE; /// /// IDWriteTextLayout::Draw calls this function to instruct the client to draw /// an underline. /// /// The context passed to /// IDWriteTextLayout::Draw. /// X-coordinate of the baseline. /// Y-coordinate of the baseline. /// Orientation of the underline. /// Underline logical information. /// The drawing effect set in /// IDWriteTextLayout::SetDrawingEffect. /// /// Standard HRESULT error code. /// /// /// A single underline can be broken into multiple calls, depending on /// how the formatting changes attributes. If font sizes/styles change /// within an underline, the thickness and offset will be averaged /// weighted according to characters. /// /// To get the correct top coordinate of the underline rect, add /// underline::offset to the baseline's Y. Otherwise the underline will /// be immediately under the text. The x coordinate will always be passed /// as the left side, regardless of text directionality. This simplifies /// drawing and reduces the problem of round-off that could potentially /// cause gaps or a double stamped alpha blend. To avoid alpha overlap, /// round the end points to the nearest device pixel. /// STDMETHOD(DrawUnderline)( _In_opt_ void* clientDrawingContext, FLOAT baselineOriginX, FLOAT baselineOriginY, DWRITE_GLYPH_ORIENTATION_ANGLE orientationAngle, _In_ DWRITE_UNDERLINE const* underline, _In_opt_ IUnknown* clientDrawingEffect ) PURE; /// /// IDWriteTextLayout::Draw calls this function to instruct the client to draw /// a strikethrough. /// /// The context passed to /// IDWriteTextLayout::Draw. /// X-coordinate of the baseline. /// Y-coordinate of the baseline. /// Orientation of the strikethrough. /// Strikethrough logical information. /// The drawing effect set in /// IDWriteTextLayout::SetDrawingEffect. /// /// Standard HRESULT error code. /// /// /// A single strikethrough can be broken into multiple calls, depending on /// how the formatting changes attributes. Strikethrough is not averaged /// across font sizes/styles changes. /// To get the correct top coordinate of the strikethrough rect, /// add strikethrough::offset to the baseline's Y. /// Like underlines, the x coordinate will always be passed as the left side, /// regardless of text directionality. /// STDMETHOD(DrawStrikethrough)( _In_opt_ void* clientDrawingContext, FLOAT baselineOriginX, FLOAT baselineOriginY, DWRITE_GLYPH_ORIENTATION_ANGLE orientationAngle, _In_ DWRITE_STRIKETHROUGH const* strikethrough, _In_opt_ IUnknown* clientDrawingEffect ) PURE; /// /// IDWriteTextLayout::Draw calls this application callback when it needs to /// draw an inline object. /// /// The context passed to /// IDWriteTextLayout::Draw. /// X-coordinate at the top-left corner of the /// inline object. /// Y-coordinate at the top-left corner of the /// inline object. /// Orientation of the inline object. /// The object set using IDWriteTextLayout::SetInlineObject. /// The object should be drawn on its side. /// The object is in an right-to-left context /// and should be drawn flipped. /// The drawing effect set in /// IDWriteTextLayout::SetDrawingEffect. /// /// Standard HRESULT error code. /// /// /// The right-to-left flag is a hint to draw the appropriate visual for /// that reading direction. For example, it would look strange to draw an /// arrow pointing to the right to indicate a submenu. The sideways flag /// similarly hints that the object is drawn in a different orientation. /// If a non-identity orientation is passed, the top left of the inline /// object should be rotated around the given x and y coordinates. /// IDWriteAnalyzer2::GetGlyphOrientationTransform returns the necessary /// transform for this. /// STDMETHOD(DrawInlineObject)( _In_opt_ void* clientDrawingContext, FLOAT originX, FLOAT originY, DWRITE_GLYPH_ORIENTATION_ANGLE orientationAngle, _In_ IDWriteInlineObject* inlineObject, BOOL isSideways, BOOL isRightToLeft, _In_opt_ IUnknown* clientDrawingEffect ) PURE; }; /// /// The format of text used for text layout. /// /// /// This object may not be thread-safe and it may carry the state of text format change. /// interface DWRITE_DECLARE_INTERFACE("5F174B49-0D8B-4CFB-8BCA-F1CCE9D06C67") IDWriteTextFormat1 : public IDWriteTextFormat { /// /// Set the preferred orientation of glyphs when using a vertical reading direction. /// /// Preferred glyph orientation. /// /// Standard HRESULT error code. /// STDMETHOD(SetVerticalGlyphOrientation)( DWRITE_VERTICAL_GLYPH_ORIENTATION glyphOrientation ) PURE; /// /// Get the preferred orientation of glyphs when using a vertical reading /// direction. /// STDMETHOD_(DWRITE_VERTICAL_GLYPH_ORIENTATION, GetVerticalGlyphOrientation)() PURE; /// /// Set whether or not the last word on the last line is wrapped. /// /// Line wrapping option. /// /// Standard HRESULT error code. /// STDMETHOD(SetLastLineWrapping)( BOOL isLastLineWrappingEnabled ) PURE; /// /// Get whether or not the last word on the last line is wrapped. /// STDMETHOD_(BOOL, GetLastLineWrapping)() PURE; /// /// Set how the glyphs align to the edges the margin. Default behavior is /// to align glyphs using their default glyphs metrics which include side /// bearings. /// /// Optical alignment option. /// /// Standard HRESULT error code. /// STDMETHOD(SetOpticalAlignment)( DWRITE_OPTICAL_ALIGNMENT opticalAlignment ) PURE; /// /// Get how the glyphs align to the edges the margin. /// STDMETHOD_(DWRITE_OPTICAL_ALIGNMENT, GetOpticalAlignment)() PURE; /// /// Apply a custom font fallback onto layout. If none is specified, /// layout uses the system fallback list. /// /// Custom font fallback created from /// IDWriteFontFallbackBuilder::CreateFontFallback or from /// IDWriteFactory2::GetSystemFontFallback. /// /// Standard HRESULT error code. /// STDMETHOD(SetFontFallback)( IDWriteFontFallback* fontFallback ) PURE; /// /// Get the current font fallback object. /// STDMETHOD(GetFontFallback)( __out IDWriteFontFallback** fontFallback ) PURE; }; /// /// The text layout interface represents a block of text after it has /// been fully analyzed and formatted. /// /// All coordinates are in device independent pixels (DIPs). /// interface DWRITE_DECLARE_INTERFACE("1093C18F-8D5E-43F0-B064-0917311B525E") IDWriteTextLayout2 : public IDWriteTextLayout1 { /// /// GetMetrics retrieves overall metrics for the formatted string. /// /// The returned metrics. /// /// Standard HRESULT error code. /// /// /// Drawing effects like underline and strikethrough do not contribute /// to the text size, which is essentially the sum of advance widths and /// line heights. Additionally, visible swashes and other graphic /// adornments may extend outside the returned width and height. /// STDMETHOD(GetMetrics)( _Out_ DWRITE_TEXT_METRICS1* textMetrics ) PURE; using IDWriteTextLayout::GetMetrics; /// /// Set the preferred orientation of glyphs when using a vertical reading direction. /// /// Preferred glyph orientation. /// /// Standard HRESULT error code. /// STDMETHOD(SetVerticalGlyphOrientation)( DWRITE_VERTICAL_GLYPH_ORIENTATION glyphOrientation ) PURE; /// /// Get the preferred orientation of glyphs when using a vertical reading /// direction. /// STDMETHOD_(DWRITE_VERTICAL_GLYPH_ORIENTATION, GetVerticalGlyphOrientation)() PURE; /// /// Set whether or not the last word on the last line is wrapped. /// /// Line wrapping option. /// /// Standard HRESULT error code. /// STDMETHOD(SetLastLineWrapping)( BOOL isLastLineWrappingEnabled ) PURE; /// /// Get whether or not the last word on the last line is wrapped. /// STDMETHOD_(BOOL, GetLastLineWrapping)() PURE; /// /// Set how the glyphs align to the edges the margin. Default behavior is /// to align glyphs using their default glyphs metrics which include side /// bearings. /// /// Optical alignment option. /// /// Standard HRESULT error code. /// STDMETHOD(SetOpticalAlignment)( DWRITE_OPTICAL_ALIGNMENT opticalAlignment ) PURE; /// /// Get how the glyphs align to the edges the margin. /// STDMETHOD_(DWRITE_OPTICAL_ALIGNMENT, GetOpticalAlignment)() PURE; /// /// Apply a custom font fallback onto layout. If none is specified, /// layout uses the system fallback list. /// /// Custom font fallback created from /// IDWriteFontFallbackBuilder::CreateFontFallback or /// IDWriteFactory2::GetSystemFontFallback. /// /// Standard HRESULT error code. /// STDMETHOD(SetFontFallback)( IDWriteFontFallback* fontFallback ) PURE; /// /// Get the current font fallback object. /// STDMETHOD(GetFontFallback)( __out IDWriteFontFallback** fontFallback ) PURE; }; /// /// The text analyzer interface represents a set of application-defined /// callbacks that perform rendering of text, inline objects, and decorations /// such as underlines. /// interface DWRITE_DECLARE_INTERFACE("553A9FF3-5693-4DF7-B52B-74806F7F2EB9") IDWriteTextAnalyzer2 : public IDWriteTextAnalyzer1 { /// /// Returns 2x3 transform matrix for the respective angle to draw the /// glyph run or other object. /// /// The angle reported to one of the application callbacks, /// including IDWriteTextAnalysisSink1::SetGlyphOrientation and IDWriteTextRenderer1::Draw*. /// Whether the run's glyphs are sideways or not. /// X origin of the element, be it a glyph run or underline or other. /// Y origin of the element, be it a glyph run or underline or other. /// Returned transform. /// /// Standard HRESULT error code. /// /// /// This rotates around the given origin x and y, returning a translation component /// such that the glyph run, text decoration, or inline object is drawn with the /// right orientation at the expected coordinate. /// STDMETHOD(GetGlyphOrientationTransform)( DWRITE_GLYPH_ORIENTATION_ANGLE glyphOrientationAngle, BOOL isSideways, FLOAT originX, FLOAT originY, _Out_ DWRITE_MATRIX* transform ) PURE; /// /// Returns a list of typographic feature tags for the given script and language. /// /// The font face to get features from. /// Script analysis result from AnalyzeScript. /// The locale to use when selecting the feature, /// such en-us or ja-jp. /// Maximum tag count. /// Actual tag count. If greater than /// maxTagCount, E_NOT_SUFFICIENT_BUFFER is returned, and the call /// should be retried with a larger buffer. /// Feature tag list. /// /// Standard HRESULT error code. /// STDMETHOD(GetTypographicFeatures)( IDWriteFontFace* fontFace, DWRITE_SCRIPT_ANALYSIS scriptAnalysis, _In_opt_z_ WCHAR const* localeName, UINT32 maxTagCount, _Out_ UINT32* actualTagCount, _Out_writes_(maxTagCount) DWRITE_FONT_FEATURE_TAG* tags ) PURE; /// /// Returns an array of which glyphs are affected by a given feature. /// /// The font face to read glyph information from. /// Script analysis result from AnalyzeScript. /// The locale to use when selecting the feature, /// such en-us or ja-jp. /// OpenType feature name to use, which may be one /// of the DWRITE_FONT_FEATURE_TAG values or a custom feature using /// DWRITE_MAKE_OPENTYPE_TAG. /// Number of glyph indices to check. /// Glyph indices to check for feature application. /// Output of which glyphs are affected by the /// feature, where for each glyph affected, the respective array index /// will be 1. The result is returned per-glyph without regard to /// neighboring context of adjacent glyphs. /// /// /// Standard HRESULT error code. /// STDMETHOD(CheckTypographicFeature)( IDWriteFontFace* fontFace, DWRITE_SCRIPT_ANALYSIS scriptAnalysis, _In_opt_z_ WCHAR const* localeName, DWRITE_FONT_FEATURE_TAG featureTag, UINT32 glyphCount, _In_reads_(glyphCount) UINT16 const* glyphIndices, _Out_writes_(glyphCount) UINT8* featureApplies ) PURE; }; /// /// A font fallback definition used for mapping characters to fonts capable of /// supporting them. /// interface DWRITE_DECLARE_INTERFACE("EFA008F9-F7A1-48BF-B05C-F224713CC0FF") IDWriteFontFallback : public IUnknown { /// /// Determines an appropriate font to use to render the range of text. /// /// The text source implementation holds the text and /// locale. /// Length of the text to analyze. /// Default font collection to use. /// Base font to check (optional). /// Family name of the base font. If you pass /// null, no matching will be done against the family. /// Desired weight. /// Desired style. /// Desired stretch. /// Length of text mapped to the mapped font. /// This will always be less or equal to the input text length and /// greater than zero (if the text length is non-zero) so that the /// caller advances at least one character each call. /// The font that should be used to render the /// first mappedLength characters of the text. If it returns NULL, /// then no known font can render the text, and mappedLength is the /// number of unsupported characters to skip. /// Scale factor to multiply the em size of the /// returned font by. /// /// Standard HRESULT error code. /// STDMETHOD(MapCharacters)( IDWriteTextAnalysisSource* analysisSource, UINT32 textPosition, UINT32 textLength, _In_opt_ IDWriteFontCollection* baseFontCollection, _In_opt_z_ wchar_t const* baseFamilyName, DWRITE_FONT_WEIGHT baseWeight, DWRITE_FONT_STYLE baseStyle, DWRITE_FONT_STRETCH baseStretch, _Deref_out_range_(0, textLength) UINT32* mappedLength, _COM_Outptr_ IDWriteFont** mappedFont, _Out_ FLOAT* scale ) PURE; }; /// /// Builder used to create a font fallback definition by appending a series of /// fallback mappings, followed by a creation call. /// /// /// This object may not be thread-safe. /// interface DWRITE_DECLARE_INTERFACE("FD882D06-8ABA-4FB8-B849-8BE8B73E14DE") IDWriteFontFallbackBuilder : public IUnknown { /// /// Appends a single mapping to the list. Call this once for each additional mapping. /// /// Unicode ranges that apply to this mapping. /// Number of Unicode ranges. /// Locale of the context (e.g. document locale). /// Base family name to match against, if applicable. /// Explicit font collection for this mapping (optional). /// List of target family name strings. /// Number of target family names. /// Scale factor to multiply the result target font by. /// /// Standard HRESULT error code. /// STDMETHOD(AddMapping)( _In_reads_(rangesCount) DWRITE_UNICODE_RANGE const* ranges, UINT32 rangesCount, _In_reads_(targetFamilyNamesCount) WCHAR const** targetFamilyNames, UINT32 targetFamilyNamesCount, _In_opt_ IDWriteFontCollection* fontCollection = NULL, _In_opt_z_ WCHAR const* localeName = NULL, _In_opt_z_ WCHAR const* baseFamilyName = NULL, FLOAT scale = 1.0f ) PURE; /// /// Appends all the mappings from an existing font fallback object. /// /// Font fallback to read mappings from. /// /// Standard HRESULT error code. /// STDMETHOD(AddMappings)( IDWriteFontFallback* fontFallback ) PURE; /// /// Creates the finalized fallback object from the mappings added. /// /// Created fallback list. /// /// Standard HRESULT error code. /// STDMETHOD(CreateFontFallback)( _COM_Outptr_ IDWriteFontFallback** fontFallback ) PURE; }; /// /// DWRITE_COLOR_F /// #ifndef D3DCOLORVALUE_DEFINED typedef struct _D3DCOLORVALUE { union { FLOAT r; FLOAT dvR; }; union { FLOAT g; FLOAT dvG; }; union { FLOAT b; FLOAT dvB; }; union { FLOAT a; FLOAT dvA; }; } D3DCOLORVALUE; #define D3DCOLORVALUE_DEFINED #endif D3DCOLORVALUE_DEFINED typedef D3DCOLORVALUE DWRITE_COLOR_F; /// /// The IDWriteFont interface represents a physical font in a font collection. /// interface DWRITE_DECLARE_INTERFACE("29748ed6-8c9c-4a6a-be0b-d912e8538944") IDWriteFont2 : public IDWriteFont1 { /// /// Returns TRUE if the font contains color information (COLR and CPAL tables), /// or FALSE if not. /// STDMETHOD_(BOOL, IsColorFont)() PURE; }; /// /// 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. /// interface DWRITE_DECLARE_INTERFACE("d8b768ff-64bc-4e66-982b-ec8e87f693f7") IDWriteFontFace2 : public IDWriteFontFace1 { /// /// Returns TRUE if the font contains color information (COLR and CPAL tables), /// or FALSE if not. /// STDMETHOD_(BOOL, IsColorFont)() PURE; /// /// Returns the number of color palettes defined by the font. The return /// value is zero if the font has no color information. Color fonts must /// have at least one palette, with palette index zero being the default. /// STDMETHOD_(UINT32, GetColorPaletteCount)() PURE; /// /// Returns the number of entries in each color palette. All color palettes /// in a font have the same number of palette entries. The return value is /// zero if the font has no color information. /// STDMETHOD_(UINT32, GetPaletteEntryCount)() PURE; /// /// Reads color values from the font's color palette. /// /// Zero-based index of the color palette. If the /// font does not have a palette with the specified index, the method returns /// DWRITE_E_NOCOLOR. /// Zero-based index of the first palette entry /// to read. /// Number of palette entries to read. /// Array that receives the color values. /// /// Standard HRESULT error code. /// The return value is E_INVALIDARG if firstEntryIndex + entryCount is greater /// than the actual number of palette entries as returned by GetPaletteEntryCount. /// The return value is DWRITE_E_NOCOLOR if the font does not have a palette /// with the specified palette index. /// STDMETHOD(GetPaletteEntries)( UINT32 colorPaletteIndex, UINT32 firstEntryIndex, UINT32 entryCount, _Out_writes_(entryCount) DWRITE_COLOR_F* paletteEntries ) PURE; /// /// Determines the recommended text rendering and grid-fit mode to be used based on the /// font, size, world transform, and measuring mode. /// /// Logical font size in DIPs. /// Number of pixels per logical inch in the horizontal direction. /// Number of pixels per logical inch in the vertical direction. /// Specifies the world transform. /// Specifies the quality of the graphics system's outline rendering, /// affects the size threshold above which outline rendering is used. /// 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. /// Rendering parameters object. This parameter is necessary in case the rendering parameters /// object overrides the rendering mode. /// Receives the recommended rendering mode. /// Receives the recommended grid-fit mode. /// /// 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, and the actual grid-fit /// mode when the rendering params object is DWRITE_GRID_FIT_MODE_DEFAULT. /// /// /// Standard HRESULT error code. /// STDMETHOD(GetRecommendedRenderingMode)( FLOAT fontEmSize, FLOAT dpiX, FLOAT dpiY, _In_opt_ DWRITE_MATRIX const* transform, BOOL isSideways, DWRITE_OUTLINE_THRESHOLD outlineThreshold, DWRITE_MEASURING_MODE measuringMode, _In_opt_ IDWriteRenderingParams* renderingParams, _Out_ DWRITE_RENDERING_MODE* renderingMode, _Out_ DWRITE_GRID_FIT_MODE* gridFitMode ) PURE; }; /// /// Represents a color glyph run. The IDWriteFactory2::TranslateColorGlyphRun /// method returns an ordered collection of color glyph runs, which can be /// layered on top of each other to produce a color representation of the /// given base glyph run. /// struct DWRITE_COLOR_GLYPH_RUN { /// /// Glyph run to render. /// DWRITE_GLYPH_RUN glyphRun; /// /// Optional glyph run description. /// _Maybenull_ DWRITE_GLYPH_RUN_DESCRIPTION* glyphRunDescription; /// /// Location at which to draw this glyph run. /// FLOAT baselineOriginX; FLOAT baselineOriginY; /// /// Color to use for this layer, if any. This is the same color that /// IDWriteFontFace2::GetPaletteEntries would return for the current /// palette index if the paletteIndex member is less than 0xFFFF. If /// the paletteIndex member is 0xFFFF then there is no associated /// palette entry, this member is set to { 0, 0, 0, 0 }, and the client /// should use the current foreground brush. /// DWRITE_COLOR_F runColor; /// /// Zero-based index of this layer's color entry in the current color /// palette, or 0xFFFF if this layer is to be rendered using /// the current foreground brush. /// UINT16 paletteIndex; }; /// /// Enumerator for an ordered collection of color glyph runs. /// interface DWRITE_DECLARE_INTERFACE("d31fbe17-f157-41a2-8d24-cb779e0560e8") IDWriteColorGlyphRunEnumerator : public IUnknown { /// /// Advances to the first or next color run. The runs are enumerated /// in order from back to front. /// /// Receives TRUE if there is a current run or /// FALSE if the end of the sequence has been reached. /// /// Standard HRESULT error code. /// STDMETHOD(MoveNext)( _Out_ BOOL* hasRun ) PURE; /// /// Gets the current color glyph run. /// /// Receives a pointer to the color /// glyph run. The pointer remains valid until the next call to /// MoveNext or until the interface is released. /// /// Standard HRESULT error code. An error is returned if there is /// no current glyph run, i.e., if MoveNext has not yet been called /// or if the end of the sequence has been reached. /// STDMETHOD(GetCurrentRun)( _Outptr_ DWRITE_COLOR_GLYPH_RUN const** colorGlyphRun ) PURE; }; /// /// The interface that represents text rendering settings for glyph rasterization and filtering. /// interface DWRITE_DECLARE_INTERFACE("F9D711C3-9777-40AE-87E8-3E5AF9BF0948") IDWriteRenderingParams2 : public IDWriteRenderingParams1 { /// /// Gets the grid fitting mode. /// STDMETHOD_(DWRITE_GRID_FIT_MODE, GetGridFitMode)() PURE; }; /// /// The root factory interface for all DWrite objects. /// interface DWRITE_DECLARE_INTERFACE("0439fc60-ca44-4994-8dee-3a9af7b732ec") IDWriteFactory2 : public IDWriteFactory1 { /// /// Get the system-appropriate font fallback mapping list. /// /// The system fallback list. /// /// Standard HRESULT error code. /// STDMETHOD(GetSystemFontFallback)( _COM_Outptr_ IDWriteFontFallback** fontFallback ) PURE; /// /// Create a custom font fallback builder. /// /// Empty font fallback builder. /// /// Standard HRESULT error code. /// STDMETHOD(CreateFontFallbackBuilder)( _COM_Outptr_ IDWriteFontFallbackBuilder** fontFallbackBuilder ) PURE; /// /// Translates a glyph run to a sequence of color glyph runs, which can be /// rendered to produce a color representation of the original "base" run. /// /// Horizontal origin of the base glyph run in /// pre-transform coordinates. /// Vertical origin of the base glyph run in /// pre-transform coordinates. /// Pointer to the original "base" glyph run. /// Optional glyph run description. /// Measuring mode, needed to compute the origins /// of each glyph. /// Matrix converting from the client's /// coordinate space to device coordinates (pixels), i.e., the world transform /// multiplied by any DPI scaling. /// Zero-based index of the color palette to use. /// Valid indices are less than the number of palettes in the font, as returned /// by IDWriteFontFace2::GetColorPaletteCount. /// If the function succeeds, receives a pointer /// to an enumerator object that can be used to obtain the color glyph runs. /// If the base run has no color glyphs, then the output pointer is NULL /// and the method returns DWRITE_E_NOCOLOR. /// /// Returns DWRITE_E_NOCOLOR if the font has no color information, the base /// glyph run does not contain any color glyphs, or the specified color palette /// index is out of range. In this case, the client should render the base glyph /// run. Otherwise, returns a standard HRESULT error code. /// STDMETHOD(TranslateColorGlyphRun)( FLOAT baselineOriginX, FLOAT baselineOriginY, _In_ DWRITE_GLYPH_RUN const* glyphRun, _In_opt_ DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription, DWRITE_MEASURING_MODE measuringMode, _In_opt_ DWRITE_MATRIX const* worldToDeviceTransform, UINT32 colorPaletteIndex, _COM_Outptr_ IDWriteColorGlyphRunEnumerator** colorLayers ) PURE; /// /// Creates a rendering parameters object with the specified properties. /// /// The gamma value used for gamma correction, which must be greater than zero and cannot exceed 256. /// The amount of contrast enhancement, zero or greater. /// The degree of ClearType level, from 0.0f (no ClearType) to 1.0f (full ClearType). /// The geometry of a device pixel. /// Method of rendering glyphs. In most cases, this should be DWRITE_RENDERING_MODE_DEFAULT to automatically use an appropriate mode. /// How to grid fit glyph outlines. In most cases, this should be DWRITE_GRID_FIT_DEFAULT to automatically choose an appropriate mode. /// Holds the newly created rendering parameters object, or NULL in case of failure. /// /// Standard HRESULT error code. /// STDMETHOD(CreateCustomRenderingParams)( FLOAT gamma, FLOAT enhancedContrast, FLOAT grayscaleEnhancedContrast, FLOAT clearTypeLevel, DWRITE_PIXEL_GEOMETRY pixelGeometry, DWRITE_RENDERING_MODE renderingMode, DWRITE_GRID_FIT_MODE gridFitMode, _COM_Outptr_ IDWriteRenderingParams2** renderingParams ) PURE; using IDWriteFactory::CreateCustomRenderingParams; using IDWriteFactory1::CreateCustomRenderingParams; /// /// Creates a glyph run analysis object, which encapsulates information /// used to render a glyph run. /// /// Structure specifying the properties of the glyph run. /// Optional transform applied to the glyphs and their positions. This transform is applied after the /// scaling specified by the emSize and pixelsPerDip. /// Specifies the rendering mode, which must be one of the raster rendering modes (i.e., not default /// and not outline). /// Specifies the method to measure glyphs. /// How to grid-fit glyph outlines. This must be non-default. /// Horizontal position of the baseline origin, in DIPs. /// Vertical position of the baseline origin, in DIPs. /// Receives a pointer to the newly created object. /// /// Standard HRESULT error code. /// STDMETHOD(CreateGlyphRunAnalysis)( _In_ DWRITE_GLYPH_RUN const* glyphRun, _In_opt_ DWRITE_MATRIX const* transform, DWRITE_RENDERING_MODE renderingMode, DWRITE_MEASURING_MODE measuringMode, DWRITE_GRID_FIT_MODE gridFitMode, DWRITE_TEXT_ANTIALIAS_MODE antialiasMode, FLOAT baselineOriginX, FLOAT baselineOriginY, _COM_Outptr_ IDWriteGlyphRunAnalysis** glyphRunAnalysis ) PURE; using IDWriteFactory::CreateGlyphRunAnalysis; }; #endif /* DWRITE_2_H_INCLUDED */