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

Weird Superscript behaviour
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3790
Page 1 of 1

Author:  j_fly [ Tue May 15, 2018 5:39 pm ]
Post subject:  Weird Superscript behaviour

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 4781 times ]


So maybe someone here knows whats going on there.

I desperately need at least a hint :see_no_evil:

Author:  TH-Soft [ Wed May 16, 2018 6:52 am ]
Post subject:  Re: Weird Superscript behaviour

Hi!

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

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

Author:  j_fly [ Wed May 16, 2018 7:46 am ]
Post subject:  Re: Weird Superscript behaviour

@TH-Soft i havn't tried that,

just changing the DLLs and recompile?

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

Author:  j_fly [ Wed May 16, 2018 8:51 am ]
Post subject:  Re: Weird Superscript behaviour

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;
}
}

Author:  TH-Soft [ Wed May 16, 2018 6:46 pm ]
Post subject:  Re: Weird Superscript behaviour

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

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