예제 #1
0
        public static FontDescription ToPangoFont(this Xwt.Drawing.Font font)
        {
            var backend = Xwt.Toolkit.GetBackend(font) as FontDescription;

            if (backend != null)
            {
                return(backend.Copy());
            }
            return(FontDescription.FromString(font.ToString()));
        }
예제 #2
0
        public static NSFont ToNSFont(this Xwt.Drawing.Font font)
        {
            if (Xwt.Toolkit.GetBackend(font) is Xwt.Mac.FontData fontData)
            {
                return(fontData.Font);
            }
            NSFont result = null;

            Xwt.Toolkit.NativeEngine.Invoke(() => {
                var nativeXwtFont = Xwt.Drawing.Font.FromName(font.ToString());
                if (Xwt.Toolkit.GetBackend(nativeXwtFont) is Xwt.Mac.FontData fontData)
                {
                    result = fontData.Font;
                }
            });
            return(result);
        }