Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        private static Class38 smethod_2(
            PdfBody body,
            string pdfFontID,
            WW.Pdf.Font.Font font,
            ns7.Class33 ttf)
        {
            PdfIndirectObject <Class40> pdfIndirectObject = new PdfIndirectObject <Class40>(PdfFontCreator.smethod_4(pdfFontID, (IFontMetric)ttf));
            Class38 class38 = new Class38(pdfFontID, font.FontName);

            class38.Encoding   = "WinAnsiEncoding";
            class38.Descriptor = pdfIndirectObject;
            class38.FirstChar  = ttf.FirstChar;
            class38.LastChar   = ttf.LastChar;
            class38.Widths     = ttf.Array;
            body.IndirectObjects.Add((IPdfIndirectObject)pdfIndirectObject);
            return(class38);
        }