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())); }
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); }