Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/motiz88/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
https://github.com/motiz88/canvas-text-metrics-polyfill
Last synced: about 1 month ago
JSON representation
A polyfill for the enhanced context.measureText in HTML Canvas v5 / Canvas 2D Context Level 2. Based on https://github.com/Pomax/fontmetrics.js
- Host: GitHub
- URL: https://github.com/motiz88/canvas-text-metrics-polyfill
- Owner: motiz88
- License: mit
- Created: 2014-11-12T21:42:53.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-10-18T19:03:21.000Z (about 6 years ago)
- Last Synced: 2024-09-11T14:09:52.753Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 40 KB
- Stars: 19
- Watchers: 4
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
canvas-text-metrics-polyfill
============================A polyfill for the enhanced `context.measureText()` in HTML `` v5 / Canvas 2D Context Level 2. Based on https://github.com/Pomax/fontmetrics.js.
The upcoming version of `` 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 ``.
API reference
-------------
See:
* https://html.spec.whatwg.org/#drawing-text-to-the-bitmap
* http://www.w3.org/TR/2dcontext2/#drawing-text-to-the-bitmap
* https://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-March/035239.htmlDemo
----
Try the [visual test page](https://rawgit.com/motiz88/canvas-text-metrics-polyfill/master/tests/visual-test.html).Tests and performance
---------------------
TBDSupported browsers
------------------
TBD