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

Private Font support in 1.50.4589.0 GDI build
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3730
Page 1 of 1

Author:  garycuthbert [ Thu Feb 08, 2018 3:38 pm ]
Post subject:  Private Font support in 1.50.4589.0 GDI build

Hello, can someone confirm whether or not the current GDI build of Migradoc & PDFSharp available on Nuget (v1.50.4589.0) supports the use of private fonts and if so which mechanism should be used to load them? (i.e. IFontResolver or XPrivateFontCollection).

I have tried both approaches and have had more success with the XPrivateFontCollection approach but still have rendering issues with this so i was hoping to confirm the recommended approach before trying to progress this further.

I am attempting to load the 'font awesome' font from an embedded resource (.ttf file) and although both of the above approaches appear to load the font successfully the IFontResolver scenario renders the text characters as rectangles.

In the XPrivateFontCollection scenario the text renders ok in certain areas but fails (i.e. renders as rectangles) when used in paragraphs embedded in text frames. I am sure this is down to my lack of understanding of how all of this hangs together (i am new to this library) but i have seen a few posts that suggest i shouldn't be using the XPrivateFontCollection approach.

The background to this is that ultimately I need to render pdf documents in both Debain and Windows environments and be able to support Cyrillic (and others) unicode characters so, as a proof of concept, i am attempting to get the generation running with Cyrillic characters under a windows environment before trying it out on Debian. It seemed like a sensible approach to use a common embedded private font as opposed to attempting to deduce a suitable font under each host environment.

Many thanks

Author:  TH-Soft [ Thu Feb 08, 2018 4:17 pm ]
Post subject:  Re: Private Font support in 1.50.4589.0 GDI build

Hi!

Quote:
IFontResolver is new with PDFsharp 1.50.
It cannot be used with the GDI build of PDFsharp.
It cannot be used with the WPF build of PDFsharp if you want to use the DocumentPreview - fonts used with IFontResolver are not available in the preview.

Source:
http://pdfsharp.net/wiki/Private%20Fonts.ashx

WPF build and IFontResolver works fine.

Author:  garycuthbert [ Thu Feb 08, 2018 5:25 pm ]
Post subject:  Re: Private Font support in 1.50.4589.0 GDI build

Hi, thanks for clarifying.

I think the core build without GDI+ is ultimately what I need but i appreciate that this may be a while off. I will have a go with system fonts and the GDI build for now under windows and then look at the Debian scenario once i have the basics needs covered.

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