mirror of
https://github.com/wassname/CanvasTextWrapper.git
synced 2026-06-28 01:27:57 +08:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 77617bae67 | |||
| ab03d8fc09 | |||
| 348fd5cfac | |||
| ed3fa124d6 | |||
| 0391cacffa | |||
| 4ae38b6eb8 | |||
| eaf4897b0c |
@@ -1,7 +1,7 @@
|
||||
CanvasTextWrapper
|
||||
=================
|
||||
|
||||
##Syntax
|
||||
# Syntax
|
||||
```
|
||||
CanvasTextWrapper(HTMLCanvasElement, String [, options]);
|
||||
```
|
||||
@@ -23,7 +23,7 @@ CanvasTextWrapper(HTMLCanvasElement, String [, options]);
|
||||
|
||||
NOTE: if a single word is too long to fit the width with specified font size, it will break on any letter unless ```sizeToFill``` option is enabled.
|
||||
|
||||
##Defaults
|
||||
# Defaults
|
||||
```
|
||||
{
|
||||
font: "18px Arial, sans-serif",
|
||||
@@ -41,9 +41,11 @@ NOTE: if a single word is too long to fit the width with specified font size, it
|
||||
}
|
||||
```
|
||||
|
||||
##Usage
|
||||
# Usage
|
||||
Configure context settings properties such as "fillStyle", "lineWidth" or "strokeStyle" before using CanvasTextWrapper like so:
|
||||
```
|
||||
var CanvasTextWrapper = require('canvas-text-wrapper').CanvasTextWrapper;
|
||||
|
||||
var canvas = document.getElementById("#canvasText");
|
||||
canvas.width = 200;
|
||||
canvas.height = 200;
|
||||
@@ -53,13 +55,12 @@ context.strokeStyle = "#ff0000";
|
||||
CanvasTextWrapper(canvas,"Hello"); //default options will apply
|
||||
```
|
||||
|
||||
##Examples
|
||||
# Examples
|
||||
http://namniak.github.io/CanvasTextWrapper/
|
||||
|
||||
##Installation
|
||||
# Installation
|
||||
|
||||
```
|
||||
bower install canvas-text-wrapper
|
||||
|
||||
npm install canvas-text-wrapper
|
||||
npm i canvas-text-wrapper
|
||||
```
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "canvas-text-wrapper",
|
||||
"version": "0.4.0",
|
||||
"version": "0.4.3",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"**/*.log",
|
||||
|
||||
+3
-2
@@ -1,9 +1,10 @@
|
||||
{
|
||||
"name": "canvas-text-wrapper",
|
||||
"description": "Pure JavaScript canvas text wrapper that automatically splits a string into lines on specified rule with alignment and padding.",
|
||||
"version": "0.3.2",
|
||||
"version": "0.4.3",
|
||||
"license": "MIT",
|
||||
"main": "CanvasTextWrapper.min.js",
|
||||
"keywords": ["canvas", "canvas text", " text", "split"],
|
||||
"homepage": "http://namniak.github.io/CanvasTextWrapper/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -17,4 +18,4 @@
|
||||
"grunt-contrib-uglify": "^0.9.1",
|
||||
"uglify-save-license": "^0.4.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user