PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 8:38 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
PostPosted: Tue May 15, 2018 5:39 pm 
Offline

Joined: Tue May 15, 2018 5:16 pm
Posts: 3
Hi Guys n Gals,

first things first: I'm using PDFSharp (wpf 1.50.4740.0) in a WCF C# Service to generate Buissiness Cards and upload them to a FTPServer and send them as ByteArrays to a client (as a preview).

Today i encountered something kinda weird:

When using a Thai font (like NotoSansThai or Angasa New) the superscripts are mashed together, they should be above each other but instead occupy the exact same location.

It should look like this " ชั้ " but instead looks like this =>
Attachment:
weirthaichar.PNG
weirthaichar.PNG [ 858 Bytes | Viewed 4662 times ]


So maybe someone here knows whats going on there.

I desperately need at least a hint :see_no_evil:


Top
 Profile  
Reply with quote  
PostPosted: Wed May 16, 2018 6:52 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
Hi!

Does it look different when using the GDI build of PDFsharp?

See also:
viewtopic.php?f=2&t=832

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Wed May 16, 2018 7:46 am 
Offline

Joined: Tue May 15, 2018 5:16 pm
Posts: 3
@TH-Soft i havn't tried that,

just changing the DLLs and recompile?

Gonna try that right now, I'll be back :thumbsup:


Top
 Profile  
Reply with quote  
PostPosted: Wed May 16, 2018 8:51 am 
Offline

Joined: Tue May 15, 2018 5:16 pm
Posts: 3
So after switching DLL i noticed why i started using the WPF Version,
because GDI+ has no FontResolvers for Privatefonts,
any idea how i can work around this?

I used them like this:

CustomFontResolver.cs
FontResolverInfo("NotoSansTHRegular#");
FontLoader.cs
public static byte[] NotoSansTHRegular
{
get { return LoadFontData("LenzingWCF.api.fonts.th.NotoSansThai-Regular.ttf"); }
}

static byte[] LoadFontData(string name)
{
var assembly = Assembly.GetExecutingAssembly();

using (Stream stream = assembly.GetManifestResourceStream(name))
{
if (stream == null)
throw new ArgumentException("No resource with name " + name);

int count = (int)stream.Length;
byte[] data = new byte[count];
stream.Read(data, 0, count);
return data;
}
}


Top
 Profile  
Reply with quote  
PostPosted: Wed May 16, 2018 6:46 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
j_fly wrote:
any idea how i can work around this?
For a quick comparison of WPF build and GDI+ build just use a font that is installed on your PC.
If it works with the GDI+ build then use a Private Font Collection (class XPrivateFontCollection).
http://pdfsharp.net/wiki/Private%20Fonts.ashx

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


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: Google [Bot] and 141 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