Ejemplo n.º 1
0
        public static Font GerarFonte(tipoFonte tipo, int tamanho, int style, BaseColor corFonte)
        {
            Font fonteRetorno = null;

            string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Etx\\";

            if (!File.Exists(path + "ARIALN.TTF") || !File.Exists(path + "ariblk.ttf") || !File.Exists(path + "ARIAL.TTF"))
            {
                ExportarFontes(path);
            }

            switch (tipo)
            {
            case tipoFonte.ArialNarrow:
                path += "ARIALN.TTF";
                if (!FontFactory.IsRegistered(tipoFonte.ArialNarrow.ToString()))
                {
                    FontFactory.Register(path, tipoFonte.ArialNarrow.ToString());
                }
                fonteRetorno = FontFactory.GetFont(tipoFonte.ArialNarrow.ToString(), tamanho, style, corFonte);
                break;

            case tipoFonte.ArialBlack:
                path += "ariblk.ttf";
                if (!FontFactory.IsRegistered("Arial Black"))
                {
                    FontFactory.Register(path, "Arial Black");
                }
                fonteRetorno = FontFactory.GetFont("Arial Black", BaseFont.CP1252, BaseFont.NOT_EMBEDDED, tamanho, style, corFonte);
                break;

            case tipoFonte.Arial:
                path += "ARIAL.TTF";
                if (!FontFactory.IsRegistered("ARIAL"))
                {
                    FontFactory.Register(path, "ARIAL");
                }
                fonteRetorno = FontFactory.GetFont("ARIAL", BaseFont.CP1252, BaseFont.NOT_EMBEDDED, tamanho, style, corFonte);
                break;
            }
            return(fonteRetorno);
        }
 public static Font GerarFonte(tipoFonte tipo, int estilo, int tamanho)
 {
     return(GerarFonte(tipo, tamanho, estilo, BaseColor.BLACK));
 }