diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index bbb1d4f6..2b7cdfa5 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -401,6 +401,10 @@ namespace Volian.Print.Library VEPROMS.CSLA.Library.FormatInfo activeFormat = mySection.ActiveFormat; VEPROMS.CSLA.Library.DocStyle docStyle = mySection.MyDocStyle; Volian.Svg.Library.Svg mySvg = null; + //string jsj = BuildMyText(activeFormat); + //if (jsj == "") + // Console.WriteLine("here"); + //mySvg = SvgSerializer.StringDeserialize(jsj); mySvg = SvgSerializer.StringDeserialize(BuildMyText(activeFormat)); mySvg.ViewBox.Height = 1100; mySvg.ViewBox.Width = 850; @@ -506,7 +510,8 @@ namespace Volian.Print.Library sGenMac = tmpf.GenMac; tmpf = FormatInfo.Get(tmpf.ParentID); } - if (sGenMac == null || sGenMac == "") return ""; + if (sGenMac == null || sGenMac == "") + sGenMac = "";// return ""; } if (!sGenMac.Contains("xmlns")) sGenMac = sGenMac.Replace("= 0) // symbol character - use symbol font to find its width @@ -95,7 +103,14 @@ namespace Volian.Print.Library YOffset = yoffset; Text = cleanTab; MyFont = vFont; - Width = GetTextWidth(MyFont, (Text != null ? Text : origTab), symblFontName);//MyFont.CharsToTwips * (Text != null ? Text.Length : origTab.Length); + float CCCs = GetTextWidth(MyFont, "CCCCCCCCCC", symblFontName); + float IIIs = GetTextWidth(MyFont, "iiiiiiiiii", symblFontName); + if (CCCs != IIIs) + Width = Text.Length * 6; //proportial font (7 chars * 6) + else + Width = GetTextWidth(MyFont, (Text != null ? Text : origTab), symblFontName);//MyFont.CharsToTwips * (Text != null ? Text.Length : origTab.Length); + //if (MyParent.MyItemInfo.ItemID == 108)//120) + // Console.WriteLine("here"); if (origTab.Contains(@"{!")) { int mindx = origTab.IndexOf(@"{!"); @@ -107,10 +122,24 @@ namespace Volian.Print.Library origTab = origTab.Replace(macro,""); origTab = origTab + " "; cleanTab = origTab; - Width = GetTextWidth(MyFont, (cleanTab != null ? cleanTab : origTab), symblFontName);//MyFont.CharsToTwips * (cleanTab != null ? cleanTab.Length : origTab.Length); + if (CCCs != IIIs) + Width = cleanTab.Length * 6; //proportial font (7 chars * 6) + else + Width = GetTextWidth(MyFont, (cleanTab != null ? cleanTab : origTab), symblFontName);//MyFont.CharsToTwips * (cleanTab != null ? cleanTab.Length : origTab.Length); } Rtf = GetRtf(origTab, vFont); - Rtf = Rtf.Replace("\u25CF", @"\f1\u9679?\f0"); // bullet 25CF // jsj- add space after \f0 + if (Rtf.Contains("Caution") && vFont.Family == "VolianScript") + { + // NSP script caution + iTextSharp.text.Font myfont = pdf.GetFont(vFont.Family, 24, 0, iTextSharp.text.Color.BLACK); + if (myfont.BaseFont.CharExists(0x43)) // Capital 'C' exists as text + Rtf = Rtf; // no change necessary + else // Capital 'C' exists as Symbol + //Rtf = Rtf.Replace("Caution", @"\u61507?\u61537?\u61557?\u61556?\u61545?\u61551?\u61550?"); + Rtf = Rtf.Replace("Caution", @"\u61507?a\u61557?t\u61545?o\u61550?"); + } + Rtf = Rtf.Replace("\u25CF", @"\f1\u9679?\f0 "); // bullet 25CF // jsj- add space after \f0 + Rtf = Rtf.Replace("\u0394", @"\f1\u916?\f0 "); // delta 0x0394 if (myparent.MyItemInfo.FormatStepData != null && !myparent.MyItemInfo.FormatStepData.AlwaysTab && myparent.MyItemInfo.MyPrevious != null) { Rtf = Rtf.Replace("Caution:", " "); diff --git a/PROMS/Volian.Svg.Library/iTextSharp.cs b/PROMS/Volian.Svg.Library/iTextSharp.cs index d4524e26..e9377ea4 100644 --- a/PROMS/Volian.Svg.Library/iTextSharp.cs +++ b/PROMS/Volian.Svg.Library/iTextSharp.cs @@ -30,14 +30,15 @@ namespace Volian.Svg.Library { if (!iTextSharp.text.FontFactory.IsRegistered(fontName)) { - foreach (string name in FontKey.GetValueNames()) - { - if (name.StartsWith(fontName)) - { - string fontFile = (string)FontKey.GetValue(name); - iTextSharp.text.FontFactory.Register(fontFile.Contains("\\") ? fontFile : FontFolder + "\\" + fontFile); - } - } + //foreach (string name in FontKey.GetValueNames()) + //{ + // if (name.StartsWith(fontName)) + // { + // string fontFile = (string)FontKey.GetValue(name); + // iTextSharp.text.FontFactory.Register(fontFile.Contains("\\") ? fontFile : FontFolder + "\\" + fontFile); + // } + //} + iTextSharp.text.FontFactory.RegisterDirectories(); } } private static RegistryKey _FontKey = Registry.LocalMachine.OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("Windows NT").OpenSubKey("CurrentVersion").OpenSubKey("Fonts"); @@ -598,6 +599,10 @@ namespace Volian.Svg.Library float fontSize = scale.M(new SvgMeasurement(Font.SizeInPoints, E_MeasurementUnits.PT)); int fontStyle = (Font.Bold ? iTextSharp.text.Font.BOLD : 0) + (Font.Italic ? iTextSharp.text.Font.ITALIC : 0); VolianPdf.RegisterFont(Font.Name); + //if (iTextSharp.text.FontFactory.IsRegistered(Font.Name) == false) + //{ + // //iTextSharp.text.FontFactory.RegisterDirectories(); + //} iTextSharp.text.Font font = FontFactory.GetFont(Font.Name, BaseFont.IDENTITY_H, true, fontSize, fontStyle, new Color(FillColor)); Phrase ph = BuildPhrase(text, fontSize, fontStyle, font); @@ -638,6 +643,12 @@ namespace Volian.Svg.Library private Phrase BuildPhrase(string text, float fontSize, int fontStyle, iTextSharp.text.Font font) { + //if (text == "Caution") + //{ + // if (iTextSharp.text.FontFactory.IsRegistered("VolianScript")) + // Console.WriteLine("Is Registered"); + // Console.WriteLine("stop"); + //} bool fontUnderline = false; float fontTextRise = 0; @@ -704,7 +715,7 @@ namespace Volian.Svg.Library { iTextSharp.text.pdf.FontSelector fs = new FontSelector(); fs.AddFont(font); - if (font.BaseFont.GetWidthPoint("m", 12) == font.BaseFont.GetWidthPoint(".", 12)) + if (font.BaseFont != null && font.BaseFont.GetWidthPoint("m", 12) == font.BaseFont.GetWidthPoint(".", 12)) { VolianPdf.RegisterFont("VESymbFix"); fs.AddFont(FontFactory.GetFont("VESymbFix", BaseFont.IDENTITY_H, true, fontSize, fontStyle, new Color(FillColor))); diff --git a/PROMS/XYPlots/XYPlots.cs b/PROMS/XYPlots/XYPlots.cs index 5f882533..499bd46d 100644 --- a/PROMS/XYPlots/XYPlots.cs +++ b/PROMS/XYPlots/XYPlots.cs @@ -456,6 +456,8 @@ namespace XYPlots // some data only had carriage return, replace these with cr/nl so that following code // will work Buff = Buff.Replace(">\r<", ">\r\n<"); + // some data had cr/cr/nl, change to cr/nl + Buff = Buff.Replace("\r\r\n", "\r\n"); while ((ptr = Buff.IndexOf(">\r\n<", ptr)) > 0) {