Skip to content

Commit 792897c

Browse files
Fix HTML PDF rendering using random font from Hashtable iteration (#1260)
1 parent 8816819 commit 792897c

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

dotnet/src/dotnetframework/GxPdfReportsCS/PDFReportItext4.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -811,14 +811,14 @@ public override void GxDrawText(String sTxt, int left, int top, int right, int b
811811
if (!string.IsNullOrEmpty(fontPath))
812812
{
813813
FontFactory.Register(fontPath, fontName);
814-
styles.LoadTagStyle("body", "face", fontName);
815-
816-
if (IsEmbeddedFont(fontName))
817-
styles.LoadTagStyle("body", "encoding", BaseFont.IDENTITY_H);
818-
else
819-
styles.LoadTagStyle("body", "encoding", BaseFont.WINANSI);
820814
}
821815
}
816+
string defaultFontName = baseFont.PostscriptFontName;
817+
styles.LoadTagStyle("body", "face", defaultFontName);
818+
if (IsEmbeddedFont(defaultFontName))
819+
styles.LoadTagStyle("body", "encoding", BaseFont.IDENTITY_H);
820+
else
821+
styles.LoadTagStyle("body", "encoding", BaseFont.WINANSI);
822822
}
823823

824824
//Bottom and top are the absolutes, regardless of the actual height at which the letters are written.

0 commit comments

Comments
 (0)