PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Jun 30, 2024 4:32 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Mon Nov 01, 2010 9:59 pm 
Offline

Joined: Thu Oct 21, 2010 7:37 pm
Posts: 5
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?


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 02, 2010 9:08 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3100
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 02, 2010 7:14 pm 
Offline

Joined: Thu Oct 21, 2010 7:37 pm
Posts: 5
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...


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 03, 2010 8:37 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3100
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 30, 2010 10:10 am 
Offline

Joined: Thu Dec 30, 2010 10:07 am
Posts: 2
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.


Top
 Profile  
Reply with quote  
PostPosted: Sat Jan 07, 2012 4:30 pm 
Offline

Joined: Thu Jan 05, 2012 3:14 am
Posts: 8
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 68 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group