mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-03 06:24:27 +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.
|
// 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.
|
// 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.
|
// If you really care about the performance, CacheGlyphs might be useful.
|
||||||
// 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.
|
|
||||||
//
|
//
|
||||||
// CacheGlyphs is concurrent-safe.
|
// CacheGlyphs is concurrent-safe.
|
||||||
func CacheGlyphs(text string, face Face) {
|
func CacheGlyphs(text string, face Face) {
|
||||||
|
Loading…
Reference in New Issue
Block a user