This commit is contained in:
Kathy Ruffing 2010-07-23 12:35:44 +00:00
parent 7e80c5be8b
commit 7ae193db00

View File

@ -77,10 +77,11 @@ namespace Volian.Print.Library
} }
public static void Reset() public static void Reset()
{ {
_TextColor = System.Drawing.Color.Empty; DebugColor = System.Drawing.Color.Empty;
_SvgColor = System.Drawing.Color.Empty; TextColor = System.Drawing.Color.Empty;
_BoxColor = System.Drawing.Color.Empty; SvgColor = System.Drawing.Color.Empty;
_ChangeBarColor = System.Drawing.Color.Empty; BoxColor = System.Drawing.Color.Empty;
ChangeBarColor = System.Drawing.Color.Empty;
} }
} }
public class Rtf2iTextSharp : RtfVisualVisitorBase public class Rtf2iTextSharp : RtfVisualVisitorBase
@ -167,20 +168,6 @@ namespace Volian.Print.Library
break; break;
} }
} }
//public static iTextSharp.text.Font GetFont(string fontName)
//{
// RegisterFont(fontName);
// //if(fontName.Contains("Sym"))
// return iTextSharp.text.FontFactory.GetFont(fontName, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
// //else
// // return iTextSharp.text.FontFactory.GetFont(fontName,BaseFont.CP1252 ,BaseFont.EMBEDDED);
//}
//public static iTextSharp.text.Font GetFont(string fontName)
//{
// RegisterFont(fontName);
// return iTextSharp.text.FontFactory.GetFont(fontName);
//}
public static void RegisterFont(string fontName) public static void RegisterFont(string fontName)
{ {
if (!iTextSharp.text.FontFactory.IsRegistered(fontName)) if (!iTextSharp.text.FontFactory.IsRegistered(fontName))
@ -214,15 +201,10 @@ namespace Volian.Print.Library
} }
protected override void DoVisitText(IRtfVisualText visualText) protected override void DoVisitText(IRtfVisualText visualText)
{ {
//Console.WriteLine("'{0}' {1} {2} {3} {4}", ShowSpecialCharacters(visualText.Text), visualText.Kind, visualText.Format.Font.Name, visualText.Format.FontSize, visualText.Format.SuperScript);
if (visualText.Format.IsHidden) return; if (visualText.Format.IsHidden) return;
iTextSharp.text.Font font = GetFont(visualText.Format.Font.Name, visualText.Format.FontSize, iTextSharp.text.Font font = GetFont(visualText.Format.Font.Name, visualText.Format.FontSize,
(visualText.Format.IsBold ? iTextSharp.text.Font.BOLD : 0) + (visualText.Format.IsBold ? iTextSharp.text.Font.BOLD : 0) +
(visualText.Format.IsItalic ? iTextSharp.text.Font.ITALIC : 0)); (visualText.Format.IsItalic ? iTextSharp.text.Font.ITALIC : 0));
//Console.WriteLine("after font = {0} {1} {2}", font.Familyname, font.Size, font.Style);
//iTextSharp.text.Font font = FontFactory.GetFont(visualText.Format.Font.Name, BaseFont.IDENTITY_H, BaseFont.EMBEDDED,
// visualText.Format.FontSize / 2F);// TODO: Don't know why this is 2.4 rather than 2.
//font.SetStyle((visualText.Format.IsBold ? iTextSharp.text.Font.BOLD : 0) + (visualText.Format.IsItalic ? iTextSharp.text.Font.ITALIC : 0));
font.Color = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(visualText.Format.ForegroundColor.AsDrawingColor)); font.Color = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(visualText.Format.ForegroundColor.AsDrawingColor));
Chunk chk = new Chunk(visualText.Text, font); Chunk chk = new Chunk(visualText.Text, font);
if(visualText.Format.BackgroundColor.AsDrawingColor.ToArgb() != System.Drawing.Color.White.ToArgb()) if(visualText.Format.BackgroundColor.AsDrawingColor.ToArgb() != System.Drawing.Color.White.ToArgb())
@ -235,9 +217,6 @@ namespace Volian.Print.Library
chk.SetTextRise(.45F * chk.Font.Size); chk.SetTextRise(.45F * chk.Font.Size);
else if (visualText.Format.SuperScript < 0) else if (visualText.Format.SuperScript < 0)
chk.SetTextRise(-.25F * chk.Font.Size); chk.SetTextRise(-.25F * chk.Font.Size);
//else
// chk.SetTextRise(0);
//Console.WriteLine("\"RTF FontSize\",{0},{1}", visualText.Format.FontSize / 2,chk.Font.Size);
if (_MyFont == null) if (_MyFont == null)
{ {