コード例 #1
0
ファイル: TextLayout.cs プロジェクト: alexey-bez/SharpDX
        /// <summary>	
        /// Gets the locale name of the text at the specified position. 	
        /// </summary>	
        /// <param name="currentPosition">The position of the text to inspect. </param>
        /// <param name="textRange">The range of text that has the same  formatting as the text at the position specified by currentPosition.  This means the run has the exact  formatting as the position specified, including but not limited to the locale name. </param>
        /// <returns>the locale name of the text at the specified position. </returns>
        /// <unmanaged>HRESULT IDWriteTextLayout::GetLocaleName([None] int currentPosition,[Out, Buffer] wchar_t* localeName,[None] int nameSize,[Out, Optional] DWRITE_TEXT_RANGE* textRange)</unmanaged>
        public string GetLocaleName(int currentPosition, out TextRange textRange)
        {
            unsafe
            {
                int nameLength;
                GetLocaleNameLength(currentPosition, out nameLength, out textRange);

                char* fontFamilyNamePtr = stackalloc char[nameLength + 1];

                GetLocaleName(currentPosition, new IntPtr(fontFamilyNamePtr), nameLength+1, out textRange);

                return new string(fontFamilyNamePtr, 0, nameLength);
            }
        }
コード例 #2
0
ファイル: TextLayout.cs プロジェクト: alexey-bez/SharpDX
 /// <summary>	
 /// Gets the application-defined drawing effect at the specified text position. 	
 /// </summary>	
 /// <param name="currentPosition">The position of the text whose drawing effect is to be retrieved. </param>
 /// <param name="textRange">Contains the range of text that has the same  formatting as the text at the position specified by currentPosition.  This means the run has the exact  formatting as the position specified, including but not limited to the drawing effect. </param>
 /// <returns>a reference to  the current application-defined drawing effect. Usually this effect is a foreground brush that  is used in glyph drawing. </returns>
 /// <unmanaged>HRESULT IDWriteTextLayout::GetDrawingEffect([None] int currentPosition,[Out] IUnknown** drawingEffect,[Out, Optional] DWRITE_TEXT_RANGE* textRange)</unmanaged>
 public ComObject GetDrawingEffect(int currentPosition, out TextRange textRange)
 {
     return (ComObject)Utilities.GetObjectForIUnknown(GetDrawingEffect_(currentPosition, out textRange));
 }
コード例 #3
0
 public void SetUnderline(bool underline, DW.TextRange range)
 {
     this.layout.SetUnderline(underline, range);
 }
コード例 #4
0
 public void SetInlineObject(DW.InlineObject o, DW.TextRange range)
 {
     this.layout.SetInlineObject(o, range);
 }
コード例 #5
0
 public void SetDrawingEffect(ComObject resource, DW.TextRange range)
 {
     this.layout.SetDrawingEffect(resource.NativePointer, range);
 }