PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

New Private Font with ASP.Net
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1400
Page 1 of 1

Author:  iandawg [ Mon Nov 01, 2010 9:59 pm ]
Post subject:  New Private Font with ASP.Net

I'm reviewing the code sample for Private Fonts. I'm looking at the "Based on WPF" sample, and I don't quite understand where the fonts are loaded from (the actual .ttf file). In the sample, there's a folder called, "Fonts" where I add "my font.ttf". I then modify the fontName value to refer to this font. When I debug, I get an exception from XPrivateFontCollection.cs : "Font with the specified family name does not exist."

Questions:

1- The URI Path that is specified is : pack://application:,,, - What the hell does that mean?
2- The example fonts used are "Early_Tickertape.ttf" and "Oblivious.ttf". The "name" value is set to : "./#Early Tickertape" - What does the the '#' symbol used for? and Why doesn't it have the .ttf extension included in the file name?

Author:  Thomas Hoevel [ Tue Nov 02, 2010 9:08 am ]
Post subject:  Re: New Private Font with ASP.Net

It's not enough to copy the font to the folder, you must set the Build Action of that file to Resource. It will then be included in your assembly.

The path and font name parameters are passed through to the framework.

Author:  iandawg [ Tue Nov 02, 2010 7:14 pm ]
Post subject:  Re: New Private Font with ASP.Net

I forgot to mention, I want to use a new Private Font in an ASP.Net application. Can I give a relative path to the font file? I'm sorry, but I don't understand how Private Fonts work...

Author:  Thomas Hoevel [ Wed Nov 03, 2010 8:37 am ]
Post subject:  Re: New Private Font with ASP.Net

Private fonts are loaded from resources. That's what the "pack" protocol in the URI specifies.
Add the font as a resource to your assembly and load it.

Author:  ilya.bolkhovsky [ Thu Dec 30, 2010 10:10 am ]
Post subject:  Re: New Private Font with ASP.Net

I also stuck with the problem of loading private fonts. For now I'm using WPF build of PdfSharp but still cannot find the workout how to load private fonts in my asp.net application.

Author:  TraderGordo [ Sat Jan 07, 2012 4:30 pm ]
Post subject:  Re: New Private Font with ASP.Net

ilya.bolkhovsky wrote:
I also stuck with the problem of loading private fonts. For now I'm using WPF build of PdfSharp but still cannot find the workout how to load private fonts in my asp.net application.


I know this post is old, but for people searching for this in the future, your answer can be found here:
viewtopic.php?f=2&t=1880

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/