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

Unicode support
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3852
Page 1 of 1

Author:  gastan [ Sun Sep 30, 2018 3:36 pm ]
Post subject:  Unicode support

Hi

I found some merged TTF here:
https://github.com/klokantech/klokantech-gl-fonts

Normal font ("KlokanTech Noto Sans") works fine for me, even Bold, but if I go for CJK("KlokanTech Noto Sans CJK"), nothing works, not chinese chars, nor Bold :(
any idea what could be wrong?

thx

Author:  TH-Soft [ Sun Sep 30, 2018 4:51 pm ]
Post subject:  Re: Unicode support

gastan wrote:
any idea what could be wrong?
Yes.
See also:
http://pdfsharp.net/wiki/Unicode-sample.ashx
http://forum.pdfsharp.net/viewtopic.php?f=2&t=832

Author:  gastan [ Sun Sep 30, 2018 7:31 pm ]
Post subject:  Re: Unicode support

Yeah, sorry, I forgot to add that "Arial Unicode MS" font works quite ok, I just want to replace it with something with Bold face.
So I am just trying to figure out what could be the reason one font from the same guy is working ok and another not at all :(

PdfSharp is 1.2.1269
MigraDoc.Rendering is 1.2.2546
I beleive it's a relase DLLs.

Author:  TH-Soft [ Sun Sep 30, 2018 8:38 pm ]
Post subject:  Re: Unicode support

gastan wrote:
PdfSharp is 1.2.1269
Pretty old.
Arial has regular, bold, italic, and bold italic.

PDFsharp 1.50 can simulate bold for fonts that do not have bold glyphs.

Make sure you use the correct font name in MigraDoc (typically there is no "bold" or "italic" in the name coz there is a font attribute for bold and italics - use the family name).

Author:  gastan [ Fri Oct 05, 2018 1:58 pm ]
Post subject:  Re: Unicode support

Yeah, I have success with other fonts and I believe I got the name right.
I updated to PDFSharp to latest 1.5 ver and no change there.
Question is, if


This text '末永萌絵子' looks ok in "Arial Unicode MS" and with ver 1.5 it even shows Bold, which is cool.
Could the format of 'KlokanTech Not Sans CJK' which is 'KOKANTECHNOTOSANSCJK-REGULAR.OTF' be the problem?

Author:  gastan [ Fri Oct 05, 2018 2:22 pm ]
Post subject:  Re: Unicode support

ok, now I figured adding 'Regular' to fonts name helps with "Noto Sans CJK JP Regular"
that is the Google font. Problem is, it only covers JP and what's worse, my PDFs for from 200-300kB to 13MB, which is HUGE and take forever to generate :(

Author:  TH-Soft [ Sat Oct 06, 2018 9:02 am ]
Post subject:  Re: Unicode support

gastan wrote:
that is the Google font. Problem is, it only covers JP and what's worse, my PDFs for from 200-300kB to 13MB, which is HUGE and take forever to generate :(
When it comes to embedding font subsets, PDFsharp relies on index tables of the fonts. If those index tables are missing, PDFsharp will embed the complete font file.
So you can reduce the file size by using fonts that have these index tables filled.

Author:  gastan [ Sat Oct 06, 2018 9:15 am ]
Post subject:  Re: Unicode support

Thanks @TH

How do I check if index table is there?
Also, how do I check if Could 'KOKANTECHNOTOSANSCJK-REGULAR.OTF' is supported by PDFSharp?
(I mistakenly tagged thread as TTF font, but I see now it's OTF.)
Are all the fonts that work in OS (W10) supported by PDFSharp?
I read somewhere, there is limit of 64k glyphs in font, so that's that, but font it'self work in Windows (I paste Japanese chars and it displays them in Fonts app)

How does name of the font and filename relate? I just notice now spelling diference, filename is KOKAN*, and Font name starts with "Klokan"

Thx for you help
--G

Author:  TH-Soft [ Sat Oct 06, 2018 9:24 am ]
Post subject:  Re: Unicode support

gastan wrote:
Are all the fonts that work in OS (W10) supported by PDFsharp?
Not my area of expertise.
AFAIK the WPF build of PDFsharp supports more fonts. Maybe worth a try if you do not use the WPF build yet.
See also:
viewtopic.php?p=11758#p11758

gastan wrote:
How does name of the font and filename relate?
I expect that in MigraDoc you have to use the font name that is showing in the Fonts applet of Windows or in applications like Word. The file name of the font file is not relevant in any way.
In most cases of fonts for Windows "Regular" is not part of the font name - but this may be the case for some non-Windows fonts converted to Windows.

Author:  gastan [ Sat Oct 06, 2018 12:44 pm ]
Post subject:  Re: Unicode support

I will check WPF. But I am doing my own graphs (that were not possible at the time with PDFSharp) so maybe I am using GDI?
(I know I get some multithreading exceptions once a week from GDI). If my charts work or it woudl be possible to move them to PDF facility, I could go for WPF.

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