public static Typography.FontManagement.TypefaceStyle ConvToInstalledFontStyle(this FontStyle style) { Typography.FontManagement.TypefaceStyle installedStyle = Typography.FontManagement.TypefaceStyle.Regular;//regular switch (style) { default: break; case FontStyle.Bold: installedStyle = Typography.FontManagement.TypefaceStyle.Bold; break; case FontStyle.Italic: installedStyle = Typography.FontManagement.TypefaceStyle.Italic; break; case FontStyle.Bold | FontStyle.Italic: installedStyle = Typography.FontManagement.TypefaceStyle.Italic; break; } return(installedStyle); }
} // 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