/// <summary> /// Converts a DOM Font to an XFont. /// </summary> internal static XFont FontToXFont(Font font, PdfFontEncoding encoding) { XPdfFontOptions options = new XPdfFontOptions(encoding); XFontStyle style = GetXStyle(font); #if DEBUG if (StringComparer.OrdinalIgnoreCase.Compare(font.Name, "Segoe UI Semilight") == 0 && (style & XFontStyle.BoldItalic) == XFontStyle.Italic) font.GetType(); #endif XFont xFont = new XFont(font.Name, font.Size, style, options); #if DEBUG CreateFontCounter++; #endif return xFont; }
/// <summary> /// Converts a DOM Font to an XFont. /// </summary> internal static XFont FontToXFont(Font font, PdfFontEncoding encoding) { XPdfFontOptions options = new XPdfFontOptions(encoding); XFontStyle style = GetXStyle(font); #if DEBUG if (StringComparer.OrdinalIgnoreCase.Compare(font.Name, "Segoe UI Semilight") == 0 && (style & XFontStyle.BoldItalic) == XFontStyle.Italic) { font.GetType(); } #endif XFont xFont = new XFont(font.Name, font.Size, style, options); #if DEBUG CreateFontCounter++; #endif return(xFont); }
/// <summary> /// Converts an DOM Font to an XFont. /// </summary> internal static XFont FontToXFont(Font font, XPrivateFontCollection pfc, PdfFontEncoding encoding) { XFont xFont = null; // #PFC XPdfFontOptions options = null; options = new XPdfFontOptions(encoding); XFontStyle style = GetXStyle(font); if (xFont == null) { xFont = new XFont(font.Name, font.Size, style, options); } #if DEBUG CreateFontCounter++; #endif return(xFont); }
/// <summary> /// Converts an DOM Font to an XFont. /// </summary> internal static XFont FontToXFont(Font font, XPrivateFontCollection pfc, PdfFontEncoding encoding) { XFont xFont = null; #if GDI____ // done in PDFsharp #if CACHE_FONTS string signature = BuildSignature(font, unicode, fontEmbedding); xFont = fontCache[signature] as XFont; if (xFont == null) { XPdfFontOptions options = null; options = new XPdfFontOptions(fontEmbedding, unicode); XFontStyle style = GetXStyle(font); xFont = new XFont(font.Name, font.Size, style, options); fontCache[signature] = xFont; } #else XPdfFontOptions options = null; options = new XPdfFontOptions(encoding, fontEmbedding); XFontStyle style = GetXStyle(font); if (pfc != null && pfc.PrivateFontCollection != null) { // Is it a private font? try { foreach (System.Drawing.FontFamily ff in pfc.PrivateFontCollection.Families) { if (String.Compare(ff.Name, font.Name, true) == 0) { xFont = new XFont(ff, font.Size, style, options, pfc); break; } } } catch { #if DEBUG pfc.GetType(); #endif } } #endif #endif #if WPF___ XPdfFontOptions options = null; options = new XPdfFontOptions(encoding, fontEmbedding); XFontStyle style = GetXStyle(font); //if (pfc != null && // pfc.PrivateFontCollection != null) //{ // // Is it a private font? // try // { // foreach (System.Drawing.FontFamily ff in pfc.PrivateFontCollection.Families) // { // if (String.Compare(ff.Name, font.Name, true) == 0) // { // xFont = new XFont(ff, font.Size, style, options, pfc); // break; // } // } // } // catch // { // } //} #endif // #PFC XPdfFontOptions options = null; options = new XPdfFontOptions(encoding); XFontStyle style = GetXStyle(font); if (xFont == null) { xFont = new XFont(font.Name, font.Size, style, options); } #if DEBUG CreateFontCounter++; #endif return(xFont); }
/// <summary> /// Initializes a new instance of the <see cref="XPdfFontOptions"/> class. /// </summary> public XPdfFontOptions(PdfFontEncoding encoding) { fontEncoding = encoding; fontEmbedding = PdfFontEmbedding.None; }
/// <summary> /// Initializes a new instance of the <see cref="XPdfFontOptions"/> class. /// </summary> public XPdfFontOptions(PdfFontEncoding encoding, PdfFontEmbedding embedding) { fontEncoding = encoding; fontEmbedding = embedding; }
/// <summary> /// Initializes a new instance of the <see cref="XPdfFontOptions"/> class. /// </summary> public XPdfFontOptions(PdfFontEncoding encoding) { this.fontEncoding = encoding; this.fontEmbedding = PdfFontEmbedding.None; }
/// <summary> /// Initializes a new instance of the <see cref="XPdfFontOptions"/> class. /// </summary> public XPdfFontOptions(PdfFontEncoding encoding, PdfFontEmbedding embedding) { this.fontEncoding = encoding; this.fontEmbedding = embedding; }
/// <summary> /// Initializes a new instance of the <see cref="XPdfFontOptions"/> class. /// </summary> public XPdfFontOptions(PdfFontEncoding encoding) { _fontEncoding = encoding; }
/// <summary> /// Converts an DOM Font to an XFont. /// </summary> internal static XFont FontToXFont(Font font, XPrivateFontCollection pfc, PdfFontEncoding encoding, PdfFontEmbedding fontEmbedding) { XFont xFont = null; #if GDI____ // done in PDFsharp #if CACHE_FONTS string signature = BuildSignature(font, unicode, fontEmbedding); xFont = fontCache[signature] as XFont; if (xFont == null) { XPdfFontOptions options = null; options = new XPdfFontOptions(fontEmbedding, unicode); XFontStyle style = GetXStyle(font); xFont = new XFont(font.Name, font.Size, style, options); fontCache[signature] = xFont; } #else XPdfFontOptions options = null; options = new XPdfFontOptions(encoding, fontEmbedding); XFontStyle style = GetXStyle(font); if (pfc != null && pfc.PrivateFontCollection != null) { // Is it a private font? try { foreach (System.Drawing.FontFamily ff in pfc.PrivateFontCollection.Families) { if (String.Compare(ff.Name, font.Name, true) == 0) { xFont = new XFont(ff, font.Size, style, options, pfc); break; } } } catch { #if DEBUG pfc.GetType(); #endif } } #endif #endif #if WPF___ XPdfFontOptions options = null; options = new XPdfFontOptions(encoding, fontEmbedding); XFontStyle style = GetXStyle(font); //if (pfc != null && // pfc.PrivateFontCollection != null) //{ // // Is it a private font? // try // { // foreach (System.Drawing.FontFamily ff in pfc.PrivateFontCollection.Families) // { // if (String.Compare(ff.Name, font.Name, true) == 0) // { // xFont = new XFont(ff, font.Size, style, options, pfc); // break; // } // } // } // catch // { // } //} #endif // #PFC XPdfFontOptions options = null; options = new XPdfFontOptions(encoding, fontEmbedding); XFontStyle style = GetXStyle(font); if (xFont == null) xFont = new XFont(font.Name, font.Size, style, options); #if DEBUG CreateFontCounter++; #endif return xFont; }