Skip to content

Commit

Permalink
'deltaY', superscript, subscript etc. (#4177)
Browse files Browse the repository at this point in the history
* Add 'deltaY' attribute

Added 'deltaY' to '_styleProperties' and updated 'getSvgSpanStyles' for 'deltaY' -> 'baseline-shift'

* 'deltaY', superscript, subscript etc.

 Honors 'deltaY' during rendering; provides functionality for 'superscript' & 'subscript'; some bug-fixing
  • Loading branch information
denim2x authored and asturur committed Aug 12, 2017
1 parent ddb9896 commit ffc5cd7
Show file tree
Hide file tree
Showing 4 changed files with 273 additions and 56 deletions.
11 changes: 9 additions & 2 deletions src/mixins/object.svg_export.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

/**
* Returns styles-string for svg-export
* @param {Boolean} skipShadow a boolean to skip shadow filter output
* @param {Object} style the object from which to retrieve style properties
* @return {String}
*/
getSvgSpanStyles: function(style) {
Expand All @@ -71,7 +71,8 @@
fontWeight = style.fontWeight ? 'font-weight: ' + style.fontWeight + '; ' : '',
fill = style.fill ? getSvgColorString('fill', style.fill) : '',
stroke = style.stroke ? getSvgColorString('stroke', style.stroke) : '',
textDecoration = this.getSvgTextDecoration(style);
textDecoration = this.getSvgTextDecoration(style),
deltaY = style.deltaY ? 'baseline-shift: ' + (-style.deltaY) + '; ' : '';

return [
stroke,
Expand All @@ -82,9 +83,15 @@
fontWeight,
textDecoration,
fill,
deltaY,
].join('');
},

/**
* Returns text-decoration property for svg-export
* @param {Object} style the object from which to retrieve style properties
* @return {String}
*/
getSvgTextDecoration: function(style) {
if ('overline' in style || 'underline' in style || 'linethrough' in style) {
return 'text-decoration: ' + (style.overline ? 'overline ' : '') +
Expand Down
Loading

0 comments on commit ffc5cd7

Please sign in to comment.