go.*,font/opentype,text: switch to latest go-text/typesetting api

This commit upgrades our go-text version to the latest one which internalizes
harfbuzz and supports text truncators. This allows us to drop our dependency
upon Benoit's textlayout package.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
Chris Waldon
2023-03-22 12:11:07 -04:00
committed by Elias Naur
parent d7b1c7c33b
commit 47d25c1394
4 changed files with 73 additions and 64 deletions
+1 -2
View File
@@ -8,7 +8,6 @@ import (
"bytes"
"fmt"
"github.com/benoitkugler/textlayout/fonts/truetype"
"github.com/go-text/typesetting/font"
)
@@ -19,7 +18,7 @@ type Face struct {
// Parse constructs a Face from source bytes.
func Parse(src []byte) (Face, error) {
face, err := truetype.Parse(bytes.NewReader(src))
face, err := font.ParseTTF(bytes.NewReader(src))
if err != nil {
return Face{}, fmt.Errorf("failed parsing truetype font: %w", err)
}