Пример #1
0
        private static string GetFileName(FontVariant font, ExportNamingScheme scheme)
        {
            string fileName = null;
            string ext      = ".ttf";

            var src = DirectWrite.GetFileName(font.FontFace);

            if (!string.IsNullOrWhiteSpace(src))
            {
                var strsrc = Path.GetExtension(src);
                if (!string.IsNullOrWhiteSpace(strsrc))
                {
                    ext = strsrc;
                }
            }

            if (string.IsNullOrEmpty(ext))
            {
                if (scheme == ExportNamingScheme.System)
                {
                    fileName = src;
                }
            }

            if (string.IsNullOrWhiteSpace(fileName))
            {
                fileName = $"{font.FamilyName.Trim()} {font.PreferredName.Trim()}{ext}";
            }

            return($"{Utils.Humanise(Path.GetFileNameWithoutExtension(fileName), false)}{Path.GetExtension(fileName).ToLower()}");
        }
Пример #2
0
        private static string GetFileName(FontVariant font, ExportNamingScheme scheme)
        {
            string fileName = null;
            string ext      = ".ttf";

            var src = DirectWrite.GetFileName(font.FontFace);

            if (!string.IsNullOrWhiteSpace(src))
            {
                ext = Path.GetExtension(src);
            }

            if (scheme == ExportNamingScheme.System)
            {
                fileName = src;
            }

            if (string.IsNullOrWhiteSpace(fileName))
            {
                fileName = $"{font.FamilyName} {font.PreferredName}{ext}";
            }

            return($"{Humanizer.To.SentenceCase.Transform(Path.GetFileNameWithoutExtension(fileName))}{Path.GetExtension(fileName).ToLower()}");
        }