Skip to content

Commit

Permalink
update ordering of font style children to resolve .NET validator errors
Browse files Browse the repository at this point in the history
  • Loading branch information
natergj committed Sep 30, 2018
1 parent 9210c8e commit 8a247fd
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions source/lib/style/classes/font.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,8 @@ class Font {
*/
addToXMLele(fontXML) {
let fEle = fontXML.ele('font');
fEle.ele('sz').att('val', this.size !== undefined ? this.size : 12);
fEle.ele('color').att('rgb', this.color !== undefined ? this.color : 'FF000000');
fEle.ele('name').att('val', this.name !== undefined ? this.name : 'Calibri');
if (this.family !== undefined) {
fEle.ele('family').att('val', types.fontFamily[this.family.toLowerCase()]);
}
if (this.scheme !== undefined) {
fEle.ele('scheme').att('val', this.scheme);
}

// Place styling elements first to avoid validation errors with .NET validator
this.condense === true ? fEle.ele('condense') : null;
this.extend === true ? fEle.ele('extend') : null;
this.bold === true ? fEle.ele('b') : null;
Expand All @@ -101,6 +93,17 @@ class Font {
this.underline === true ? fEle.ele('u') : null;
this.vertAlign === true ? fEle.ele('vertAlign') : null;

fEle.ele('sz').att('val', this.size !== undefined ? this.size : 12);
fEle.ele('color').att('rgb', this.color !== undefined ? this.color : 'FF000000');
fEle.ele('name').att('val', this.name !== undefined ? this.name : 'Calibri');
if (this.family !== undefined) {
fEle.ele('family').att('val', types.fontFamily[this.family.toLowerCase()]);
}
if (this.scheme !== undefined) {
fEle.ele('scheme').att('val', this.scheme);
}


return true;
}

Expand Down

0 comments on commit 8a247fd

Please sign in to comment.