Added WrapSameAsEdit check to the RemoveLastCharacter() logic for debug/16-bit compare printing. Also added a check in RemoveLastCharacter() so that if there was only one character in the line of text, to NOT remove it (was removing hard-return characters)

This commit is contained in:
John Jenko 2012-06-12 15:22:25 +00:00
parent 8352358613
commit 86277422a5

View File

@ -121,7 +121,8 @@ namespace Volian.Print.Library
vlnParagraph myParagraph = this as vlnParagraph; vlnParagraph myParagraph = this as vlnParagraph;
if (myParagraph != null) if (myParagraph != null)
{ {
if (myParagraph.MyItemInfo.FormatStepData != null && myParagraph.MyItemInfo.FormatStepData.Font.Family == "Prestige Elite Tall") //if (myParagraph.MyItemInfo.FormatStepData != null && myParagraph.MyItemInfo.FormatStepData.Font.Family == "Prestige Elite Tall")
if (!myParagraph.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.WrapSameAsEdit)
{ {
Chunk chk = RemoveLastCharacter(iParagraph); Chunk chk = RemoveLastCharacter(iParagraph);
float heightAllButOne = GetHeight(cb, iParagraph, width, throwException); float heightAllButOne = GetHeight(cb, iParagraph, width, throwException);
@ -146,11 +147,14 @@ namespace Volian.Print.Library
object obj = iParagraph[iParagraph.Count-1]; object obj = iParagraph[iParagraph.Count-1];
Chunk chk = obj as Chunk; Chunk chk = obj as Chunk;
if (chk == null) if (chk == null)
Console.WriteLine("Here"); return null;
iParagraph.RemoveAt(iParagraph.Count - 1);
string s = chk.Content; string s = chk.Content;
if (s.Length > 1) // don't remove last character if it's the only one
{
iParagraph.RemoveAt(iParagraph.Count - 1);
s = s.Substring(0, s.Length - 1); s = s.Substring(0, s.Length - 1);
iParagraph.Add(new Chunk(s, chk.Font)); iParagraph.Add(new Chunk(s, chk.Font));
}
return chk; return chk;
} }
private static float GetHeight(PdfContentByte cb, Paragraph iParagraph, float width, bool throwException) private static float GetHeight(PdfContentByte cb, Paragraph iParagraph, float width, bool throwException)