Exception in PdfFonts.GetFontMetrics, font 'TH SarabunPSK'

Stimulsoft Reports.NET discussion
Post Reply
liooonking
Posts: 2
Joined: Tue Apr 11, 2023 4:00 am

Exception in PdfFonts.GetFontMetrics, font 'TH SarabunPSK'

Post by liooonking »

I am using "Stimulsoft.Reports.Web.NetCore" Version="2023.2.1" .I generate PDF report and everything working fine . But when I was asked to change Thai font to "THSarabun.ttf" it shows me this error :

System.Exception: Exception in PdfFonts.GetFontMetrics, font 'TH SarabunPSK' step #10: 'Invalid value for 'classFormat' 0. Should be '1' or '2'.'
at Stimulsoft.Report.Export.PdfFonts.GetFontMetrics(Font font, PdfFontInfo currentFontInfo, UInt16[] glyphMap, Boolean isWpf)
at Stimulsoft.Report.Export.PdfFonts.InitFontsData(Boolean isWpf)
at Stimulsoft.Report.Export.StiPdfExportService.ExportPdf1(StiReport report, Stream stream, StiPdfExportSettings settings)
at Stimulsoft.Report.Export.StiPdfExportService.ExportPdf(StiReport report, Stream stream, StiPdfExportSettings settings)
at Stimulsoft.Report.Mvc.StiNetCoreReportResponse.ResponseAsPdf(StiReport report, StiPdfExportSettings settings, Boolean saveFileDialog)
at Stimulsoft.Report.Mvc.StiNetCoreReportResponse.ResponseAsPdf(StiReport report, StiPagesRange pageRange, Single imageQuality, Single imageResolution, Boolean embeddedFonts, Boolean standardPdfFonts, Boolean exportRtfTextAsImage, String passwordUser, String passwordOwner, StiUserAccessPrivileges userAccessPrivileges, StiPdfEncryptionKeyLength keyLength, Boolean useUnicode, Boolean saveFileDialog)
at Stimulsoft.Report.Mvc.StiNetCoreReportResponse.ResponseAsPdf(StiReport report, StiPagesRange pageRange, Single imageQuality, Single imageResolution, Boolean embeddedFonts, Boolean standardPdfFonts, Boolean saveFileDialog)

For test you can find this font in this url :

https://www.mbu.ac.th/uncategorized/post-3573/

Also my simple form which I am using this font is attached .
Attachments
Coding.txt
Coding Part
(1.28 KiB) Downloaded 96 times
Report.mrt
Report File
(4.07 KiB) Downloaded 95 times
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: Exception in PdfFonts.GetFontMetrics, font 'TH SarabunPSK'

Post by Lech Kulikowski »

Hello,

We apologize for the delay, but we need some extra time to investigate the issue thoroughly. We will keep you informed about the result as soon as possible.

Thank you for your patience.
#11025
liooonking
Posts: 2
Joined: Tue Apr 11, 2023 4:00 am

Re: Exception in PdfFonts.GetFontMetrics, font 'TH SarabunPSK'

Post by liooonking »

Hello.

I tried to use another Thai font like "chulanarak" which you can find it in the link below .Report shows no error but the text with this font now showing too .

https://thaifonts.net/fonts/chulanarak-regular
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: Exception in PdfFonts.GetFontMetrics, font 'TH SarabunPSK'

Post by Lech Kulikowski »

Hello,

In NetCore we use the SixLabors.Fonts graphics library. There are problems with some of the fonts, something inside is crashing.
Unfortunately, there's nothing we can do with it, since the SixLabors.Fonts library is still in beta.
font "THSarabun.ttf" doesn't like this library, but the font "chulanarak" does, use it.

Thank you.
Post Reply