hajimehoshi / ebiten

Ebitengine - A dead simple 2D game engine for Go
https://ebitengine.org
Apache License 2.0
11.1k stars 665 forks source link

text/v2: add `Metrics.CapHeight` and `Metrics.XHeight` #3082

Closed hajimehoshi closed 2 months ago

hajimehoshi commented 2 months ago

Operating System

What feature would you like to be added?

HAscent and CapHeight can vary (e.g. https://x.com/tsurime/status/1831647333840515209)

With golang.org/x/image/font, CapHeight is already defined and we can use it.

With github.com/go-text/typesetting, the situation is a little tricky. I need more investigation.

Why is this needed?

No response

hajimehoshi commented 2 months ago

CapHeight should be available at https://pkg.go.dev/github.com/go-text/typesetting@v0.1.1-0.20240522210117-2c045476f496/font#Face.LineMetric. This requires a non-tagged version.

hajimehoshi commented 2 months ago

There seems an issue in go-text. See https://github.com/go-text/typesetting/issues/169

hajimehoshi commented 2 months ago

I marked this 'breaking-change' since this changes the signature of (*GoTextFaceSource).UnsafeInternal.