Append an ellipsis to a string that exceeds a specified max-width.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
History.md
Makefile
Readme.md
component.json
index.js

Readme.md

canvas-text-ellipsis

Append an ellipsis to a string that exceeds a specified max-width. Source.

Installation

$ component install bmcmahen/canvas-text-ellipsis

API

var fitString = require('bmcmahen-canvas-text-ellipsis');
ctx.fillText(fitString(ctx, 'a string to truncate', 100), 50, 20);

License

MIT