If a symbol to be printed is not in the VESymFix font then check/use the Consolas font.
This commit is contained in:
parent
957499d93c
commit
5f117cf611
@ -239,8 +239,32 @@ namespace Volian.Print.Library
|
|||||||
// the size change, the overlays did not match up. It seems that the 16bit font size may be inaccurate
|
// the size change, the overlays did not match up. It seems that the 16bit font size may be inaccurate
|
||||||
// and the 16bit conversion to be pdf may be off.
|
// and the 16bit conversion to be pdf may be off.
|
||||||
//if (font.Familyname.StartsWith("Arial") && font.Size == 11 && DoingComparison) font.Size = 11.15f;
|
//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")
|
||||||
|
{
|
||||||
|
fs.AddFont(FontFactory.GetFont("VESymbFix", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, visualText.Format.FontSize / 2,
|
||||||
|
(visualText.Format.IsBold ? iTextSharp.text.Font.BOLD : 0) +
|
||||||
|
(visualText.Format.IsItalic ? iTextSharp.text.Font.ITALIC : 0), font.Color));
|
||||||
|
// if the symbol character cannot be found in VESymbFix then check/use the Consolas font
|
||||||
|
fs.AddFont(FontFactory.GetFont("Consolas", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, (visualText.Format.FontSize*1.1F) / 2,
|
||||||
|
(visualText.Format.IsBold ? iTextSharp.text.Font.BOLD : 0) +
|
||||||
|
(visualText.Format.IsItalic ? iTextSharp.text.Font.ITALIC : 0), font.Color));
|
||||||
|
Phrase ph = fs.Process(visualText.Text);
|
||||||
|
foreach (Chunk chk in ph.Chunks)
|
||||||
|
AdjustChunk(visualText, font, chk);
|
||||||
|
_MyParagraph.Add(ph);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Chunk chk = new Chunk(visualText.Text, font);
|
Chunk chk = new Chunk(visualText.Text, font);
|
||||||
|
AdjustChunk(visualText, font, chk);
|
||||||
|
_MyParagraph.Add(chk);
|
||||||
|
}
|
||||||
|
ProfileTimer.Pop(profileDepth);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AdjustChunk(IRtfVisualText visualText, iTextSharp.text.Font font, Chunk chk)
|
||||||
|
{
|
||||||
if (visualText.Format.BackgroundColor.AsDrawingColor.ToArgb() != System.Drawing.Color.White.ToArgb())
|
if (visualText.Format.BackgroundColor.AsDrawingColor.ToArgb() != System.Drawing.Color.White.ToArgb())
|
||||||
chk.SetBackground(new iTextSharp.text.Color(visualText.Format.BackgroundColor.AsDrawingColor));
|
chk.SetBackground(new iTextSharp.text.Color(visualText.Format.BackgroundColor.AsDrawingColor));
|
||||||
if (visualText.Format.IsStrikeThrough)
|
if (visualText.Format.IsStrikeThrough)
|
||||||
@ -310,8 +334,6 @@ namespace Volian.Print.Library
|
|||||||
_MyFont = font;
|
_MyFont = font;
|
||||||
_MyParagraph.Font = _MyFont;
|
_MyParagraph.Font = _MyFont;
|
||||||
}
|
}
|
||||||
_MyParagraph.Add(chk);
|
|
||||||
ProfileTimer.Pop(profileDepth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ShowSpecialCharacters(string p)
|
private string ShowSpecialCharacters(string p)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user