Skip to content

A polyfill for the enhanced context.measureText in HTML Canvas v5 / Canvas 2D Context Level 2. Based on https://github.com/Pomax/fontmetrics.js

License

Notifications You must be signed in to change notification settings

motiz88/canvas-text-metrics-polyfill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

canvas-text-metrics-polyfill

A polyfill for the enhanced context.measureText() in HTML <canvas> v5 / Canvas 2D Context Level 2. Based on https://github.com/Pomax/fontmetrics.js.

The upcoming version of <canvas> will offer a standard way to get 2D font metrics, via properties added to the TextMetrics object (returned by context.measureText()). This feature was drafted in March 2012, but virtually all current browsers (as of November 2014) still follow the older spec and only provide the TextMetrics.width property.

This library provides a robust polyfill for the missing metrics on clients with pre-Level 2 <canvas>.

API reference

See:

Demo

Try the visual test page.

Tests and performance

TBD

Supported browsers

TBD

About

A polyfill for the enhanced context.measureText in HTML Canvas v5 / Canvas 2D Context Level 2. Based on https://github.com/Pomax/fontmetrics.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published