This commit is contained in:
wieslawsoltes 2020-07-02 10:58:22 +00:00
Родитель 6a0cc8a67a
Коммит 2e8ce15a46
2 изменённых файлов: 22 добавлений и 0 удалений

Просмотреть файл

@ -32,6 +32,7 @@ Options:
-p, --pattern <pattern> The search string to match against the names of files in the input directory [default: *.ttf]
--fontFamily <fontfamily> The input font family
-o, --outputDirectory <outputdirectory> The relative or absolute path to the output directory
--printFontFamilies Print available font families
--printCharacterMaps Print character maps info
--png, --pngExport Export text as Png
--pngTextSize <pngtextsize> Png text size [default: 20]

Просмотреть файл

@ -19,6 +19,7 @@ namespace TypefaceUtil
// Output
public DirectoryInfo? OutputDirectory { get; set; }
// Info
public bool PrintFontFamilies { get; set; } = false;
public bool PrintCharacterMaps { get; set; } = false;
// Png Export
public bool PngExport { get; set; } = false;
@ -223,6 +224,15 @@ namespace TypefaceUtil
return characterMaps;
}
static void PrintFontFamilies()
{
var fontFamilies = SKFontManager.Default.GetFontFamilies();
foreach (var fontFamily in fontFamilies)
{
Log($"{fontFamily}");
}
}
static async Task<int> Main(string[] args)
{
// Input
@ -256,6 +266,11 @@ namespace TypefaceUtil
// Info
var optionPrintFontFamilies = new Option(new[] { "--printFontFamilies" }, "Print available font families")
{
Argument = new Argument<bool>()
};
var optionPrintCharacterMaps = new Option(new[] { "--printCharacterMaps" }, "Print character maps info")
{
Argument = new Argument<bool>()
@ -337,6 +352,7 @@ namespace TypefaceUtil
// Output
rootCommand.AddOption(optionOutputDirectory);
// Info
rootCommand.AddOption(optionPrintFontFamilies);
rootCommand.AddOption(optionPrintCharacterMaps);
// Png Export
rootCommand.AddOption(optionPngExport);
@ -358,6 +374,11 @@ namespace TypefaceUtil
{
try
{
if (settings.PrintFontFamilies)
{
PrintFontFamilies();
}
Run(settings);
}
catch (Exception ex)