Пример #1
0
        /// <summary>
        /// Creates a font object that matches the properties specified by the LOGFONT structure.
        /// </summary>
        /// <param name="font">A <see cref="System.Drawing.Font"/> description. </param>
        /// <returns>a reference to a newly created <see cref="SharpDX.DirectWrite.Font"/>. </returns>
        /// <unmanaged>HRESULT IDWriteGdiInterop::CreateFontFromLOGFONT([In] const LOGFONTW* logFont,[Out] IDWriteFont** font)</unmanaged>
        public Font FromSystemDrawingFont(System.Drawing.Font font)
        {
            var logfontw = new Win32Native.LogFont();

            font.ToLogFont(logfontw);
            return(FromLogFont(logfontw));
        }
Пример #2
0
        /// <summary>
        /// Convert a Direct2D <see cref="Font"/> to a <see cref="System.Drawing.Font"/>.
        /// </summary>
        /// <param name="d2dFont">a Direct2D Font</param>
        /// <param name="font">a <see cref="System.Drawing.Font"/></param>
        /// <returns>true if the specified font object is part of the system font collection; otherwise, false.</returns>
        public bool ToSystemDrawingFont(Font d2dFont, out System.Drawing.Font font)
        {
            var  logfontw     = new Win32Native.LogFont();
            bool isSystemFont = ToLogFont(d2dFont, logfontw);

            font = System.Drawing.Font.FromLogFont(logfontw);
            return(isSystemFont);
        }
Пример #3
0
 /// <summary>
 /// Convert a Direct2D <see cref="Font"/> to a <see cref="System.Drawing.Font"/>.
 /// </summary>
 /// <param name="d2dFont">a Direct2D Font</param>
 /// <param name="font">a <see cref="System.Drawing.Font"/></param>
 /// <returns>true if the specified font object is part of the system font collection; otherwise, false.</returns>
 public bool ToSystemDrawingFont(Font d2dFont, out System.Drawing.Font font)
 {
     var logfontw = new Win32Native.LogFont();
     bool isSystemFont = ToLogFont(d2dFont, logfontw);
     font = System.Drawing.Font.FromLogFont(logfontw);
     return isSystemFont;
 }
Пример #4
0
 /// <summary>	
 /// Creates a font object that matches the properties specified by the LOGFONT structure. 	
 /// </summary>	
 /// <param name="font">A <see cref="System.Drawing.Font"/> description. </param>
 /// <returns>a reference to a newly created <see cref="SharpDX.DirectWrite.Font"/>. </returns>
 /// <unmanaged>HRESULT IDWriteGdiInterop::CreateFontFromLOGFONT([In] const LOGFONTW* logFont,[Out] IDWriteFont** font)</unmanaged>
 public Font FromSystemDrawingFont(System.Drawing.Font font)
 {
     var logfontw = new Win32Native.LogFont();
     font.ToLogFont(logfontw);
     return FromLogFont(logfontw);
 }