Go version
go version go1.22.6 darwin/arm64
Output of go env in your module/workspace:
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/hajimehoshi/Library/Caches/go-build'
GOENV='/Users/hajimehoshi/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/hajimehoshi/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/hajimehoshi/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.6'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/hajimehoshi/ebiten/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/cj/73zbb35j0qx5t4b6rnqq0__h0000gn/T/go-build3402016389=/tmp/go-build -gno-record-gcc-switches -fno-common'
What did you do?
- Download
MPLUS1p-Regular.ttf at https://fonts.google.com/specimen/M+PLUS+1p
- Run this program
package main
import (
"fmt"
"os"
"golang.org/x/image/font/opentype"
)
func showMetrics() error {
file, err := os.ReadFile("MPLUS1p-Regular.ttf")
if err != nil {
return err
}
f, err := opentype.Parse(file)
if err != nil {
return err
}
face, err := opentype.NewFace(f, &opentype.FaceOptions{
Size: 12,
DPI: 72,
})
if err != nil {
return err
}
m := face.Metrics()
fmt.Printf("x-height: %s\n", m.XHeight.String())
fmt.Printf("cap-height: %s\n", m.CapHeight.String())
return nil
}
func main() {
if err := showMetrics(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
What did you see happen?
Negative values are shown
x-height: -6:15
cap-height: -8:49
What did you expect to see?
Positive values are shown
Go version
go version go1.22.6 darwin/arm64
Output of
go envin your module/workspace:What did you do?
MPLUS1p-Regular.ttfat https://fonts.google.com/specimen/M+PLUS+1pWhat did you see happen?
Negative values are shown
What did you expect to see?
Positive values are shown