示例#1
0
        private static void SetFontFamily(Telerik.Windows.Documents.Fixed.Model.Editing.FixedContentEditor drawingSurface, System.Windows.Media.FontFamily fontFamily, System.Windows.FontWeight fontWeight)
        {
#if WPF
            if (!drawingSurface.TextProperties.TrySetFont(fontFamily, new System.Windows.FontStyle(), fontWeight))
            {
                throw new System.Exception("Unable to set font. Consider embedding the font.");
            }
#elif SILVERLIGHT
            drawingSurface.TextProperties.Font = Telerik.Windows.Documents.Fixed.Model.Fonts.FontsRepository.TimesRoman;

            // To load a custom font, please see the RegisterAndExportPdfFonts sdk sample here https://github.com/telerik/xaml-sdk/tree/master/SpreadProcessing/RegisterAndExportPdfFonts
#endif
        }
示例#2
0
        private void SetFontFamily(Telerik.Windows.Documents.Fixed.Model.Editing.FixedContentEditor drawingSurface, System.Windows.Media.FontFamily fontFamily)
        {
#if WPF
            if (!drawingSurface.TextProperties.TrySetFont(fontFamily))
            {
                throw new System.Exception("Unable to set font. Consider embedding the font.");
            }
#elif SILVERLIGHT
            if (fontFamily.Source == "Times New Roman")
            {
                drawingSurface.TextProperties.Font = Telerik.Windows.Documents.Fixed.Model.Fonts.FontsRepository.TimesRoman;
            }
            else
            {
                throw new System.Exception("Unable to set font. Please see the RegisterAndExportPdfFonts sdk sample here https://github.com/telerik/xaml-sdk/tree/master/SpreadProcessing/RegisterAndExportPdfFonts");
            }
#endif
        }