From 1aa10bf9cd6f290eda315d914bbf8914de8096dd Mon Sep 17 00:00:00 2001 From: John Date: Thu, 9 Jan 2014 14:15:41 +0000 Subject: [PATCH] Fixed issue where the Note tab was not always being underlined --- PROMS/Volian.Print.Library/vlnPrintObject.cs | 34 +++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/PROMS/Volian.Print.Library/vlnPrintObject.cs b/PROMS/Volian.Print.Library/vlnPrintObject.cs index 3790cbd1..d9019fee 100644 --- a/PROMS/Volian.Print.Library/vlnPrintObject.cs +++ b/PROMS/Volian.Print.Library/vlnPrintObject.cs @@ -259,11 +259,43 @@ namespace Volian.Print.Library //DisplayText vlntxt = new DisplayText(text.TrimStart(" ".ToCharArray()), vFont, false); DisplayText vlntxt = new DisplayText(text, vFont, false); //rtfSB.Append(AddFontTable(vlntxt.TextFont.WindowsFont)); - rtfSB.Append(AddFontTable(vFont.WindowsFont)); + //rtfSB.Append(AddFontTable(vFont.WindowsFont)); + rtfSB.Append(AddFontTable(vFont)); rtfSB.Append(vlntxt.StartText); rtfSB.Append("}"); return rtfSB.ToString(); } + public static string AddFontTable(VE_Font vfont) + { + System.Drawing.Font font = vfont.WindowsFont; + StringBuilder rtfSB = new StringBuilder(); + StringBuilder sbbeg = new StringBuilder(); + StringBuilder sbend = new StringBuilder(); + if ((vfont.Style & E_Style.Bold) > 0) + { + sbbeg.Append(@"\b"); + sbend.Append(@"\b0"); + } + if ((vfont.Style & E_Style.Underline) > 0) + { + sbbeg.Append(@"\ul"); + sbend.Insert(0, @"\ulnone"); + } + if ((vfont.Style & E_Style.Italics) > 0) + { + sbbeg.Append(@"\i"); + sbend.Insert(0, @"\i0"); + } + rtfSB.Append(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 " + font.FontFamily.Name + @";}"); //}\f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}}"; + if (!FontIsFixed(font)) + rtfSB.Append(@"{\f1\fnil\fcharset0 Arial Unicode MS;}}{\colortbl ;\red255\green0\blue0;}"); + else + rtfSB.Append(@"{\f1\fnil\fcharset0 VESymbFix;}}{\colortbl ;\red255\green0\blue0;}"); + rtfSB.Append("\r\n"); + // use styles to construct rtf commands to insert into next line (where \b, etc is) + rtfSB.Append(@"\viewkind4\uc1\pard\sl-240\slmult0" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(font.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}"; + return rtfSB.ToString(); + } public static string AddFontTable(System.Drawing.Font font) { StringBuilder rtfSB = new StringBuilder();