Example #1
0
		public static async Task GenerateAsync(GenerationConfig config)
		{
			var pathes = Helper.GetFontPairs()
				.Select(x => x.Path)
				.ToArray();

			var path = pathes[config.FontIndex];

			if(!File.Exists(path))
			{
				throw new FileNotFoundException("指定されたフォントファイルは存在しません。", path);
			}

			if(!File.Exists(config.TextPath))
			{
				throw new FileNotFoundException("指定されたテキストファイルは存在しません。", config.TextPath);
			}

			if(!Directory.Exists(config.ExportPath))
			{
				throw new FileNotFoundException("指定され出力先ディレクトリは存在しません。", config.ExportPath);
			}

			var gen = new DLL();
			gen.SetFontName(path);
			gen.SetTextFilePath(config.TextPath);
			gen.SetExportPath(Path.Combine(config.ExportPath, config.SheetName));
			gen.SetFontSize(config.FontSize);
			gen.SetSheetSize(config.TextureSize);

			var c = config.FontColor;
			gen.SetFontColor(c.Red, c.Green, c.Blue, c.Alpha);

			var co = config.OutlineColor;
			gen.SetOutlineColor(co.Red, co.Green, co.Blue, co.Alpha);
			gen.SetOutlineSize(config.OutlineSize);
			gen.SetOutlineSampling(config.OutlineSampling);

			await Task.Run(() => gen.Run());
		}
Example #2
0
		public static async Task<string> GeneratePreviewAsync(GenerationConfig config)
		{
			var pathes = Helper.GetFontPairs()
				.Select(x => x.Path)
				.ToArray();

			var path = pathes[config.FontIndex];

			var gen = new DLL();
			gen.SetFontName(path);
			gen.SetFontSize(config.FontSize);

			var c = config.FontColor;
			gen.SetFontColor(c.Red, c.Green, c.Blue, c.Alpha);

			var co = config.OutlineColor;
			gen.SetOutlineColor(co.Red, co.Green, co.Blue, co.Alpha);
			gen.SetOutlineSize(config.OutlineSize);
			//gen.SetOutlineSampling(config.OutlineSampling);

			return await Task.Run(() => gen.SavePreview());
		}
Example #3
0
        static void Main(string[] args)
        {
            var gen = new DLL();

            Console.WriteLine("使用するフォントファイルを指定してください。");
            gen.SetFontName(ReadFileName());

            Console.WriteLine("\n使用するテキストファイルのパスを指定してください。");
            gen.SetTextFilePath(ReadFileName());

            Console.WriteLine("\n出力先のファイル名(拡張子除く)を指定してください。");
            Console.Write("> ");
            gen.SetExportPath(Console.ReadLine());

            Console.WriteLine("\nフォントサイズを指定してください。");
            gen.SetFontSize(ReadInt());

            Console.WriteLine("\n画像のサイズを指定してください。");
            gen.SetSheetSize(ReadInt());

            Console.WriteLine("\nフォントの色を指定してください[0-255]");
            Console.Write("  Red> ");
            var r = ReadByte();
            Console.Write("Green> ");
            var g = ReadByte();
            Console.Write(" Blue> ");
            var b = ReadByte();
            Console.Write("Alpha> ");
            var a = ReadByte();
            gen.SetFontColor(r, g, b, a);

            Console.WriteLine("\nフォント生成中…");
            gen.Run();

            Console.WriteLine("生成しました。");
            Console.ReadKey();
        }