Пример #1
0
        } // End Function GetFirstTypeFaceInDirectory

        public static Typography.OpenFont.Typeface GetFontByPostScriptName(string fontDirectory, string postScriptName = "Asana-Math")
        {
            Typography.FontManagement.TypefaceStore     store = GetTypeFaceStore(fontDirectory);
            Typography.FontManagement.InstalledTypeface itf   = store.FontCollection.GetFontByPostScriptName(postScriptName);

            return(store.GetTypeface(itf));
        } // End Function GetFontByPostScriptName
Пример #2
0
        } // End Function GetFontByPostScriptName

        public static Typography.OpenFont.Typeface GetFontByFontName(string fontDirectory, string fontName, Typography.FontManagement.TypefaceStyle tfs)
        {
            Typography.FontManagement.TypefaceStore     store = GetTypeFaceStore(fontDirectory);
            Typography.FontManagement.InstalledTypeface itf   = store.FontCollection.GetInstalledTypeface(fontName, tfs);

            return(store.GetTypeface(itf));
        } // End Function GetFontByFontName
Пример #3
0
        public static Typography.OpenFont.Typeface GetTestTypeface(string fontDirectory)
        {
            Typography.FontManagement.TypefaceStore store = GetTypeFaceStore(fontDirectory);
            // Typography.FontManagement.InstalledTypeface itf = GetFirstInstalledTypeface(fontDirectory);
            Typography.FontManagement.InstalledTypeface itf = store.FontCollection.GetInstalledTypeface("Asana Math", Typography.FontManagement.TypefaceStyle.Regular);
            // Typography.FontManagement.InstalledTypeface itf = store.FontCollection.GetInstalledTypeface("SNT Anouvong", Typography.FontManagement.TypefaceStyle.Regular);
            // Typography.FontManagement.InstalledTypeface itf = store.FontCollection.GetInstalledTypeface("Noto Mono", Typography.FontManagement.TypefaceStyle.Regular);
            // Typography.FontManagement.InstalledTypeface itf = store.FontCollection.GetInstalledTypeface("Algerian", Typography.FontManagement.TypefaceStyle.Regular);
            // Typography.FontManagement.InstalledTypeface itf = store.FontCollection.GetInstalledTypeface("Bahnschrift", Typography.FontManagement.TypefaceStyle.Regular);
            // Typography.FontManagement.InstalledTypeface itf = store.FontCollection.GetInstalledTypeface("Comic Sans MS", Typography.FontManagement.TypefaceStyle.Regular);
            // Typography.FontManagement.InstalledTypeface itf = store.FontCollection.GetInstalledTypeface("Consolas", Typography.FontManagement.TypefaceStyle.Regular);
            // Typography.FontManagement.InstalledTypeface itf = store.FontCollection.GetInstalledTypeface("Courier New", Typography.FontManagement.TypefaceStyle.Regular);
            // Typography.FontManagement.InstalledTypeface itf = store.FontCollection.GetInstalledTypeface("OCR A Extended", Typography.FontManagement.TypefaceStyle.Regular);
            // Typography.FontManagement.InstalledTypeface itf = store.FontCollection.GetInstalledTypeface("Old English Text MT", Typography.FontManagement.TypefaceStyle.Regular);
            // Typography.FontManagement.InstalledTypeface itf = store.FontCollection.GetInstalledTypeface("Arial", Typography.FontManagement.TypefaceStyle.Regular);
            // Typography.FontManagement.InstalledTypeface itf = store.FontCollection.GetInstalledTypeface("Verdana", Typography.FontManagement.TypefaceStyle.Regular);
            // Typography.FontManagement.InstalledTypeface itf = store.FontCollection.GetInstalledTypeface("Times New Roman", Typography.FontManagement.TypefaceStyle.Regular);
            // Typography.FontManagement.InstalledTypeface itf = store.FontCollection.GetInstalledTypeface("Palatino Linotype", Typography.FontManagement.TypefaceStyle.Regular);

            // Trouble
            // // Typography.FontManagement.InstalledTypeface itf = store.FontCollection.GetInstalledTypeface("Vivaldi", Typography.FontManagement.TypefaceStyle.Regular);
            // Typography.FontManagement.InstalledTypeface itf = store.FontCollection.GetInstalledTypeface("Vivaldi", Typography.FontManagement.TypefaceStyle.Italic);
            // Typography.FontManagement.InstalledTypeface itf = store.FontCollection.GetFontByPostScriptName("Vivaldii");


            if (s_not_printed)
            {
                System.Console.Write("FontPath: ");
                System.Console.WriteLine(itf.FontPath);
                System.Console.Write("FontName: ");
                System.Console.WriteLine(itf.FontName);
                System.Console.Write("PostScriptName: ");
                System.Console.WriteLine(itf.PostScriptName);
                System.Console.Write("TypographicFamilyName: ");
                System.Console.WriteLine(itf.TypographicFamilyName);
                System.Console.Write("TypographicFontSubFamily: ");
                System.Console.WriteLine(itf.TypographicFontSubFamily);
                System.Console.Write("FontSubFamily: ");
                System.Console.WriteLine(itf.FontSubFamily);
                System.Console.Write("TypefaceStyle: ");
                System.Console.WriteLine(itf.TypefaceStyle);



                if (itf.Languages != null && itf.Languages.SupportedLangs != null)
                {
                    System.Console.Write("SupportedLangs: ");
                    System.Console.WriteLine(string.Join(", ", itf.Languages.SupportedLangs));
                }


                s_not_printed = false;
            } // End if (s_not_printed)

            return(store.GetTypeface(itf));
        } // End Function GetTestTypeface
Пример #4
0
        } // End Function GetTestTypeface

        public static Typography.FontManagement.InstalledTypeface GetFirstInstalledTypeface(string fontDirectory)
        {
            Typography.FontManagement.TypefaceStore     tfs           = GetTypeFaceStore(fontDirectory);
            Typography.FontManagement.InstalledTypeface firstTypeFace = null;

            foreach (Typography.FontManagement.InstalledTypeface thisTypeface in tfs.FontCollection.GetInstalledFontIter())
            {
                firstTypeFace = thisTypeface;
                break;
            } // Next thisTypeface

            return(firstTypeFace);
        } // End Function GetFirstTypeFaceInDirectory