Fixed logic for displaying (on the screen) a Caution tab that uses a larger point size then the caution text (NSP)
This commit is contained in:
		| @@ -111,6 +111,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) | ||||||
| 		{ | 		{ | ||||||
|  | 			bool alignAsIfBulleted = false; | ||||||
| 			ScriptCaution = (origTab.Contains("Caution") && vFont.Family == "VolianScript"); | 			ScriptCaution = (origTab.Contains("Caution") && vFont.Family == "VolianScript"); | ||||||
| 			MyContentByte = cb; | 			MyContentByte = cb; | ||||||
| 			MyParent = myparent; | 			MyParent = myparent; | ||||||
| @@ -140,9 +141,18 @@ namespace Volian.Print.Library | |||||||
| 			} | 			} | ||||||
| 			else | 			else | ||||||
| 				Width = GetTextWidth(MyFont, (Text != null ? Text : origTab), symblFontName); //MyFont.CharsToTwips * (Text != null ? Text.Length : origTab.Length); | 				Width = GetTextWidth(MyFont, (Text != null ? Text : origTab), symblFontName); //MyFont.CharsToTwips * (Text != null ? Text.Length : origTab.Length); | ||||||
|  | 			 | ||||||
|  | 			// 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. | ||||||
|  | 			// To do this we set the TabData.Bullet.Separate to true (currently - 4/26/2013 - only NSP uses this). | ||||||
|  | 			// Because of the different font sizes, when the Caution/Note did have have a bullet, the positioning  | ||||||
|  | 			// was off by the lenght of IdentB (the bullet string), thus the "alignAsIfBulleted" bool | ||||||
| 			if ((myparent.MyItemInfo.FormatStepData != null) && myparent.MyItemInfo.FormatStepData.TabData.Bullet.Separate) | 			if ((myparent.MyItemInfo.FormatStepData != null) && myparent.MyItemInfo.FormatStepData.TabData.Bullet.Separate) | ||||||
| 				if (myparent.MyItemInfo.MyPrevious != null || myparent.MyItemInfo.NextItem != null) | 				if (myparent.MyItemInfo.MyPrevious != null || myparent.MyItemInfo.NextItem != null) | ||||||
| 					SeparateBullet = true; | 					SeparateBullet = true; | ||||||
|  | 				else | ||||||
|  | 					alignAsIfBulleted = true; | ||||||
|  |  | ||||||
| 			if (origTab.Contains(@"{!")) | 			if (origTab.Contains(@"{!")) | ||||||
| 			{ | 			{ | ||||||
| 				int mindx = origTab.IndexOf(@"{!"); | 				int mindx = origTab.IndexOf(@"{!"); | ||||||
| @@ -260,13 +270,21 @@ namespace Volian.Print.Library | |||||||
| 			} | 			} | ||||||
| 			else | 			else | ||||||
| 			{ | 			{ | ||||||
| 				//if (MyFont.Family == "Arial" && MyFont.Size == 14) | 				// if using a proportional font and the tab font/size is different than the text font/size | ||||||
| 				//{ | 				if (CCCs != IIIs &&  | ||||||
| 				//    System.Drawing.Font font = new System.Drawing.Font("Arial", 14); | 					(MyFont.Family != myparent.MyItemInfo.FormatStepData.Font.Family || | ||||||
| 				//    iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font); | 					MyFont.Size != myparent.MyItemInfo.FormatStepData.Font.Size)) | ||||||
| 				//    float w = iFont.BaseFont.GetWidthPointKerned(Text, 14); | 				{ | ||||||
| 				//    Width = w; | 					// This is needed for Prairie Island (NSP) Caution/Note tabs to consistantly position | ||||||
| 				//} | 					// them at the same horizontal (column) position on the page | ||||||
|  | 					string txt = Text; | ||||||
|  | 					if (alignAsIfBulleted) | ||||||
|  | 						txt += myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB; | ||||||
|  | 					System.Drawing.Font font = new System.Drawing.Font(MyFont.Family,(float)MyFont.Size); | ||||||
|  | 				    iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font); | ||||||
|  | 					float w = iFont.BaseFont.GetWidthPointKerned(txt, (float)MyFont.Size); | ||||||
|  | 				    Width = w; | ||||||
|  | 				} | ||||||
| 				XOffset = xoffset - Width; | 				XOffset = xoffset - Width; | ||||||
| 			} | 			} | ||||||
| 			 | 			 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user