Automattic / Automattic/node-canvas

fontBoundingBox is not implemented

Open
#1,940 1 comment 2 reactions 0 assignees View on GitHub
Help wanted Text & Fonts
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

## Issue or Feature
- [x] If this is an issue with installation, I have read the [troubleshooting guide](https://github.com/Automattic/node-canvas/issues/1511).

Hi! I was expecting to use fontBoundingBox, but as it turns out there's a TODO in code left and it isn't done. I saw some PR's that said it couldn't be done. Could there be some kind of resolution or workaround to experience the same effect as fontBoundingBox?

In the visible image, I would like to get the blue part. (fontBoundingBox)
![image](https://user-images.githubusercontent.com/81387799/143916085-e1289398-82ea-4fe5-a3ce-0daf3d3b7dfe.png)
## Steps to Reproduce
```js
import Canvas from 'canvas';

const canvas = Canvas.createCanvas(10, 10);

const ctx = canvas.getContext('2d')
const measure = ctx.measureText("woohoo!");

console.log(measure.fontBoundingBoxAscent) // undefined :(
```

## Your Environment
* Version of node-canvas (output of `npm list canvas` or `yarn list canvas`): canvas@2.8.0
* Environment (e.g. node 4.2.0 on Mac OS X 10.8): v16.4.2 on Windows

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.