From 382864aca7118b171a0fa165ca66d67e6d23a968 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 7 Jul 2016 18:15:13 +0000 Subject: [PATCH] Fixed printing of backslashes in procedure numbers and titles --- PROMS/Volian.Svg.Library/iTextSharp.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/PROMS/Volian.Svg.Library/iTextSharp.cs b/PROMS/Volian.Svg.Library/iTextSharp.cs index 43dac0a4..2f6068bf 100644 --- a/PROMS/Volian.Svg.Library/iTextSharp.cs +++ b/PROMS/Volian.Svg.Library/iTextSharp.cs @@ -765,6 +765,8 @@ namespace Volian.Svg.Library text = Regex.Replace(text, @"\\[Uu][0-9]+[?]", new MatchEvaluator(ReplaceSpecialCharacter)); text = Regex.Replace(text, @"\\'[0-9a-fA-F][0-9a-fA-F]", new MatchEvaluator(ReplaceHexCharacter)); text += " "; + if (text.Contains("\\")) + text = text.Replace("\\", ((char)9586).ToString()); // B2016-155 convert backslash char to the unicode symbol - to allow processing rtf commands \ul, \up, \dn, etc. Phrase ph = new Phrase(); while (text.Length > 0) { @@ -778,8 +780,8 @@ namespace Volian.Svg.Library } else if (text[text.Length - 1] == ' ') text = text.Substring(0, text.Length - 1); - - foreach (Chunk chk in BuildPartialPhrase(text, fontSize, fontStyle, font).Chunks) + // B2016-155 convert the backslash symbol back to the backslash character since we look for specific rft commands below + foreach (Chunk chk in BuildPartialPhrase(text.Replace(((char)9586).ToString(),"\\"), fontSize, fontStyle, font).Chunks) { if (fontUnderline) chk.SetUnderline(font.Color, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); if (fontTextRise != 0) chk.SetTextRise(fontTextRise * chk.Font.Size); @@ -835,7 +837,6 @@ namespace Volian.Svg.Library VolianPdf.RegisterFont("Arial Unicode MS"); fs.AddFont(FontFactory.GetFont("Arial Unicode MS", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, fontSize, fontStyle, new Color(FillColor))); } - Phrase ph = fs.Process(text); return ph; }