Exemple #1
0
        public static string GetSerializeFontFamilyName(Typeface typeface, bool useGdiFontNames)
        {
            string str1 = FontFamilyHelper.EnsureFamilyName(FontEmbedder.GetGdiName(typeface.FontFamily));
            string familyName;

            if (useGdiFontNames)
            {
                familyName = str1;
            }
            else
            {
                string str2 = FontEmbedder.GetFontFamilyPath(typeface.FontFamily.Source);
                if (string.IsNullOrEmpty(str2))
                {
                    str2 = Microsoft.Expression.Framework.Documents.PathHelper.EnsurePathEndsInDirectorySeparator(FontEmbedder.SystemFontsDirectory);
                }
                FontFamily fontFamily = new FontFamily(str2 + "#" + str1);
                string     wpfName1   = FontEmbedder.GetWpfName(typeface.FontFamily);
                string     wpfName2   = FontEmbedder.GetWpfName(fontFamily);
                familyName = !(wpfName1 != wpfName2) ? str1 : wpfName1;
            }
            return(FontFamilyHelper.EnsureFamilyName(familyName));
        }