Fixed the issue where bullets were not printing in some tables.
This commit is contained in:
parent
42ee6dd435
commit
1ebe496589
@ -118,6 +118,13 @@ namespace Volian.Print.Library
|
||||
get { return _DefaultFont; }
|
||||
set { _DefaultFont = value; }
|
||||
}
|
||||
private string _MyDebugID = null;
|
||||
public string MyDebugID
|
||||
{
|
||||
get { return _MyDebugID; }
|
||||
set { _MyDebugID = value; }
|
||||
}
|
||||
|
||||
// public Rtf2iTextSharp(IRtfDocument rtfDoc, Document doc, PdfWriter writer)
|
||||
public Rtf2iTextSharp(IRtfDocument rtfDoc)
|
||||
{
|
||||
@ -223,12 +230,18 @@ namespace Volian.Print.Library
|
||||
break;
|
||||
}
|
||||
}
|
||||
private bool ContainsSymbols(string p)
|
||||
private bool ContainsAllSymbols(string p)
|
||||
{
|
||||
foreach (char c in p)
|
||||
if (c <= '\x7F') return false;
|
||||
return true;
|
||||
}
|
||||
private bool ContainsAnySymbols(string p)
|
||||
{
|
||||
foreach (char c in p)
|
||||
if (c > '\x7F' && c != '\xA0' && c != '\xB0') return true;
|
||||
return false;
|
||||
}
|
||||
protected override void DoVisitText(IRtfVisualText visualText)
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> DoVisitText");
|
||||
@ -246,7 +259,12 @@ namespace Volian.Print.Library
|
||||
// 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" && ContainsSymbols(visualText.Text))
|
||||
// DEBUG
|
||||
//if (visualText.Format.Font.Name != "VESymbFix" && ContainsAnySymbols(visualText.Text))
|
||||
//{
|
||||
// Console.WriteLine("Font: {0} TEXT: {1}", visualText.Format.Font.Name, ShowSpecialCharacters(visualText.Text));
|
||||
//}
|
||||
if (visualText.Format.Font.Name == "VESymbFix" && ContainsAllSymbols(visualText.Text))
|
||||
{
|
||||
fs.AddFont(font);
|
||||
// if the symbol character cannot be found in VESymbFix then check/use the Consolas font
|
||||
@ -264,7 +282,9 @@ namespace Volian.Print.Library
|
||||
}
|
||||
else
|
||||
{
|
||||
Chunk chk = new Chunk(visualText.Text, font);
|
||||
// The bullet character for some unknown reason was entered in a text font rather than a symbol font
|
||||
// switch from x25cf ot x2022 moves to a valid bullet character in the text font
|
||||
Chunk chk = new Chunk(visualText.Text.Replace("\u25cf", "\u2022"), font);
|
||||
AdjustChunk(visualText, font, chk);
|
||||
_MyParagraph.Add(chk);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user