public static PdfFont AddFont(PdfBody body, string pdfFontID, WW.Pdf.Font.Font font) { PdfFont pdfFont; if (font is Class14) { Class14 base14 = (Class14)font; pdfFont = (PdfFont)PdfFontCreator.smethod_1(pdfFontID, base14); } else { IFontMetric fontMetric = PdfFontCreator.smethod_3(font); if (fontMetric is Class14) { Class14 base14 = (Class14)fontMetric; pdfFont = (PdfFont)PdfFontCreator.smethod_1(pdfFontID, base14); } else if (fontMetric is ns7.Class33) { ns7.Class33 ttf = (ns7.Class33)fontMetric; pdfFont = (PdfFont)PdfFontCreator.smethod_2(body, pdfFontID, font, ttf); } else { ns0.Class30 cidFont = (ns0.Class30)fontMetric; pdfFont = PdfFontCreator.smethod_0(body, pdfFontID, font, cidFont); } } if (pdfFont == null) { throw new Exception("Unable to create Pdf font object for " + pdfFontID); } body.Fonts.Add(pdfFont); return(pdfFont); }
public FontState(FontInfo fontInfo, string fontFamily, string fontStyle, string fontWeight, int fontSize, int fontVariant) { this.fontInfo = fontInfo; this.fontFamily = fontFamily; this.fontStyle = fontStyle; this.fontWeight = fontWeight; this.fontSize = fontSize; this.fontName = fontInfo.FontLookup(fontFamily, fontStyle, fontWeight); this.metric = fontInfo.GetMetricsFor(fontName); this.fontVariant = fontVariant; this.letterSpacing = 0; }
public FontState(FontInfo fontInfo, string fontFamily, string fontStyle, string fontWeight, int fontSize, int fontVariant) { this.fontInfo = fontInfo; this.fontFamily = fontFamily; this.fontStyle = fontStyle; this.fontWeight = fontWeight; this.fontSize = fontSize; this.fontName = fontInfo.FontLookup(fontFamily, fontStyle, fontWeight); this.metric = fontInfo.GetMetricsFor(fontName); this.fontVariant = fontVariant; this.letterSpacing = 0; }
public FontState( PdfFontInfo fontInfo, string fontFamily, string fontStyle, string fontWeight, int fontSize) { this.pdfFontInfo_0 = fontInfo; this.string_1 = fontFamily; this.string_2 = fontStyle; this.string_3 = fontWeight; this.int_0 = fontSize; this.string_0 = fontInfo.FontLookup(fontFamily, fontStyle, fontWeight); this.ifontMetric_0 = fontInfo.GetMetricsFor(this.string_0); this.int_1 = 52; this.int_2 = 0; }
/// <summary> /// Returns a subclass of the PdfFont class that may be one of /// PdfType0Font, PdfType1Font or PdfTrueTypeFont. The type of /// subclass returned is determined by the type of the <i>font</i> /// parameter. /// </summary> /// <param name="pdfFontID">The PDF font identifier, e.g. F15</param> /// <param name="font">Underlying font object.</param> /// <returns></returns> public PdfFont MakeFont(string pdfFontID, Font font) { PdfFont pdfFont = null; if (font is Base14Font) { // One of the standard base 14 fonts Base14Font base14 = (Base14Font)font; pdfFont = CreateBase14Font(pdfFontID, base14); } else { // Will load underlying font if proxy IFontMetric realMetrics = GetFontMetrics(font); if (realMetrics is Base14Font) { // A non-embeddable font that has been defaulted to a base 14 font Base14Font base14 = (Base14Font)realMetrics; pdfFont = CreateBase14Font(pdfFontID, base14); } else if (realMetrics is TrueTypeFont) { // TrueTypeFont restricted to the WinAnsiEncoding scheme // that is linked instead of embedded in the PDF. TrueTypeFont ttf = (TrueTypeFont)realMetrics; pdfFont = CreateTrueTypeFont(pdfFontID, font, ttf); } else { // A character indexed font that may be subsetted. CIDFont cid = (CIDFont)realMetrics; pdfFont = CreateCIDFont(pdfFontID, font, cid); } } // This should never happen, but it's worth checking if (pdfFont == null) { throw new Exception("Unable to create Pdf font object for " + pdfFontID); } creator.AddObject(pdfFont); return(pdfFont); }
private static Class40 smethod_4(string fontName, IFontMetric metrics) { IFontDescriptor descriptor = metrics.Descriptor; Class40 class40 = new Class40(fontName); class40.Ascent = metrics.Ascender; class40.CapHeight = metrics.CapHeight; class40.Descent = metrics.Descender; class40.Flags = descriptor.Flags; class40.ItalicAngle = descriptor.ItalicAngle; class40.StemV = descriptor.StemV; PdfArray pdfArray = new PdfArray(); pdfArray.AddRange((IEnumerable <int>)descriptor.FontBBox); class40.FontBBox = pdfArray; return(class40); }
private PdfFontDescriptor MakeFontDescriptor(string fontName, IFontMetric metrics) { IFontDescriptor descriptor = metrics.Descriptor; PdfFontDescriptor pdfDescriptor = new PdfFontDescriptor( fontName, NextObjectId()); pdfDescriptor.Ascent = new PdfNumeric(metrics.Ascender); pdfDescriptor.CapHeight = new PdfNumeric(metrics.CapHeight); pdfDescriptor.Descent = new PdfNumeric(metrics.Descender); pdfDescriptor.Flags = new PdfNumeric(descriptor.Flags); pdfDescriptor.ItalicAngle = new PdfNumeric(descriptor.ItalicAngle); pdfDescriptor.StemV = new PdfNumeric(descriptor.StemV); PdfArray array = new PdfArray(); array.AddArray(descriptor.FontBBox); pdfDescriptor.FontBBox = array; return(pdfDescriptor); }
public void AddMetrics(string name, IFontMetric metrics) { fonts.Add(name, metrics); }
public void AddMetrics(string name, IFontMetric metrics) { this.idictionary_2.Add(name, metrics); }
private PdfFontDescriptor MakeFontDescriptor(string fontName, IFontMetric metrics) { IFontDescriptor descriptor = metrics.Descriptor; PdfFontDescriptor pdfDescriptor = new PdfFontDescriptor( fontName, NextObjectId()); pdfDescriptor.Ascent = new PdfNumeric(metrics.Ascender); pdfDescriptor.CapHeight = new PdfNumeric(metrics.CapHeight); pdfDescriptor.Descent = new PdfNumeric(metrics.Descender); pdfDescriptor.Flags = new PdfNumeric(descriptor.Flags); pdfDescriptor.ItalicAngle = new PdfNumeric(descriptor.ItalicAngle); pdfDescriptor.StemV = new PdfNumeric(descriptor.StemV); PdfArray array = new PdfArray(); array.AddArray(descriptor.FontBBox); pdfDescriptor.FontBBox = array; return pdfDescriptor; }
public void AddMetrics(string name, IFontMetric metrics) { fonts.Add(name, metrics); }