B2021-038 Added symbols fonts without bold or italic. Some symbol characters would not print if they were bolded.

This commit is contained in:
John Jenko 2021-04-12 20:10:21 +00:00
parent 4bcfa5fbe8
commit d4b3cced0b

View File

@ -452,6 +452,21 @@ namespace Volian.Print.Library
fs.AddFont(FontFactory.GetFont("FreeMono", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, (visualText.Format.FontSize * 1.1F) / 2,
(visualText.Format.IsBold ? iTextSharp.text.Font.BOLD : 0) +
(visualText.Format.IsItalic ? iTextSharp.text.Font.ITALIC : 0), font.Color));
// B2021-038 add the Consolas and FreeMono without Bold or Italic - some symbols are not available as Bold or Italic
fs.AddFont(FontFactory.GetFont("Consolas", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, (visualText.Format.FontSize * 1.1F) / 2, 0, font.Color));
fs.AddFont(FontFactory.GetFont("FreeMono", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, (visualText.Format.FontSize * 1.1F) / 2, 0, font.Color));
Phrase ph = fs.Process(visualText.Text);
foreach (Chunk chk in ph.Chunks)
{
AdjustChunk(visualText, font, chk);
_MyParagraph.Add(chk);
}
}
// B2021-038 add the FreeSerif without Bold or Italic - some symbols are not available as Bold or Italic
else if (visualText.Format.Font.Name == "FreeSerif" && ContainsAllSymbols(visualText.Text))
{
fs.AddFont(font);
fs.AddFont(FontFactory.GetFont("FreeSerif", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, (visualText.Format.FontSize * 1.1F) / 2, 0, font.Color));
Phrase ph = fs.Process(visualText.Text);
foreach (Chunk chk in ph.Chunks)
{