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,9 +239,33 @@ 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);
|
||||||
|
AdjustChunk(visualText, font, chk);
|
||||||
|
_MyParagraph.Add(chk);
|
||||||
|
}
|
||||||
|
ProfileTimer.Pop(profileDepth);
|
||||||
|
}
|
||||||
|
|
||||||
Chunk chk = new Chunk(visualText.Text, font);
|
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)
|
||||||
chk.SetUnderline(font.Color, 0, 0.05F, 0, .3F, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size
|
chk.SetUnderline(font.Color, 0, 0.05F, 0, .3F, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size
|
||||||
@ -274,7 +298,7 @@ namespace Volian.Print.Library
|
|||||||
chk.SetTextRise(.25F * chk.Font.Size);
|
chk.SetTextRise(.25F * chk.Font.Size);
|
||||||
if (PrintOverride.CompressSuper) chk.Font.Size = 9;
|
if (PrintOverride.CompressSuper) chk.Font.Size = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (visualText.Format.SuperScript < 0)
|
else if (visualText.Format.SuperScript < 0)
|
||||||
{
|
{
|
||||||
@ -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