Print Library, Svg Library, Utils Library, XYPlots
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text;
|
||||
using VEPROMS.CSLA.Library;
|
||||
|
||||
namespace Volian.Print.Library
|
||||
@@ -59,35 +55,21 @@ namespace Volian.Print.Library
|
||||
return (float)_TabOffset * MyFont.CharsToTwips;
|
||||
}
|
||||
}
|
||||
private vlnMacro _MyMacro;
|
||||
public vlnMacro MyMacro
|
||||
{
|
||||
get { return _MyMacro; }
|
||||
set { _MyMacro = value; }
|
||||
}
|
||||
|
||||
private string symblsStr = "\u25CF\u0394"; // string of possible symbol character in a tab
|
||||
// add symbol characters as needed
|
||||
// "\u25CF" - solid bullet
|
||||
// \u0394 - delta
|
||||
public vlnMacro MyMacro { get; set; }
|
||||
|
||||
private System.Drawing.FontStyle GetSysFontStyle(VE_Font f)
|
||||
{
|
||||
if (f.Style == E_Style.Italics)
|
||||
return System.Drawing.FontStyle.Italic;
|
||||
return FontStyle.Regular;
|
||||
}
|
||||
public float GetTextWidth(VE_Font vefont, string txt)
|
||||
{
|
||||
return GetTextWidth(vefont, txt, SymbolFontName);
|
||||
}
|
||||
private float GetTextWidth(VE_Font vefont, string txt, string symblFontName)
|
||||
private readonly string symblsStr = "\u25CF\u0394"; // string of possible symbol character in a tab
|
||||
// add symbol characters as needed
|
||||
// "\u25CF" - solid bullet
|
||||
// \u0394 - delta
|
||||
|
||||
private System.Drawing.FontStyle GetSysFontStyle(VE_Font f) => f.Style == E_Style.Italics ? System.Drawing.FontStyle.Italic : FontStyle.Regular;
|
||||
public float GetTextWidth(VE_Font vefont, string txt) => GetTextWidth(vefont, txt, SymbolFontName);
|
||||
private float GetTextWidth(VE_Font vefont, string txt, string symblFontName)
|
||||
{
|
||||
// follow through in fixing an Out of Window Handles bug, use new function to see if
|
||||
// we can retrieve the font from a dictionary instead a doing a New and using another
|
||||
// window handle B2017-117
|
||||
//System.Drawing.Font font = new System.Drawing.Font(vefont.Family, (float)vefont.Size, GetSysFontStyle(vefont));
|
||||
//System.Drawing.Font symbFont = new System.Drawing.Font(symblFontName, (float)vefont.Size);
|
||||
System.Drawing.Font font = VE_Font.GetWinSysFont(vefont.Family, (float)vefont.Size, GetSysFontStyle(vefont));
|
||||
System.Drawing.Font symbFont = VE_Font.GetWinSysFont(symblFontName, (float)vefont.Size);
|
||||
iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font);
|
||||
@@ -101,30 +83,14 @@ namespace Volian.Print.Library
|
||||
else
|
||||
w += iFont.BaseFont.GetWidthPointKerned(c.ToString(), (float)vefont.Size);
|
||||
}
|
||||
//float w = iFont.BaseFont.GetWidthPointKerned(Text.Replace("\u25CF","@"), (float)vefont.Size);
|
||||
return w;
|
||||
}
|
||||
bool _ScriptCaution = false;
|
||||
|
||||
public bool ScriptCaution
|
||||
{
|
||||
get { return _ScriptCaution; }
|
||||
set { _ScriptCaution = value; }
|
||||
}
|
||||
bool _SeparateBullet = false;
|
||||
public bool ScriptCaution { get; set; } = false;
|
||||
|
||||
public bool SeparateBullet
|
||||
{
|
||||
get { return _SeparateBullet; }
|
||||
set { _SeparateBullet = value; }
|
||||
}
|
||||
private string _SymbolFontName;
|
||||
public string SymbolFontName
|
||||
{
|
||||
get { return _SymbolFontName; }
|
||||
set { _SymbolFontName = value; }
|
||||
}
|
||||
public vlnTab(PdfContentByte cb, vlnParagraph myparent, string origTab, string cleanTab, float xoffset, float yoffset, VE_Font vFont, bool doSectTab, string symblFontName, bool removedUnderline)
|
||||
public bool SeparateBullet { get; set; } = false;
|
||||
public string SymbolFontName { get; set; }
|
||||
public vlnTab(PdfContentByte cb, vlnParagraph myparent, string origTab, string cleanTab, float xoffset, float yoffset, VE_Font vFont, bool doSectTab, string symblFontName, bool removedUnderline)
|
||||
{
|
||||
SymbolFontName = symblFontName;
|
||||
bool alignAsIfBulleted = false;
|
||||
@@ -149,20 +115,14 @@ namespace Volian.Print.Library
|
||||
Width = 90;
|
||||
}
|
||||
else if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0)
|
||||
//if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0)
|
||||
Width = (float)myparent.MyItemInfo.FormatStepData.TabData.IdentWidth;
|
||||
else if (CCCs != IIIs)
|
||||
{
|
||||
float tPtPerChar = myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TabPtsPerChar ?? 6;
|
||||
Width = (tPtPerChar == 0 ? 6 : tPtPerChar) * origTab.Length;
|
||||
// Check the following, it may be needed for FPL:
|
||||
//origTab1 = origTab1.TrimStart(" ".ToCharArray());
|
||||
// 6 = number of points per character. 4 characters between end of tab and beginning of text
|
||||
// origTab1.Trim... is number of non-space characters of the tab string.
|
||||
//Width = 6 * (4 + origTab1.Trim(" ".ToCharArray()).Length);
|
||||
}
|
||||
else
|
||||
Width = GetTextWidth(MyFont, (Text != null ? Text : origTab), symblFontName); //MyFont.CharsToTwips * (Text != null ? Text.Length : origTab.Length);
|
||||
Width = GetTextWidth(MyFont, (Text ?? origTab), symblFontName);
|
||||
|
||||
// Pairie Island (NSP) Caution and Note tabs use a larger font
|
||||
// When using a bullet, we need to use the font size of the Caution/Note text instead of the tab.
|
||||
@@ -195,7 +155,7 @@ namespace Volian.Print.Library
|
||||
Width = (float)myparent.MyItemInfo.FormatStepData.TabData.IdentWidth;
|
||||
else
|
||||
{
|
||||
origTab = origTab + " ";
|
||||
origTab += " ";
|
||||
origTab = origTab.TrimStart(" ".ToCharArray());
|
||||
if (mindx > 2) // ouch!
|
||||
Width = 6f * (origTab.Length - 1); // FPL (macro is after {numeric}) FPL is good with genmac output!
|
||||
@@ -204,7 +164,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
}
|
||||
else
|
||||
Width = GetTextWidth(MyFont, (cleanTab != null ? cleanTab : origTab), symblFontName);//MyFont.CharsToTwips * (cleanTab != null ? cleanTab.Length : origTab.Length);
|
||||
Width = GetTextWidth(MyFont, (cleanTab ?? origTab), symblFontName);//MyFont.CharsToTwips * (cleanTab != null ? cleanTab.Length : origTab.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -219,8 +179,6 @@ namespace Volian.Print.Library
|
||||
int sep = origTab.IndexOfAny(". ".ToCharArray());
|
||||
string prefix = ((vFont.Style & E_Style.Bold) > 0) ? @"\b\ul " : @"\ul ";
|
||||
string suffix = ((vFont.Style & E_Style.Bold) > 0) ? @"\b0\ulnone " : @"\ulnone ";
|
||||
//origTab = @"\ul " + origTab.Substring(0, sep-1) + @"\ulnone" + origTab.Substring(sep-1);
|
||||
//origTab = @"\ul " + origTab.Substring(0, sep) + @"\ulnone" + origTab.Substring(sep);
|
||||
origTab = prefix + origTab.Substring(0, sep) + suffix + origTab.Substring(sep);
|
||||
}
|
||||
|
||||
@@ -238,7 +196,6 @@ namespace Volian.Print.Library
|
||||
// follow through in fixing an Out of Window Handles bug, use new function to see if
|
||||
// we can retrieve the font from a dictionary instead a doing a New and using another
|
||||
// window handle B2017-117
|
||||
//vFont.WindowsFont = new System.Drawing.Font(vFont.Family, (float)vFont.Size, style);
|
||||
vFont.WindowsFont = VE_Font.GetWinSysFont(vFont.Family, (float)vFont.Size, style);
|
||||
int indxC = origTab.IndexOf(":");
|
||||
origTab = @"\ul " + origTab.Substring(0, indxC) + @"\ulnone" + origTab.Substring(indxC);
|
||||
@@ -255,7 +212,6 @@ namespace Volian.Print.Library
|
||||
// follow through in fixing an Out of Window Handles bug, use new function to see if
|
||||
// we can retrieve the font from a dictionary instead a doing a New and using another
|
||||
// window handle B2017-117
|
||||
//vFont.WindowsFont = new System.Drawing.Font(vFont.Family, (float)vFont.Size, style);
|
||||
vFont.WindowsFont = VE_Font.GetWinSysFont(vFont.Family, (float)vFont.Size, style);
|
||||
int indxC = origTab.IndexOf(ut.Text);
|
||||
string prefix = ((vFont.Style & E_Style.Bold) > 0) ? @"\b\ul " : @"\ul ";
|
||||
@@ -294,7 +250,6 @@ namespace Volian.Print.Library
|
||||
(myparent.MyItemInfo.MyPrevious.MyContent.Type == myparent.MyItemInfo.MyContent.Type)))
|
||||
{
|
||||
//if (scriptCaution)
|
||||
// Rtf = Rtf.Replace("CAUTION ", @"\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?");
|
||||
Rtf = Rtf.Replace("Caution:", " ");
|
||||
Rtf = Rtf.Replace("Note:", " ");
|
||||
Rtf = Rtf.Replace("CAUTION:", " ");
|
||||
@@ -305,19 +260,6 @@ namespace Volian.Print.Library
|
||||
Rtf = Rtf.Replace("NOTE", " ");
|
||||
}
|
||||
}
|
||||
//if (ScriptCaution && Rtf.Contains("Caution"))
|
||||
//{
|
||||
// // NSP script caution
|
||||
// iTextSharp.text.Font myfont = pdf.GetFont(vFont.Family, 28, 0, iTextSharp.text.Color.BLACK);
|
||||
// if (!myfont.BaseFont.CharExists(0x43)) // Capital 'C' exists as text
|
||||
// {
|
||||
// //VE_Font vf = new VE_Font("VolianScript", 28, E_Style.Italics, 12);
|
||||
// // Capital 'C' exists as Symbol
|
||||
// Rtf = Rtf.Replace("Caution ", @"\u61507?\u61537?\u61557?\u61556?\u61545?\u61551?\u61550?\u61472?\u61472?");
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
|
||||
// do positioning based on whether format has locations for section 'header'. If it's not centered, treat
|
||||
// it's location more like a 'tab'.
|
||||
@@ -343,7 +285,6 @@ namespace Volian.Print.Library
|
||||
// follow through in fixing an Out of Window Handles bug, use new function to see if
|
||||
// we can retrieve the font from a dictionary instead a doing a New and using another
|
||||
// window handle B2017-117
|
||||
//System.Drawing.Font font = new System.Drawing.Font(MyFont.Family, (float)MyFont.Size);
|
||||
System.Drawing.Font font = VE_Font.GetWinSysFont(MyFont.Family, (float)MyFont.Size);
|
||||
iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font);
|
||||
float w = iFont.BaseFont.GetWidthPointKerned(txt, (float)MyFont.Size);
|
||||
|
||||
Reference in New Issue
Block a user