Adjustments for NSP EOP and AOP formats

Modified font inheritance logic and disable inheritance logic for PageList items – see comment in the code
This commit is contained in:
2013-02-12 17:46:57 +00:00
parent 3862704bc9
commit eba3b28c49
2 changed files with 137 additions and 23 deletions

View File

@@ -651,7 +651,7 @@ namespace fmtxml
}
}
bool didLineDraw = false;
for (short i=0;i<numpgstyles;i++)
for (short i = 0; i < numpgstyles; i++)
{
PageStyle pg = new PageStyle();
pg.Index=i;
@@ -738,7 +738,17 @@ namespace fmtxml
}
if (didNewPageStyle) pgs[numpgstyles] = AddPageStyles(fname);
brFmt.Close();
DoPSFontInherit(ref pgstyles);
// Don't do the font inheritance for the pagelist
// you can have multiple docsytles point/use the same pagelist,
// with each docstyle having different default font information.
// The DoPSFontInherit() was calucating the font inheritance based on the font
// set to the overall format, but the PROMS print module checks the docstyle default font
// In NSP's case, the overall format uses an Arial font, the pagelist item uses
// an Arial font, but the docstyle default font is Prestige Elite Tall.
// the results from DoPSFontInherit() kept only the font size and style for the pagelist item.
// the print module then ended up using Prestige Elite Tall instead of Arial for that pagelist item
// - jsj 02/11/13
//DoPSFontInherit(ref pgstyles);
AddPlantSpecific(fname, ref pgstyles);
// First serialize files based on the above - then use xsl to transform
@@ -1340,40 +1350,60 @@ namespace fmtxml
}
return true;
}
private void CompareFonts(VE_Font parFont, ref VE_Font subFont)
private bool CompareFonts(VE_Font parFont, ref VE_Font subFont)
{
bool rtval = false;
if (parFont != null && subFont != null)
{
if (parFont.FontFamily == subFont.FontFamily) subFont.FontFamily = null;
if (parFont.FontSize == subFont.FontSize) subFont.FontSize = null;
if (parFont.FontStyle == subFont.FontStyle) subFont.FontStyle = null;
if (parFont.CPI == subFont.CPI) subFont.CPI = null;
}
}
private void DoPSFontInherit(ref PageStyles pagstyles)
{
for (int i=0; i<pagstyles.PgStyles.Length; i++)
{
for (int j = 0; j < pagstyles.PgStyles[i].Items.Length; j++)
if (parFont.FontFamily == subFont.FontFamily)
{
CompareFonts(DefPlantFont, ref pagstyles.PgStyles[i].Items[j].Style);
CompareFonts(DefBaseFont, ref pagstyles.PgStyles[i].Items[j].Style);
subFont.FontFamily = null;
rtval = true;
}
if (rtval && parFont.FontSize == subFont.FontSize)
{
subFont.FontSize = null;
}
if (rtval && parFont.FontStyle == subFont.FontStyle)
{
subFont.FontStyle = null;
}
if (rtval && parFont.CPI == subFont.CPI)
{
subFont.CPI = null;
}
}
return rtval;
}
//private void DoPSFontInherit(ref PageStyles pagstyles)
//{
// for (int i=0; i<pagstyles.PgStyles.Length; i++)
// {
// for (int j = 0; j < pagstyles.PgStyles[i].Items.Length; j++)
// {
// bool doInheritance;
// doInheritance = CompareFonts(DefPlantFont, ref pagstyles.PgStyles[i].Items[j].Style);
// if (doInheritance)
// CompareFonts(DefBaseFont, ref pagstyles.PgStyles[i].Items[j].Style);
// }
// }
//}
private void DoDSFontInherit(ref DocStyles docstyles)
{
// loop through all of the document styles. For each, check font inheritance
// for End Message Style, Continue Message Style & main document style.
for (int i=0; i<docstyles.DcStyles.Length; i++)
{
CompareFonts(docstyles.DcStyles[i].dstyle, ref docstyles.DcStyles[i].EndStyle);
CompareFonts(DefPlantFont, ref docstyles.DcStyles[i].EndStyle);
CompareFonts(DefBaseFont, ref docstyles.DcStyles[i].EndStyle);
CompareFonts(docstyles.DcStyles[i].dstyle, ref docstyles.DcStyles[i].ContStyle);
CompareFonts(DefPlantFont, ref docstyles.DcStyles[i].ContStyle);
CompareFonts(DefBaseFont, ref docstyles.DcStyles[i].ContStyle);
CompareFonts(DefPlantFont, ref docstyles.DcStyles[i].dstyle);
bool doInheritance;
doInheritance =CompareFonts(docstyles.DcStyles[i].dstyle, ref docstyles.DcStyles[i].EndStyle);
if (doInheritance)
CompareFonts(DefPlantFont, ref docstyles.DcStyles[i].EndStyle);
if (doInheritance)
CompareFonts(DefBaseFont, ref docstyles.DcStyles[i].EndStyle);
if (doInheritance)
CompareFonts(DefPlantFont, ref docstyles.DcStyles[i].ContStyle);
if (doInheritance)
CompareFonts(DefPlantFont, ref docstyles.DcStyles[i].dstyle);
// The default font for the DocStyle only inherit from the Plant Format not from Base format
// This allows pagelist items to inherit from the section's default font setting when printing.
//CompareFonts(DefBaseFont, ref docstyles.DcStyles[i].dstyle);