Exemplo n.º 1
0
        internal PdfFont AddFont(System.Drawing.Font f)
        {
            PdfFont pf = null;

            PdfFont.FontType fontType = PdfFont.ResolveFontType(f);

            string name = (fontType == PdfFont.FontType.Type1) ? PdfFont.FontToPdfType(f) : PdfDocument.GetFullFontName(f).Replace(" ", "");



            if (this.ContainsFont(name))
            {
                pf = GetFont(name);
            }
            else
            {
                if (fontType == PdfFont.FontType.Type1)
                {
                    pf = new Type1Font(name, this);
                }
                else
                {
                    pf = new PdfTrueTypeFont(f, this);
                }


                pf.ID = this.GetNextId;
                this.AddPdfObject(pf);
                pf.AddDescriptors();
                pf.Alias = String.Format("F{0}", fontList.Count);

                fontList[pf] = pf.Alias;
            }


            return(pf);
        }
Exemplo n.º 2
0
 internal static string FontToFontLine(Font Font)
 {
     return("/" + PdfFont.FontToPdfType(Font) + " " + Font.Size.ToString() + " Tf\n");
 }