Skip to content

Commit 45023d1

Browse files
committed
[shaping] use constructor in test, now mandatory since cmap is cached
1 parent b2eeaae commit 45023d1

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

font/font.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,8 @@ func loadGDEF(ld *ot.Loader, axisCount int, gsub, gpos []byte) (tables.GDEF, err
610610
// Face is a font with user-provided settings.
611611
// Contrary to the [*Font] objects, Faces are NOT safe for concurrent use.
612612
// A Face caches glyph extents and rune to glyph mapping, and should be reused when possible.
613+
//
614+
// Also note that an empty [Face] is invalid : the [NewFace] constructor is required to properly init caches.
613615
type Face struct {
614616
*Font
615617

shaping/input_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ func TestSplitByFontGlyphs(t *testing.T) {
6969
availableFaces []*font.Face
7070
}
7171

72-
universalFont := &font.Face{Font: &font.Font{Cmap: universalCmap{}}}
73-
lowerFont := &font.Face{Font: &font.Font{Cmap: lowerCmap{}}}
74-
upperFont := &font.Face{Font: &font.Font{Cmap: upperCmap{}}}
72+
universalFont := font.NewFace(&font.Font{Cmap: universalCmap{}})
73+
lowerFont := font.NewFace(&font.Font{Cmap: lowerCmap{}})
74+
upperFont := font.NewFace(&font.Font{Cmap: upperCmap{}})
7575

7676
latinFont := loadOpentypeFont(t, "../font/testdata/Roboto-Regular.ttf")
7777
arabicFont := loadOpentypeFont(t, "../font/testdata/Amiri-Regular.ttf")

0 commit comments

Comments
 (0)