2010-08-26 3 views
2

J'ai une police composite personnalisée en tant que ressource dans une DLL de bibliothèque que je voudrais charger mais je ne parviens pas à obtenir la syntaxe exacte. J'ai essayé:Utilisation de WPF personnalisé compositefont à partir de la ressource dll

FontFamily font = new FontFamily(
    new Uri("pack://application:,,,/MyLibraryDll"), 
    "./fonts/#My Font from composite font"); 

Ce qui ne fonctionne pas si j'ai essayé d'énumérer les polices avec:

ICollection<FontFamily> fonts = Fonts.GetFontFamilies(
    new Uri("pack://application:,,,/MyLibraryDll"), 
    "./fonts/#My Font from composite font"); 

Et

ICollection<FontFamily> fonts = Fonts.GetFontFamilies(
    new Uri("pack://application:,,,/MyLibraryDll"), 
    "./fonts/mycompositefont.compositefont#My Font from composite font"); 

Et retour à la fois un compte de 0. Il n'y a pas de documentation sur ceux que je peux trouver - quelqu'un a-t-il eu de la chance avec ça?

Répondre

0

Selon Packaging Fonts with Applications, la syntaxe correcte est:

new FontFamily(new Uri("pack://application:,,,"), 
    "MyLibraryDll;Component/Fonts/#My Font from composite font"); 
+0

Merci! On dirait que les docs ont finalement rattrapé ... –

Questions connexes