PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat May 25, 2024 2:52 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Sep 29, 2023 1:24 pm 
Offline

Joined: Mon Aug 07, 2023 9:07 pm
Posts: 7
In Migradoc 6.0.0-preview-3, some unicode characters in PDF file appear as not accented in Linux.
To to reproduce, run in Debian in ASP.NET MVC controller


Code:
      static ReportTemplateBase()
      {
        GlobalFontSettings.FontResolver = new NewFontResolver();
      }
   
      var textFrame = Section.AddTextFrame();
      var font = new Font("Arial", 12);
      var par = textFrame.AddParagraph();
      par.Format.Font = font;
      par.AddFormattedText("õäöüÕÄÖÜ", font);


If running in Debian Linux, äöü are replaced with unaccented characters. Output is


Quote:
õaouÕAOU

If running from Visual Studio IDE in Windows, output is correct:

Quote:
õäöüÕÄÖÜ


How to get correct characters in Debian Linux?


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 29, 2023 3:07 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 927
Location: CCAA
andrus wrote:
How to get correct characters in Debian Linux?
Create your own FontResolver and include a TTF file that has all the characters you need (this can be Arial as it works under Windows).

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


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 29, 2023 7:59 pm 
Offline

Joined: Mon Aug 07, 2023 9:07 pm
Posts: 7
Hi!

Where to find replacement font files for Arial and Times New Roman fonts for Linux containing õäöü characters? Why õ character is rendered properly? Is õ included in PDFSharp?

Looked into NewFontResolver source code. It searches font files in Linux directories.

I copied .ttf files to /usr/share/fonts/fontsforpdfcreation directory and it looks like this solved the issue.
Is this OK?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 28 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