F2021-066 some alarm names print past alarm box border & F2021-070 handle long procedure titles

Added comment
BNPP: F2021-066 some alarm names print past alarm box border & F2021-070 handle long procedure titles
This commit is contained in:
Kathy Ruffing 2021-11-09 13:03:25 +00:00
parent 28d361012c
commit 798a4d8058
4 changed files with 41 additions and 2 deletions

Binary file not shown.

View File

@ -1996,7 +1996,7 @@ namespace VEPROMS
set { _otherNumber = value; IsDirty = true; }
}
private string _otherText;
[XmlAttribute("OyherText")]
[XmlAttribute("OyherText")] // 11/3/21: Typo that is in data. Don't fix unless writing code to fix data
public string OtherText
{
get { return _otherText; }

View File

@ -161,8 +161,15 @@ namespace VEPROMS.CSLA.Library
return (LazyLoad(ref _MaxWidthCurPage, "@MaxWidthCurPage"));
}
}
private LazyLoad<int?> _FontShrinkAftLen; // F2021-066 & 070 (text len before shrinking font)
public int? FontShrinkAftLen
{
get
{
return (LazyLoad(ref _FontShrinkAftLen, "@FontShrinkAftLen"));
}
}
#endregion
#region Override ToString
public override string ToString()
{

View File

@ -2686,6 +2686,9 @@ i = 0;
}
}
svgText.Font = pageItem.Font.WindowsFont;
// F2021-070 & 066 - shrink font size of page list items if format has amount
if (pageItem.FontShrinkAftLen != null && pageItem.FontShrinkAftLen > 0)
svgText.FontSize = ShrinkIt(text, svgText, (float)pageItem.FontShrinkAftLen);
float row = (float)pageItem.Row < 0 ? -(float)pageItem.Row : (float)pageItem.Row;
if ((justify & VEPROMS.CSLA.Library.E_Justify.PSTop) == VEPROMS.CSLA.Library.E_Justify.PSTop) row -= ((72 / 6) / 2);
float lcol = pageItem.Col ?? 0;
@ -2705,6 +2708,35 @@ i = 0;
Volian.Base.Library.BaselineMetaFile.WriteLine(" PL x {0} y {1} {2} {3} {4} \"{5}\"", svgText.X, svgText.Y, svgText.FontFamily, svgText.FontSize, svgText.SVGFontStyle, TextForBaseline.FixText(svgText.Text));
return svgText;
}
// F2021-070 & 066 - shrink font size of page list items if format has amount. ShrinkIt compares size (width) of text with input font and
// will decrement font size by one until the text size is less than value from format file.
private static string ShrinkIt(string text, SvgText svgText, float fontShrinkAftLen)
{
int tmpi = 0;
using (var image = new System.Drawing.Bitmap(1, 1))
{
using (var g = System.Drawing.Graphics.FromImage(image))
{
try
{
// pageitem's font size did not have a 'set'. svgtext's fontsize is in format of 12PT, so get font size from that
// and decrement until it is less than format value
System.Drawing.SizeF mySize = g.MeasureString(text, svgText.Font);
while (mySize.Width > fontShrinkAftLen)
{
tmpi = Convert.ToInt32(svgText.FontSize.Substring(0, svgText.FontSize.IndexOf("PT")));
tmpi = tmpi - 1;
svgText.FontSize = tmpi.ToString() + "PT";
mySize = g.MeasureString(text, svgText.Font);
}
}
catch // don't reset if error occurred.
{
}
}
}
return svgText.FontSize;
}
private SvgPart PageItemToSvgText(VEPROMS.CSLA.Library.PageItem pageItem, string text, float yOffset)
{
SvgText svgText = new SvgText();