mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
text/v2: update comments about CacheGlyphs
The example was not clear.
This commit is contained in:
parent
a3d084e2de
commit
6056fc59eb
@ -239,10 +239,7 @@ func Measure(text string, face Face, lineSpacingInPixels float64) (width, height
|
||||
// CacheGlyphs creates all such variations for one rune, while Draw and AppendGlyphs create only necessary glyphs.
|
||||
//
|
||||
// Draw and AppendGlyphs automatically create and cache necessary glyphs, so usually you don't have to call CacheGlyphs explicitly.
|
||||
// However, for example, when you call Draw for each rune of one big text, Draw tries to create the glyph cache and render it for each rune.
|
||||
// This is very inefficient because creating a glyph image and rendering it are different operations
|
||||
// (`(*ebiten.Image).WritePixels` and `(*ebiten.Image).DrawImage`) and can never be merged as one draw call.
|
||||
// CacheGlyphs creates necessary glyphs without rendering them so that these operations are likely merged into one draw call regardless of the size of the text.
|
||||
// If you really care about the performance, CacheGlyphs might be useful.
|
||||
//
|
||||
// CacheGlyphs is concurrent-safe.
|
||||
func CacheGlyphs(text string, face Face) {
|
||||
|
Loading…
Reference in New Issue
Block a user