Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XFont"/> class.
 /// </summary>
 /// <param name="familyName">Name of the font family.</param>
 /// <param name="emSize">The em size.</param>
 /// <param name="style">The font style.</param>
 /// <param name="pdfOptions">Additional PDF options.</param>
 public XFont(string familyName, double emSize, XFontStyle style, XPDFFontOptions pdfOptions)
 {
     FamilyName  = familyName;
     Size        = emSize;
     Style       = style;
     _pdfOptions = pdfOptions;
     Initialize();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XFont"/> class from a System.DrawingCore.FontFamily.
 /// </summary>
 /// <param name="fontFamily">The System.DrawingCore.FontFamily.</param>
 /// <param name="emSize">The em size.</param>
 /// <param name="style">The font style.</param>
 /// <param name="pdfOptions">Additional PDF options.</param>
 public XFont(UwpFontFamily fontFamily, double emSize, XFontStyle style, XPDFFontOptions pdfOptions)
 {
     _familyName    = fontFamily.Source;
     _gdiFontFamily = fontFamily;
     _emSize        = emSize;
     _style         = style;
     _pdfOptions    = pdfOptions;
     InitializeFromGdi();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XFont"/> class from a System.Windows.Media.Typeface.
 /// </summary>
 /// <param name="typeface">The System.Windows.Media.Typeface.</param>
 /// <param name="emSize">The em size.</param>
 /// <param name="pdfOptions">Additional PDF options.</param>
 public XFont(WpfTypeface typeface, double emSize, XPDFFontOptions pdfOptions)
 {
     _wpfTypeface = typeface;
     //Debug.Assert(font.Name == font.FontFamily.Name);
     //_familyName = font.Name;
     _emSize     = emSize;
     _pdfOptions = pdfOptions;
     InitializeFromWpf();
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XFont"/> class from a System.DrawingCore.FontFamily.
 /// </summary>
 /// <param name="fontFamily">The System.DrawingCore.FontFamily.</param>
 /// <param name="emSize">The em size.</param>
 /// <param name="style">The font style.</param>
 /// <param name="pdfOptions">Additional PDF options.</param>
 public XFont(GdiFontFamily fontFamily, double emSize, XFontStyle style, XPDFFontOptions pdfOptions)
 {
     FamilyName    = fontFamily.Name;
     GdiFontFamily = fontFamily;
     Size          = emSize;
     Style         = style;
     _pdfOptions   = pdfOptions;
     InitializeFromGdi();
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XFont"/> class with enforced style simulation.
 /// Only for testing PDFSharp.
 /// </summary>
 internal XFont(string familyName, double emSize, XFontStyle style, XPDFFontOptions pdfOptions, XStyleSimulations styleSimulations)
 {
     FamilyName  = familyName;
     Size        = emSize;
     Style       = style;
     _pdfOptions = pdfOptions;
     OverrideStyleSimulations = true;
     StyleSimulations         = styleSimulations;
     Initialize();
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XFont"/> class from a System.DrawingCore.Font.
 /// </summary>
 /// <param name="font">The System.DrawingCore.Font.</param>
 /// <param name="pdfOptions">Additional PDF options.</param>
 public XFont(GdiFont font, XPDFFontOptions pdfOptions)
 {
     if (font.Unit != GraphicsUnit.World)
     {
         throw new ArgumentException("Font must use GraphicsUnit.World.");
     }
     _gdiFont = font;
     Debug.Assert(font.Name == font.FontFamily.Name);
     _familyName = font.Name;
     _emSize     = font.Size;
     _style      = FontStyleFrom(font);
     _pdfOptions = pdfOptions;
     InitializeFromGdi();
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XFont"/> class from a System.DrawingCore.FontFamily.
        /// </summary>
        /// <param name="fontFamily">The System.Windows.Media.FontFamily.</param>
        /// <param name="emSize">The em size.</param>
        /// <param name="style">The font style.</param>
        /// <param name="pdfOptions">Additional PDF options.</param>
        public XFont(WpfFontFamily fontFamily, double emSize, XFontStyle style, XPDFFontOptions pdfOptions)
        {
#if !SILVERLIGHT
            _familyName = fontFamily.FamilyNames[XmlLanguage.GetLanguage("en-US")];
#else
            // Best we can do in Silverlight.
            _familyName = fontFamily.Source;
#endif
            _wpfFontFamily = fontFamily;
            _emSize        = emSize;
            _style         = style;
            _pdfOptions    = pdfOptions;
            InitializeFromWpf();
        }