From 85c0f4444bf0b1b245cafad8f7b72ce63f44c8f0 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 7 Apr 2024 19:22:37 +0900 Subject: [PATCH] text/v2: update comments --- text/v2/gotext.go | 4 ++++ text/v2/gox.go | 3 +++ 2 files changed, 7 insertions(+) diff --git a/text/v2/gotext.go b/text/v2/gotext.go index 9cdb7361b..e10add466 100644 --- a/text/v2/gotext.go +++ b/text/v2/gotext.go @@ -36,6 +36,10 @@ var _ Face = (*GoTextFace)(nil) // GoTextFace is a Face implementation for go-text's font.Face (github.com/go-text/typesetting). // With a GoTextFace, shaping.HarfBuzzShaper is always used as a shaper internally. // GoTextFace includes the source and various options. +// +// Unlike GoXFace, one GoTextFace instance doesn't have its own glyph image cache. +// Instead, a GoTextFaceSource has a glyph image cache. +// You can casually create multiple GoTextFace instances from the same GoTextFaceSource. type GoTextFace struct { // Source is the font face source. Source *GoTextFaceSource diff --git a/text/v2/gox.go b/text/v2/gox.go index 98cec7d9d..625215d82 100644 --- a/text/v2/gox.go +++ b/text/v2/gox.go @@ -37,6 +37,9 @@ type goXFaceGlyphImageCacheKey struct { // GoXFace is a Face implementation for a semi-standard font.Face (golang.org/x/image/font). // GoXFace is useful to transit from existing codebase with text v1, or to use some bitmap fonts defined as font.Face. // GoXFace must not be copied by value. +// +// Unlike GoFontFace, one GoXFace instance has its own glyph image cache. +// You should reuse the same GoXFace instance as much as possible. type GoXFace struct { f *faceWithCache