Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabe Lerner authored and Gabe Lerner committed May 18, 2019
1 parent 088abbe commit 4b9dee3
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 39 deletions.
30 changes: 17 additions & 13 deletions dist/browser/canvg.js
@@ -1,7 +1,7 @@

/*
* canvg.js - Javascript SVG parser and renderer on Canvas
* version 2.0.0-beta.1
* version 2.0.0
* MIT Licensed
* Gabe Lerner (gabelerner@gmail.com)
* https://github.com/canvg/canvg
Expand Down Expand Up @@ -498,7 +498,7 @@

// points and paths
svg.ToNumberArray = function (s) {
var a = (s || '').match(/-?(\d+(\.\d+)?|\.\d+)(?=\D|$)/gm) || [];
var a = (s || '').match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm) || [];
for (var i = 0; i < a.length; i++) {
a[i] = parseFloat(a[i]);
}
Expand Down Expand Up @@ -1072,17 +1072,21 @@

// font
if (typeof ctx.font != 'undefined') {
ctx.font = svg.Font.CreateFont(
this.style('font-style').value,
this.style('font-variant').value,
this.style('font-weight').value,
this.style('font-size').hasValue() ? this.style('font-size').toPixels() + 'px' : '',
this.style('font-family').value).toString();

// update em size if needed
var currentFontSize = this.style('font-size', false, false);
if (currentFontSize.isPixels()) {
svg.emSize = currentFontSize.toPixels();
if (this.style('font').hasValue()) {
ctx.font = this.style('font').value;
} else {
ctx.font = svg.Font.CreateFont(
this.style('font-style').value,
this.style('font-variant').value,
this.style('font-weight').value,
this.style('font-size').hasValue() ? this.style('font-size').toPixels() + 'px' : '',
this.style('font-family').value).toString();

// update em size if needed
var currentFontSize = this.style('font-size', false, false);
if (currentFontSize.isPixels()) {
svg.emSize = currentFontSize.toPixels();
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion dist/browser/canvg.min.js

Large diffs are not rendered by default.

30 changes: 17 additions & 13 deletions dist/node/canvg.js
@@ -1,7 +1,7 @@

/*
* canvg.js - Javascript SVG parser and renderer on Canvas
* version 2.0.0-beta.1
* version 2.0.0
* MIT Licensed
* Gabe Lerner (gabelerner@gmail.com)
* https://github.com/canvg/canvg
Expand Down Expand Up @@ -497,7 +497,7 @@

// points and paths
svg.ToNumberArray = function (s) {
var a = (s || '').match(/-?(\d+(\.\d+)?|\.\d+)(?=\D|$)/gm) || [];
var a = (s || '').match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm) || [];
for (var i = 0; i < a.length; i++) {
a[i] = parseFloat(a[i]);
}
Expand Down Expand Up @@ -1071,17 +1071,21 @@

// font
if (typeof ctx.font != 'undefined') {
ctx.font = svg.Font.CreateFont(
this.style('font-style').value,
this.style('font-variant').value,
this.style('font-weight').value,
this.style('font-size').hasValue() ? this.style('font-size').toPixels() + 'px' : '',
this.style('font-family').value).toString();

// update em size if needed
var currentFontSize = this.style('font-size', false, false);
if (currentFontSize.isPixels()) {
svg.emSize = currentFontSize.toPixels();
if (this.style('font').hasValue()) {
ctx.font = this.style('font').value;
} else {
ctx.font = svg.Font.CreateFont(
this.style('font-style').value,
this.style('font-variant').value,
this.style('font-weight').value,
this.style('font-size').hasValue() ? this.style('font-size').toPixels() + 'px' : '',
this.style('font-family').value).toString();

// update em size if needed
var currentFontSize = this.style('font-size', false, false);
if (currentFontSize.isPixels()) {
svg.emSize = currentFontSize.toPixels();
}
}
}

Expand Down
43 changes: 31 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4b9dee3

Please sign in to comment.