This commit is contained in:
Kathy Ruffing 2012-04-17 10:36:48 +00:00
parent 84185d3a45
commit 896e9744fb

View File

@ -984,12 +984,27 @@ namespace Volian.Print.Library
SvgText svgText = new SvgText();
svgText.Text = text;
VEPROMS.CSLA.Library.E_Justify justify = pageItem.Justify ?? VEPROMS.CSLA.Library.E_Justify.PSLeft;
float colAdj16bit = 0;
if ((justify & VEPROMS.CSLA.Library.E_Justify.PSLeft) == VEPROMS.CSLA.Library.E_Justify.PSLeft)
svgText.Justify = SvgJustify.Left;
else if ((justify & VEPROMS.CSLA.Library.E_Justify.PSRight) == VEPROMS.CSLA.Library.E_Justify.PSRight)
svgText.Justify = SvgJustify.Right;
else
{
svgText.Justify = SvgJustify.Center;
if (((justify & VEPROMS.CSLA.Library.E_Justify.PSTrue) != VEPROMS.CSLA.Library.E_Justify.PSTrue) &&
!mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PicaIgnoreFiveSixths)
{
// the default CPI for Proms is 12, in 16bit 12 is the default - if a font wasn't defined
// or when doing a positioning calculation 12 was used. So we need to make an adjustment
// to handle non-12 CPI (12CPI will just cancel out in the following calculation).
// Take the difference between the width in Points of a character at 12CPI and a character
// at the defined font's CPI. Multiply that times the length of title and divide by two
// to find the half-way point.
colAdj16bit = (1 + text.Length) * ((72 / (float)pageItem.Font.CPI) - (72 / 12)) / 2;
}
}
svgText.Font = pageItem.Font.WindowsFont;
float row = (float)pageItem.Row < 0 ? -(float)pageItem.Row : (float)pageItem.Row;
float lcol = pageItem.Col ?? 0;
@ -1002,7 +1017,7 @@ namespace Volian.Print.Library
lcol = (lcol * 25) / dotsPerChar;
}
svgText.X = new SvgMeasurement((float)lcol, E_MeasurementUnits.PT);
svgText.X = new SvgMeasurement((float)lcol - colAdj16bit, E_MeasurementUnits.PT);
svgText.Y = new SvgMeasurement(row, E_MeasurementUnits.PT);
if (svgText.Font.Underline && svgText.Text.EndsWith(" ")) svgText.Text = svgText.Text.Substring(0, svgText.Text.Length - 1) + "\xA0";// replace last space with a hardspace
return svgText;
@ -1012,14 +1027,29 @@ namespace Volian.Print.Library
SvgText svgText = new SvgText();
svgText.Text = text;
VEPROMS.CSLA.Library.E_Justify justify = pageItem.Justify ?? VEPROMS.CSLA.Library.E_Justify.PSLeft;
float colAdj16bit = 0;
if ((justify & VEPROMS.CSLA.Library.E_Justify.PSLeft) == VEPROMS.CSLA.Library.E_Justify.PSLeft)
svgText.Justify = SvgJustify.Left;
else if ((justify & VEPROMS.CSLA.Library.E_Justify.PSRight) == VEPROMS.CSLA.Library.E_Justify.PSRight)
svgText.Justify = SvgJustify.Right;
else
{
svgText.Justify = SvgJustify.Center;
if (((justify & VEPROMS.CSLA.Library.E_Justify.PSTrue) != VEPROMS.CSLA.Library.E_Justify.PSTrue) &&
!MySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PicaIgnoreFiveSixths)
{
// the default CPI for Proms is 12, in 16bit 12 is the default - if a font wasn't defined
// or when doing a positioning calculation 12 was used. So we need to make an adjustment
// to handle non-12 CPI (12CPI will just cancel out in the following calculation).
// Take the difference between the width in Points of a character at 12CPI and a character
// at the defined font's CPI. Multiply that times the length of title and divide by two
// to find the half-way point.
colAdj16bit = (1 + text.Length) * ((72 / (float)pageItem.Font.CPI) - (72 / 12)) / 2;
}
}
svgText.Font = pageItem.Font.WindowsFont;
svgText.X = new SvgMeasurement((float)pageItem.Col, E_MeasurementUnits.PT); // new SvgMeasurement((float)(pageItem.Col ?? 0), E_MeasurementUnits.PT);
svgText.X = new SvgMeasurement((float)pageItem.Col - colAdj16bit, E_MeasurementUnits.PT); // new SvgMeasurement((float)(pageItem.Col ?? 0), E_MeasurementUnits.PT);
svgText.Y = new SvgMeasurement((float)(yOffset + pageItem.Row ?? 0), E_MeasurementUnits.PT);
if (svgText.Font.Underline && svgText.Text.EndsWith(" ")) svgText.Text = svgText.Text.Substring(0, svgText.Text.Length - 1) + "\xA0";// replace last space with a hardspace
return svgText;