mirror of
https://github.com/wassname/CanvasTextWrapper.git
synced 2026-07-02 00:24:42 +08:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 77617bae67 | |||
| ab03d8fc09 | |||
| 348fd5cfac | |||
| ed3fa124d6 | |||
| 0391cacffa | |||
| 4ae38b6eb8 | |||
| eaf4897b0c |
@@ -1,7 +1,7 @@
|
|||||||
CanvasTextWrapper
|
CanvasTextWrapper
|
||||||
=================
|
=================
|
||||||
|
|
||||||
##Syntax
|
# Syntax
|
||||||
```
|
```
|
||||||
CanvasTextWrapper(HTMLCanvasElement, String [, options]);
|
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.
|
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",
|
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:
|
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");
|
var canvas = document.getElementById("#canvasText");
|
||||||
canvas.width = 200;
|
canvas.width = 200;
|
||||||
canvas.height = 200;
|
canvas.height = 200;
|
||||||
@@ -53,13 +55,12 @@ context.strokeStyle = "#ff0000";
|
|||||||
CanvasTextWrapper(canvas,"Hello"); //default options will apply
|
CanvasTextWrapper(canvas,"Hello"); //default options will apply
|
||||||
```
|
```
|
||||||
|
|
||||||
##Examples
|
# Examples
|
||||||
http://namniak.github.io/CanvasTextWrapper/
|
http://namniak.github.io/CanvasTextWrapper/
|
||||||
|
|
||||||
##Installation
|
# Installation
|
||||||
|
|
||||||
```
|
```
|
||||||
bower install canvas-text-wrapper
|
bower install canvas-text-wrapper
|
||||||
|
npm i canvas-text-wrapper
|
||||||
npm install canvas-text-wrapper
|
|
||||||
```
|
```
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "canvas-text-wrapper",
|
"name": "canvas-text-wrapper",
|
||||||
"version": "0.4.0",
|
"version": "0.4.3",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"**/.*",
|
"**/.*",
|
||||||
"**/*.log",
|
"**/*.log",
|
||||||
|
|||||||
+2
-1
@@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
"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.2",
|
"version": "0.4.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "CanvasTextWrapper.min.js",
|
"main": "CanvasTextWrapper.min.js",
|
||||||
|
"keywords": ["canvas", "canvas text", " text", "split"],
|
||||||
"homepage": "http://namniak.github.io/CanvasTextWrapper/",
|
"homepage": "http://namniak.github.io/CanvasTextWrapper/",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
Reference in New Issue
Block a user