...
1 package d2fonts
2
3 import (
4 "path/filepath"
5 "testing"
6
7 "oss.terrastruct.com/d2/lib/font"
8 "oss.terrastruct.com/util-go/assert"
9 "oss.terrastruct.com/util-go/diff"
10 )
11
12 func TestCutFont(t *testing.T) {
13 f := Font{
14 Family: SourceCodePro,
15 Style: FONT_STYLE_BOLD,
16 }
17 face := FontFaces.Get(f)
18 fontBuf := make([]byte, len(face))
19 copy(fontBuf, face)
20 fontBuf = font.UTF8CutFont(fontBuf, " 1")
21 err := diff.Testdata(filepath.Join("testdata", "d2fonts", "cut"), ".txt", fontBuf)
22 assert.Success(t, err)
23 }
24
View as plain text