Skip to content

Commit

Permalink
v0.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
shellyln committed Sep 11, 2018
1 parent 8811d54 commit 898b2e6
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 29 deletions.
2 changes: 1 addition & 1 deletion packages/_debug_app/package-lock.json

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

8 changes: 4 additions & 4 deletions packages/_debug_app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "red-agate-debug-env",
"private": true,
"version": "0.2.5",
"version": "0.2.6",
"description": "red-agate debug environment",
"keywords": [],
"main": "./dist/app.js",
Expand All @@ -17,10 +17,10 @@
"puppeteer": "^1.7.0"
},
"peerDependencies": {
"red-agate": "^0.2.5",
"red-agate-barcode": "^0.2.5",
"red-agate": "^0.2.6",
"red-agate-barcode": "^0.2.6",
"red-agate-math": "^0.2.0",
"red-agate-svg-canvas": "^0.2.5",
"red-agate-svg-canvas": "^0.2.6",
"red-agate-util": "^0.2.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/_lib-dist/package-lock.json

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

10 changes: 5 additions & 5 deletions packages/_lib-dist/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "red-agate-lib-dist",
"private": true,
"version": "0.2.5",
"version": "0.2.6",
"description": "red-agate debug environment",
"keywords": [],
"main": "./dist/app.js",
Expand All @@ -17,11 +17,11 @@
"puppeteer": "^1.7.0"
},
"peerDependencies": {
"red-agate": "^0.2.5",
"red-agate-barcode": "^0.2.5",
"red-agate": "^0.2.6",
"red-agate-barcode": "^0.2.6",
"red-agate-math": "^0.2.0",
"red-agate-react-host": "^0.2.5",
"red-agate-svg-canvas": "^0.2.5",
"red-agate-react-host": "^0.2.6",
"red-agate-svg-canvas": "^0.2.6",
"red-agate-util": "^0.2.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/red-agate-barcode/package-lock.json

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

6 changes: 3 additions & 3 deletions packages/red-agate-barcode/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "red-agate-barcode",
"private": false,
"version": "0.2.5",
"version": "0.2.6",
"description": "red-agate barcode tag library.",
"keywords": [
"QR Code",
Expand All @@ -24,9 +24,9 @@
},
"dependencies": {},
"peerDependencies": {
"red-agate": "^0.2.5",
"red-agate": "^0.2.6",
"red-agate-math": "^0.2.0",
"red-agate-svg-canvas": "^0.2.5",
"red-agate-svg-canvas": "^0.2.6",
"red-agate-util": "^0.2.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/red-agate-react-host/package-lock.json

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

6 changes: 3 additions & 3 deletions packages/red-agate-react-host/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "red-agate-react-host",
"private": false,
"version": "0.2.5",
"version": "0.2.6",
"description": "Using react componetns from RedAgate.",
"keywords": [
"RedAgate",
Expand All @@ -17,9 +17,9 @@
},
"dependencies": {},
"peerDependencies": {
"red-agate": "^0.2.5",
"red-agate": "^0.2.6",
"red-agate-math": "^0.2.0",
"red-agate-svg-canvas": "^0.2.5",
"red-agate-svg-canvas": "^0.2.6",
"red-agate-util": "^0.2.0",
"react": "^16.4.2",
"react-dom": "^16.4.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/red-agate-svg-canvas/package-lock.json

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

2 changes: 1 addition & 1 deletion packages/red-agate-svg-canvas/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "red-agate-svg-canvas",
"private": false,
"version": "0.2.5",
"version": "0.2.6",
"description": "red-agate svg canvas library.",
"keywords": [
"SVG",
Expand Down
16 changes: 14 additions & 2 deletions packages/red-agate-svg-canvas/src/drawing/canvas/SvgCanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1410,8 +1410,17 @@ export class SvgCanvas implements VectorCanvas2D {
this.content += "</g>";
}


// tslint:disable-next-line:variable-name
private _fontHeightRatio = 1.25;
public get fontHeightRatio(): number {
return this._fontHeightRatio;
}
public set fontHeightRatio(value: number) {
this._fontHeightRatio = value;
}
public measureText(text: string): { width: number; } {
const re = this.font.match(/(\d+(?:.\d+))(px|pt|in|mm|em|rem|%)/);
const re = this.font.match(/(\d+(?:.\d+)?)(px|pt|in|mm|em|rem|%)/);
let scale = 1;
let size = 12;
if (re) {
Expand All @@ -1437,7 +1446,10 @@ export class SvgCanvas implements VectorCanvas2D {
}
size = Number.parseFloat(re[1]);
}
return { width: scale * size * text.length };
return { width: Math.round(scale * size * Array.from(text
.replace(/[\u200B-\u200D\uFEFF\u200E\u200F]/g, '')
.normalize('NFKC')).length / this.fontHeightRatio)
};
}

public clearRect(x: number, y: number, w: number, h: number): void {
Expand Down
8 changes: 4 additions & 4 deletions packages/red-agate/package-lock.json

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

4 changes: 2 additions & 2 deletions packages/red-agate/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "red-agate",
"private": false,
"version": "0.2.5",
"version": "0.2.6",
"description": "Static HTML|XML|SVG renderer using JSX, suitable for report output.",
"keywords": [
"svg",
Expand All @@ -27,7 +27,7 @@
},
"dependencies": {
"red-agate-math": "^0.2.0",
"red-agate-svg-canvas": "^0.2.5",
"red-agate-svg-canvas": "^0.2.6",
"red-agate-util": "^0.2.0"
},
"peerDependencies": {
Expand Down

0 comments on commit 898b2e6

Please sign in to comment.