Now converts 16-bit tables that uses an underline attribute to define a row separator (instead of the dash character)
Uncommented the Script Caution tab logic. Needed for initial NSP compares
This commit is contained in:
parent
2c10b3843b
commit
ce21565a15
@ -3470,9 +3470,94 @@ namespace Volian.Controls.Library
|
|||||||
stepText = stepText.Replace(@"\u9830?", "\xA9"); // diamond, 2666
|
stepText = stepText.Replace(@"\u9830?", "\xA9"); // diamond, 2666
|
||||||
stepText = stepText.Replace(@"\u8593?", "\x18"); // Up Arrow - changes to \xff
|
stepText = stepText.Replace(@"\u8593?", "\x18"); // Up Arrow - changes to \xff
|
||||||
stepText = stepText.Replace(@"\u8595?", "\x19"); // Down Arrow - changes to \xd6
|
stepText = stepText.Replace(@"\u8595?", "\x19"); // Down Arrow - changes to \xd6
|
||||||
|
// Fix "|" followed by a newline - this confuses the table converter
|
||||||
|
stepText = stepText.Replace(@"|\r\n", @"| \r\n");
|
||||||
|
stepText = stepText.Replace(@"|\n\r", @"| \n\r");
|
||||||
|
stepText = stepText.Replace(@"|\n", @"| \n");
|
||||||
|
|
||||||
|
// if the entire row is underlined, then remove the underline and insert a row of dashes
|
||||||
|
stepText = ConvertUnderlineToRow(stepText);
|
||||||
|
|
||||||
return stepText;
|
return stepText;
|
||||||
}
|
}
|
||||||
|
private bool IsPrintableTableChar(char c)
|
||||||
|
{
|
||||||
|
string printablSymbols = "\xB3\xA0\x7F\xF2\xF3\xE4\xE7\xFE\x07\xF7\xF0\xFB\xE2\xE3\xE6\xEB\xE5\x90\xEE\xE9\xEC\xA8\xA9\x18\x19";
|
||||||
|
return (((c > '\x1F') && (c < '\x80')) || (printablSymbols.IndexOf(c) >= 0));
|
||||||
|
}
|
||||||
|
private string ConvertUnderlineToRow(string stepText)
|
||||||
|
{
|
||||||
|
string rtnStr = "";
|
||||||
|
char[] sep = { '\n' };
|
||||||
|
string[] lines = stepText.Split(sep);
|
||||||
|
foreach (string line in lines)
|
||||||
|
{
|
||||||
|
int idx = 0;
|
||||||
|
int chrCnt = 0;
|
||||||
|
int uOnPos = -1;
|
||||||
|
int uOffPos = -1;
|
||||||
|
bool ulineOn = false;
|
||||||
|
char curChar = line[idx];
|
||||||
|
string dashRow = "";
|
||||||
|
while (idx < line.Length && !IsPrintableTableChar(line[idx]))
|
||||||
|
{
|
||||||
|
if (line[idx] == '\xAB') //underline ON
|
||||||
|
{
|
||||||
|
ulineOn = true;
|
||||||
|
uOnPos = idx;
|
||||||
|
}
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
while (ulineOn && idx < line.Length)
|
||||||
|
{
|
||||||
|
if (IsPrintableTableChar(line[idx]))
|
||||||
|
{
|
||||||
|
if (line[idx] == '|' || line[idx] == '\xB3')
|
||||||
|
{
|
||||||
|
dashRow += new string('-', chrCnt);
|
||||||
|
dashRow += "|";
|
||||||
|
chrCnt = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
chrCnt++;
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (line[idx] == '\xBB') //underline OFF
|
||||||
|
{
|
||||||
|
uOffPos = idx;
|
||||||
|
ulineOn = false;
|
||||||
|
while ((idx < line.Length) && !IsPrintableTableChar(line[idx]))
|
||||||
|
{
|
||||||
|
if (line[idx] == '\xAB')
|
||||||
|
ulineOn = true;
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
if (idx == line.Length)
|
||||||
|
ulineOn = true;
|
||||||
|
if (!ulineOn)
|
||||||
|
dashRow = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
string curLine = line;
|
||||||
|
curLine = curLine.Replace('\xB3', '|'); // replace graphic vert bar with DOS vert bar
|
||||||
|
if (ulineOn && idx == line.Length) // entire line is underlined, remove underline, insert row of dashes
|
||||||
|
{
|
||||||
|
curLine = curLine.Replace("\xAB", ""); // remove Underline ON
|
||||||
|
curLine = curLine.Replace("\xBB", ""); // remove Underline OFF
|
||||||
|
dashRow += new string('-', chrCnt);
|
||||||
|
dashRow = "\n" + dashRow;
|
||||||
|
}
|
||||||
|
if (rtnStr.Length > 0) rtnStr += "\n";
|
||||||
|
rtnStr += curLine;
|
||||||
|
rtnStr += dashRow;
|
||||||
|
}
|
||||||
|
return rtnStr;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This will parse a string containing the ascii text of the old style VE-PROMS (16-bit) tables.
|
/// This will parse a string containing the ascii text of the old style VE-PROMS (16-bit) tables.
|
||||||
|
@ -112,7 +112,7 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
public vlnTab(PdfContentByte cb, vlnParagraph myparent, string origTab, string cleanTab, float xoffset, float yoffset, VE_Font vFont, bool doSectTab, string symblFontName, bool removedUnderline)
|
public vlnTab(PdfContentByte cb, vlnParagraph myparent, string origTab, string cleanTab, float xoffset, float yoffset, VE_Font vFont, bool doSectTab, string symblFontName, bool removedUnderline)
|
||||||
{
|
{
|
||||||
//ScriptCaution = (origTab.Contains("Caution") && vFont.Family == "VolianScript");
|
ScriptCaution = (origTab.Contains("Caution") && vFont.Family == "VolianScript");
|
||||||
MyContentByte = cb;
|
MyContentByte = cb;
|
||||||
MyParent = myparent;
|
MyParent = myparent;
|
||||||
YOffset = yoffset;
|
YOffset = yoffset;
|
||||||
@ -121,13 +121,13 @@ namespace Volian.Print.Library
|
|||||||
float CCCs = GetTextWidth(MyFont, "CCCCCCCCCC", symblFontName);
|
float CCCs = GetTextWidth(MyFont, "CCCCCCCCCC", symblFontName);
|
||||||
float IIIs = GetTextWidth(MyFont, "iiiiiiiiii", symblFontName);
|
float IIIs = GetTextWidth(MyFont, "iiiiiiiiii", symblFontName);
|
||||||
string origTab1 = origTab;
|
string origTab1 = origTab;
|
||||||
//if (ScriptCaution)
|
if (ScriptCaution)
|
||||||
//{
|
{
|
||||||
// Text = origTab.Replace("Caution ", "\uF043\uF061\uF069\uF06E\uF06F\uF074\uF075\uF020\uF020");
|
Text = origTab.Replace("Caution ", "\uF043\uF061\uF069\uF06E\uF06F\uF074\uF075\uF020\uF020");
|
||||||
// Width = 90;
|
Width = 90;
|
||||||
//}
|
}
|
||||||
//else if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0)
|
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)
|
//if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0)
|
||||||
Width = (float)myparent.MyItemInfo.FormatStepData.TabData.IdentWidth;
|
Width = (float)myparent.MyItemInfo.FormatStepData.TabData.IdentWidth;
|
||||||
else if (CCCs != IIIs)
|
else if (CCCs != IIIs)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user