PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.de/

Cannot load font
http://forum.pdfsharp.de/viewtopic.php?f=2&t=914
Page 1 of 1

Author:  jesselian [ Mon Oct 19, 2009 11:17 pm ]
Post subject:  Cannot load font

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

Author:  Thomas Hoevel [ Tue Oct 20, 2009 8:04 am ]
Post subject:  Re: Cannot load font

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:

Author:  jesselian [ Tue Oct 20, 2009 11:59 am ]
Post subject:  Re: Cannot load font

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

Author:  Thomas Hoevel [ Tue Oct 20, 2009 2:28 pm ]
Post subject:  Re: Cannot load font

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).

Author:  jesselian [ Tue Oct 20, 2009 5:34 pm ]
Post subject:  Re: Cannot load font

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

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