mirror of
https://github.com/wassname/CanvasTextWrapper.git
synced 2026-07-01 15:24:15 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 66da3411c3 | |||
| a1ba88647e | |||
| 13abe2526c |
@@ -52,7 +52,12 @@
|
|||||||
|
|
||||||
CanvasTextWrapper.prototype = {
|
CanvasTextWrapper.prototype = {
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this.fontSize = parseInt(this.font.replace(/^\D+/g,''),10) || 18;
|
/* Substituting this line that causing a bug with font-weight numeric values */
|
||||||
|
//this.fontSize = parseInt(this.font.replace(/^\D+/g,''),10) || 18;
|
||||||
|
|
||||||
|
/* This line allow font values like : "italic 500 25px" to preserve both numeric a literal value of font-weight*/
|
||||||
|
this.fontSize = this.font.match(/\d+(px|em|\%)/g) ? +this.font.match(/\d+(px|em|\%)/g)[0].match(/\d+/g) : 18;
|
||||||
|
|
||||||
this.textBlockHeight = 0;
|
this.textBlockHeight = 0;
|
||||||
this.lines = [];
|
this.lines = [];
|
||||||
this.newLineIndexes = [];
|
this.newLineIndexes = [];
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "canvas-text-wrapper",
|
"name": "canvas-text-wrapper",
|
||||||
"version": "0.3.0",
|
"version": "0.3.1",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"**/.*",
|
"**/.*",
|
||||||
"**/*.log",
|
"**/*.log",
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "canvas-text-wrapper",
|
"name": "canvas-text-wrapper",
|
||||||
"description": "Pure JavaScript canvas text wrapper that automatically splits a string into lines on specified rule with alignment and padding.",
|
"description": "Pure JavaScript canvas text wrapper that automatically splits a string into lines on specified rule with alignment and padding.",
|
||||||
"version": "0.3.0",
|
"version": "0.3.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "CanvasTextWrapper.min.js",
|
"main": "CanvasTextWrapper.min.js",
|
||||||
"homepage": "http://namniak.github.io/CanvasTextWrapper/",
|
"homepage": "http://namniak.github.io/CanvasTextWrapper/",
|
||||||
|
|||||||
Reference in New Issue
Block a user