Closed SkySpiritDev closed 1 year ago
Hi @SkySpiritDev ,
Have a look at https://github.com/awesome-inc/FontAwesome.Sharp#using-fontawesome-pro Does this help?
Hi @SkySpiritDev ,
Have a look at https://github.com/awesome-inc/FontAwesome.Sharp#using-fontawesome-pro Does this help?
Yes, but I'm probably doing something wrong. I will describe below my actions and give the code.
I install packages FontAwesome.Sharp and FontAwesome.Sharp.Pro
Create folder "Icons" and add "fa-regular-400.ttf" file
In App.xaml add code:
<Application x:Class="WpfApp1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApp1"
StartupUri="MainWindow.xaml">
<Application.Resources>
<FontFamily x:Key="FontAwesomePro">/WpfApp1;component/Icons/#Font Awesome 6 Pro Regular</FontFamily>
</Application.Resources>
</Application>
Code in Window XAML file:
<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:fa="http://schemas.awesome.incremented/wpf/xaml/fontawesome.sharp"
xmlns:faPro="http://schemas.awesome.incremented/wpf/xaml/fontawesome.sharp.pro"
Title="MainWindow" Height="450" Width="800">
<Grid>
<faPro:IconBlock Icon="Album" FontFamily="{StaticResource FontAwesomePro}"></faPro:IconBlock>
</Grid>
</Window>
"Severity Code Description Project File Line Suppression State Error XDG0062 Value cannot be null. Parameter name: fontFamily WpfApp1"
Screenshots:
I also cloned the repository and tried to run the TestWpf project from the Pro branch. Previously, I added the font in the same way, but got the same errors.
Could you please describe step by step how to use Pro Icons in readme, because I have been trying to do this for the third day, but without results.
Thanks!
The "pro"-Branch should provide a working example
However, I did this a while ago (pro version <6). Maybe the icons did change so much that some are breaking. Please check back again. If it doesn't work for you I would offer to update the example with current font-files. Just send me a copy of the ttf-files to marcel.koertgen@gmail.com
Hi @SkySpiritDev ,
I verified the code is working using the current pro fonts (current branches main / pro). I also added support for explicitly switching the font style for the pro fonts as well (regular, solid, light, thin). I did not yet add support for duotone since icons have a separate css/enum but it is straight forward to add.
Closed due to inactivity
@SkySpiritDev I got it to work with the latest pro TTF fonts (once I realized the ttf fonts are in the web zip and not the desktop zip).
What I had to do was put the TTF fonts in the fonts folder with the build action Resource not Embedded Resource.
That got me a little further, but then I received new exceptions: "ArgumentException: Default value type does not match type of property 'IconFont'."
A little more fiddling and I found what I believe are typos with the dependency properties in IconBlock.cs and IconImage.cs. With those fixed I discovered that it appears the Zhihu icon that the TestWPF app was trying to display is now in a brands font and not in the primary Font Awesome ttf fonts.
I have been unable to get DuoTone/SolidSharp/Brand fonts working correctly, but I figured I'd share what work I got done this morning.
I've forked the repo to make my changes (https://github.com/toristorii/FontAwesome.Sharp/tree/pro) and will be submitting a pull request for @mkoertgen to accept or reject but it's there if anyone else wants it.
Looks good, thanks @toristorii.
I have an Pro account, and download .otf and .svg files.
Also i install FontAwesome.Sharp.Pro package.
I adeed
xmlns:fapro="clr-namespace:FontAwesome.Sharp.Pro;assembly=FontAwesome.Sharp.Pro"
to xaml.But i cannot understand how use it.
in TestWpf app i dont see any examples.
Thanks for your help