question

MojtabaHakim-8125 avatar image
0 Votes"
MojtabaHakim-8125 asked Sean-Liming edited

How to Add Font File to Stimulsoft report from embedded font in C# WPF

I use C# WPF and Stimulsoft

I want to send path my font file was embedded to my report when need to show

Please Check out this link to help me

thanks all

more detail : how-to-add-font-file-to-stimulsoft-report-from-embedded-font-in-c-sharp-wpf


dotnet-csharpwindows-wpfdotnet-wpf-xaml
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

HuiLiu-MSFT avatar image
0 Votes"
HuiLiu-MSFT answered HuiLiu-MSFT edited

As Paul-5034 said, you could set Build Action property of BTITRBD.TTF to Resource. And you can try the following code if it is useful to you. You could also try to refer here.
131591-3.png
The code of xaml:

 <StackPanel Name="sp">
         <TextBlock Text="Loading..." FontSize="30" />
         <TextBlock Text="Loading..." FontSize="30" FontFamily="./FNT/#Al Qalam Quran Majeed Web Regular"/>
         <TextBlock Text="Loading..." FontSize="30" FontFamily="./FNT/#Amiri Regular"/>
            
         <TextBlock Name="tb" Text="Loading...." FontSize="30"/>
 </StackPanel>

The code of xaml.cs:

 public partial class MainWindow : Window
   {
     public MainWindow()
     {
       InitializeComponent();
       tb.FontFamily = new FontFamily(new Uri("pack://application:,,,/"), "./FNT/#Amiri Regular");
     }
   }

The picture of result:
131510-1.png


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



3.png (31.1 KiB)
1.png (14.9 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Paul-5034 avatar image
1 Vote"
Paul-5034 answered MojtabaHakim-8125 commented

Is your issue not that you're using the "font name" rather than the "file name" here?:

 StiFontCollection.AddFontFile(@"pack://application:,,,/FNT/#B Titr");

If you try this does it work?

 StiFontCollection.AddFontFile(@"pack://application:,,,/FNT/BTITRBD.TTF");

If BTITRBD.TTF has it's Build Action set to "Resource" and not "Embedded Resource" I'd expect this to work.

Just for your info GetManifestResourceStream is used to get Embedded Resources by their resource name. That method returns a stream to the Embedded Resource's data that you can read from.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

131321-untitled.png



Unfortunately it's not working !

0 Votes 0 ·
untitled.png (18.7 KiB)

also I found this but I don't know how to use it !
how-do-i-embed-my-own-fonts-in-a-winforms-app


0 Votes 0 ·