Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zhw2590582/fix-text-baseline
Wrapper for canvas.getContext, designed to fix differences in textBaseline in different browsers
https://github.com/zhw2590582/fix-text-baseline
canvas chrome edge firefox fixbug safari textbaseline
Last synced: about 1 month ago
JSON representation
Wrapper for canvas.getContext, designed to fix differences in textBaseline in different browsers
- Host: GitHub
- URL: https://github.com/zhw2590582/fix-text-baseline
- Owner: zhw2590582
- License: mit
- Created: 2020-04-15T08:45:33.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-04-16T00:52:33.000Z (over 4 years ago)
- Last Synced: 2024-05-22T15:43:52.200Z (6 months ago)
- Topics: canvas, chrome, edge, firefox, fixbug, safari, textbaseline
- Language: JavaScript
- Homepage: https://zhw2590582.github.io/fix-text-baseline/
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fix-text-baseline
> Wrapper for canvas.getContext, designed to fix differences in textBaseline in different browsers
## Install
Install with `npm`
```bash
$ npm install fix-text-baseline
```Or install with `yarn`
```bash
$ yarn add fix-text-baseline
``````js
import fixTextBaseline from "fix-text-baseline";
```Or umd builds are also available
```html
```
Will expose the global variable to `window.fixTextBaseline`.
## Usage
```js
var canvas = document.createElement("canvas");
var ctx = fixTextBaseline(canvas.getContext("2d"));
ctx.font = "40px Arial";
ctx.fillText("test", 0, 10);
```## License
MIT © [Harvey Zack](https://sleepy.im/)