text,font/opentype: make text layout and shaping safe for concurrent use

Implementations of text.Face are reused across multiple windows for efficiency.
Make the opentype implementation safe for concurrent use and document it.

Updates gio#104

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-07-04 17:51:45 +02:00
parent e2278b64c1
commit 7bbe0da0c7
2 changed files with 10 additions and 6 deletions
+2 -1
View File
@@ -45,7 +45,8 @@ type Font struct {
Weight Weight
}
// Face implements text layout and shaping for a particular font.
// Face implements text layout and shaping for a particular font. All
// methods must be safe for concurrent use.
type Face interface {
Layout(ppem fixed.Int26_6, maxWidth int, txt io.Reader) ([]Line, error)
Shape(ppem fixed.Int26_6, str []Glyph) op.CallOp