PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 12:33 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Cannot load font
PostPosted: Mon Oct 19, 2009 11:17 pm 
Offline

Joined: Mon Oct 19, 2009 11:12 pm
Posts: 3
Hi all,

I am new to PDFSharp, and feel quite amazed about how powerful this lib can do.

I am doing my very first PDF doc at the moment, my very first problem is it cannot load my Swiss 721 font. I even tried to convert it from true type to open type, but neither works.

here is stack trace, any suggest are really appreciate.

Message:
Font has no usable platform or encoding ID. It cannot be used with PDFsharp.

Stack trace:
at PdfSharp.Fonts.OpenType.CMapTable.Read()
at PdfSharp.Fonts.OpenType.FontData.Read()
at PdfSharp.Fonts.OpenType.OpenTypeDescriptor..ctor(XFont font, XPdfFontOptions options)
at PdfSharp.Fonts.FontDescriptorStock.CreateDescriptor(XFont font)
at PdfSharp.Drawing.XFont.get_Metrics()
at PdfSharp.Drawing.XFont.Initialize()

Thanks
Jesse


Top
 Profile  
Reply with quote  
 Post subject: Re: Cannot load font
PostPosted: Tue Oct 20, 2009 8:04 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Hi!

The relevant place in code looks like this:
Code:
// Just read Windows stuff
if (platformId == PlatformId.Win && (encodingId == WinEncodingId.Symbol || encodingId == WinEncodingId.Unicode))


It seems your font doesn't have the expected platform or encoding ID.

That's all I can say - without your font file.

Have you tried the WPF build?

See also here:

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: Cannot load font
PostPosted: Tue Oct 20, 2009 11:59 am 
Offline

Joined: Mon Oct 19, 2009 11:12 pm
Posts: 3
I can post the font here for u to test if I am allowed to

it is a TrueType font instead of postscript.

Re wpf version
does it work in asp .net? Iis 7 + windows2008? I thought it is designed for WPF application

thanks
Jesse


Top
 Profile  
Reply with quote  
 Post subject: Re: Cannot load font
PostPosted: Tue Oct 20, 2009 2:28 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Hi, Jesse!

Set a breakpoint at the line
Code:
if (platformId == PlatformId.Win && (encodingId == WinEncodingId.Symbol || encodingId == WinEncodingId.Unicode))

It's line 188 at OpenTypeStructures.cs.

Check platformId and encodingId of your font.

If they have the wrong values you have to find a Font converter that changes the format (from Mac or Apple to Win).

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: Cannot load font
PostPosted: Tue Oct 20, 2009 5:34 pm 
Offline

Joined: Mon Oct 19, 2009 11:12 pm
Posts: 3
Hi Thomas,

My designer provides another copy of font, it is still not working with different error cannot load font or something. I think it is my OS' problem, following your suggestion, I try to use WFP build. It works! The only thing annoying me is that it needs reference to WindowsBase assembly for my WebApp project.

Do you think it is something wrong inside GDI+ lib coming with VISTA?

Thanks
Jesse


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 385 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