![]() ![]() (2) Move ttf font file into font directory This is not recommended approach however and for the sake of simplicity I ignored this possibility. It will not work otherwise.Ĭustom font may also be added to the project with ‘Build Action’ set to ‘Content’. ![]() Remember to put the hash sign ‘#’ in front of font name. Note that spaces are included without any changes in this string. To get the name of the font simply click the file twice. ‘Katana Sans’ is the name of the font, not the name of the file. Where is Folder1 is a folder of your project where you keep a TTF file. ![]() It involves using even more wicked string than before but works as expected: Text The best answer to this question I found here MSDN: Packaging Fonts with Applications.Fonts/NotoSans-Regular.ttf#Noto Sans Symbols Fonts/NotoSans-BoldItalic.ttf#Noto Sans It should look like in the following code sample. csproj file should now have a section like this one: Set BuildAction: Content and Copy To Output Directory: Copy if newer or Copy always. You can also set the font imperatively: myTextBlock.FontFamily = new FontFamily(new Uri("pack://application:,/"), "./Fonts/#Noto Sans") Īdd the True Type Fonts ( *.ttf) files to that order Pack://application:,/Fonts/#Noto Sans Symbols Note that the URI doesn't contain the filename when packing with the application. Set BuildAction: Resource and Copy To Output Directory: Do not copy. Select the fonts and add them to the solution Package with ApplicationĪdd the True Type Fonts ( *.ttf) files to that folder The difference is mostly the URI you need to load the files with. The other way is to have the fonts in a folder. = != !=!=:=/= & & &= ++ +++ *** !! ?: ?.There are two ways of doing this: One way is to package the fonts inside the application. A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |