Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark TextMetrics#fontBoundingBoxAscent etc. as unimplemented #2364

Open
DiamondMofeng opened this issue Mar 14, 2024 · 1 comment
Open

Mark TextMetrics#fontBoundingBoxAscent etc. as unimplemented #2364

DiamondMofeng opened this issue Mar 14, 2024 · 1 comment

Comments

@DiamondMofeng
Copy link

Issue

I have some need to measure the height of fonts.
But TextMeasure.fontBoundingBoxAscent is always undefined.

It seems that these API are not implemented.
However, the typescript definition provides the relevant definitions.

Maybe it's better to mark these API as unimplemented.

Steps to Reproduce

var Canvas = require('canvas');
var canvas = Canvas.createCanvas(200, 200);
var ctx = canvas.getContext('2d');

ctx.font = "Arial";
const measure = ctx.measureText('test');

console.log(measure.fontBoundingBoxAscent); // undefined;
console.log(measure); 
/*
{
  width: 16.416015625,
  actualBoundingBoxLeft: -1,
  actualBoundingBoxRight: 17.0712890625,
  actualBoundingBoxAscent: 7,
  actualBoundingBoxDescent: 0,
  emHeightAscent: 11,
  emHeightDescent: 3,
  alphabeticBaseline: 1
}
*/

Your Environment

  • Version of node-canvas (output of npm list canvas or yarn list canvas): canvas 2.11.2
  • Environment (e.g. node 20.9.0 on macOS 14.1.1): node v18.18.2
@Crysp
Copy link

Crysp commented Apr 4, 2024

+1 same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants