diff --git a/PROMS/Volian.Print.Library/Rtf2iTextSharp.cs b/PROMS/Volian.Print.Library/Rtf2iTextSharp.cs index 84a63d8b..98d81668 100644 --- a/PROMS/Volian.Print.Library/Rtf2iTextSharp.cs +++ b/PROMS/Volian.Print.Library/Rtf2iTextSharp.cs @@ -239,9 +239,33 @@ namespace Volian.Print.Library // the size change, the overlays did not match up. It seems that the 16bit font size may be inaccurate // and the 16bit conversion to be pdf may be off. //if (font.Familyname.StartsWith("Arial") && font.Size == 11 && DoingComparison) font.Size = 11.15f; + iTextSharp.text.pdf.FontSelector fs = new FontSelector(); + if (visualText.Format.Font.Name == "VESymbFix") + { + fs.AddFont(FontFactory.GetFont("VESymbFix", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, visualText.Format.FontSize / 2, + (visualText.Format.IsBold ? iTextSharp.text.Font.BOLD : 0) + + (visualText.Format.IsItalic ? iTextSharp.text.Font.ITALIC : 0), font.Color)); + // if the symbol character cannot be found in VESymbFix then check/use the Consolas font + fs.AddFont(FontFactory.GetFont("Consolas", 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)); + Phrase ph = fs.Process(visualText.Text); + foreach (Chunk chk in ph.Chunks) + AdjustChunk(visualText, font, chk); + _MyParagraph.Add(ph); + } + else + { + Chunk chk = new Chunk(visualText.Text, font); + AdjustChunk(visualText, font, chk); + _MyParagraph.Add(chk); + } + ProfileTimer.Pop(profileDepth); + } - Chunk chk = new Chunk(visualText.Text, font); - if(visualText.Format.BackgroundColor.AsDrawingColor.ToArgb() != System.Drawing.Color.White.ToArgb()) + private void AdjustChunk(IRtfVisualText visualText, iTextSharp.text.Font font, Chunk chk) + { + if (visualText.Format.BackgroundColor.AsDrawingColor.ToArgb() != System.Drawing.Color.White.ToArgb()) chk.SetBackground(new iTextSharp.text.Color(visualText.Format.BackgroundColor.AsDrawingColor)); if (visualText.Format.IsStrikeThrough) chk.SetUnderline(font.Color, 0, 0.05F, 0, .3F, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size @@ -274,7 +298,7 @@ namespace Volian.Print.Library chk.SetTextRise(.25F * chk.Font.Size); if (PrintOverride.CompressSuper) chk.Font.Size = 9; } - + } else if (visualText.Format.SuperScript < 0) { @@ -310,8 +334,6 @@ namespace Volian.Print.Library _MyFont = font; _MyParagraph.Font = _MyFont; } - _MyParagraph.Add(chk); - ProfileTimer.Pop(profileDepth); } private string ShowSpecialCharacters(string p)