Skip to content

Commit

Permalink
Merge pull request #11 from adobe-webplatform/issue10
Browse files Browse the repository at this point in the history
Fixes #10 NaNem
  • Loading branch information
DmitryBaranovskiy committed Feb 2, 2015
2 parents 94d919c + 0d460a6 commit 613a649
Show file tree
Hide file tree
Showing 29 changed files with 1,938 additions and 30 deletions.
9 changes: 6 additions & 3 deletions svgWriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,9 @@
break;
case "tspan": {
dealWithTSpan(ctx, sibling, omIn);

if (omIn.children.length) {
mergeTSpans(ctx, sibling, omIn.children);
// break;
}


Expand Down Expand Up @@ -554,7 +553,11 @@
if (leading) {
fontSize = omIn.style["font-size"];
if (fontSize && leading.units === fontSize.units) {
lineEM = util.round1k(leading.value / fontSize.value);
if (fontSize.units) {
lineEM = util.round1k(leading.value / fontSize.value);
} else {
lineEM = util.round1k(leading / fontSize);
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions svgWriterFx.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

this.hasFx = function (ctx) {
return (this.hasEffect(ctx, 'dropShadow') ||
this.hasEffect(ctx, 'gradientFill', this.hasColorNoise) ||
this.hasEffect(ctx, 'gradientFill', this.hasColorNoise) ||
this.hasEffect(ctx, 'solidFill') ||
this.hasSatin(ctx) ||
this.hasEffect(ctx, 'innerShadow'));
Expand Down Expand Up @@ -317,11 +317,11 @@
writeAttrIfNecessary(ctx, 'y', bounds.top);
writeAttrIfNecessary(ctx, 'width', bounds.right - bounds.left);
writeAttrIfNecessary(ctx, 'height', bounds.bottom - bounds.top);
writeAttrIfNecessary(ctx, 'preserveAspectRatio', 'none');
writeAttrIfNecessary(ctx, 'preserveAspectRatio', 'none');
writeAttrIfNecessary(ctx, 'xlink:href', 'data:image/svg+xml;base64,' + base64);
writeln(ctx, '/>');
writeFeComposite(ctx, 'in', {in2: 'SourceGraphic'});

return { l: bounds.left, r: bounds.right, t: bounds.top, b: bounds.bottom, mo: gradientFill.mode, base: base64 };
}

Expand Down
2 changes: 1 addition & 1 deletion tests/data/AdobeLogo-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ module.exports = {
"angle": 120,
"altitude": 30
}
}
}
2 changes: 1 addition & 1 deletion tests/data/filter-duplicate-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,4 +313,4 @@ module.exports = {
"angle": 120,
"altitude": 30
}
}
}
2 changes: 1 addition & 1 deletion tests/data/gradient-color-overlay-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,4 @@ module.exports = {
"angle": 120,
"altitude": 30
}
}
}
2 changes: 1 addition & 1 deletion tests/data/group-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,4 @@ module.exports = {
"angle": 120,
"altitude": 30
}
}
}
2 changes: 1 addition & 1 deletion tests/data/light-global-local-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,4 @@ module.exports = {
"angle": 135,
"altitude": 30
}
}
}
2 changes: 1 addition & 1 deletion tests/data/multi-layer-fx-1-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -980,4 +980,4 @@ module.exports = {
"angle": 45,
"altitude": 30
}
}
}
2 changes: 1 addition & 1 deletion tests/data/multi-layer-fx-2-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,4 @@ module.exports = {
"generatorSettings": false
}
]
}
}
2 changes: 1 addition & 1 deletion tests/data/multi-layer-fx-2-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ module.exports = {
"angle": 90,
"altitude": 30
}
}
}
2 changes: 1 addition & 1 deletion tests/data/multi-layer-fx-3-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,4 +365,4 @@ module.exports = {
"generatorSettings": false
}
]
}
}
2 changes: 1 addition & 1 deletion tests/data/multi-layer-fx-3-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,4 @@ module.exports = {
"angle": 90,
"altitude": 30
}
}
}
2 changes: 1 addition & 1 deletion tests/data/multi-layer-fx-4-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,4 +467,4 @@ module.exports = {
"generatorSettings": false
}
]
}
}
2 changes: 1 addition & 1 deletion tests/data/multi-layer-fx-4-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,4 +304,4 @@ module.exports = {
"angle": 45,
"altitude": 30
}
}
}
2 changes: 1 addition & 1 deletion tests/data/stroke-style-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -690,4 +690,4 @@ module.exports = {
"angle": 120,
"altitude": 30
}
}
}
2 changes: 1 addition & 1 deletion tests/data/svgFill-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,4 @@ module.exports = {
"angle": 120,
"altitude": 30
}
}
}
2 changes: 1 addition & 1 deletion tests/data/svgFill/svgFill-2-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,4 @@ module.exports = {
"angle": 120,
"altitude": 30
}
}
}
2 changes: 1 addition & 1 deletion tests/data/svgFx-inner-glow-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,4 +219,4 @@ module.exports = {
"angle": 120,
"altitude": 30
}
}
}
2 changes: 1 addition & 1 deletion tests/data/svgFx-shadow-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ module.exports = {
"angle": -107,
"altitude": 90
}
}
}
2 changes: 1 addition & 1 deletion tests/data/svgFx-shadow-overlay-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,4 @@ module.exports = {
"angle": -107,
"altitude": 90
}
}
}
2 changes: 1 addition & 1 deletion tests/data/svgGradientOverlay-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -1120,4 +1120,4 @@ module.exports = {
"angle": 120,
"altitude": 30
}
}
}
2 changes: 1 addition & 1 deletion tests/data/svgGradientOverlay-opacity-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,4 @@ module.exports = {
"angle": 90,
"altitude": 30
}
}
}
2 changes: 1 addition & 1 deletion tests/data/svgOverlay-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ module.exports = {
"angle": 120,
"altitude": 30
}
}
}
2 changes: 1 addition & 1 deletion tests/data/svgTextFx-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,4 @@ module.exports = {
"angle": 120,
"altitude": 30
}
}
}
2 changes: 1 addition & 1 deletion tests/data/svgTextGradient-om.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,4 @@ module.exports = {
"angle": 120,
"altitude": 30
}
}
}
Loading

0 comments on commit 613a649

Please sign in to comment.