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

fontBoundingBox is not implemented #1940

Open
1 task done
fucksophie opened this issue Nov 29, 2021 · 1 comment
Open
1 task done

fontBoundingBox is not implemented #1940

fucksophie opened this issue Nov 29, 2021 · 1 comment

Comments

@fucksophie
Copy link

Issue or Feature

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

Steps to Reproduce

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
@Heroj04
Copy link

Heroj04 commented Feb 28, 2024

sorry if I'm being ignorant here, I've just had a quick look and would
pango_font_metrics_get_ascent() and pango_font_metrics_get_descent()
not work for getting this information?

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

No branches or pull requests

3 participants