ebiten
ebiten copied to clipboard
text/v2: improve the performance of `Advance` with a `GoTextFace`
Operating System
- [ ] Windows
- [ ] macOS
- [ ] Linux
- [ ] FreeBSD
- [ ] OpenBSD
- [ ] Android
- [ ] iOS
- [ ] Nintendo Switch
- [ ] PlayStation 5
- [ ] Xbox
- [ ] Web Browsers
What feature would you like to be added?
When a GoTextFace
is used for Advance
, glyphs shapes are created. This might be redundant when you want to know just an advanve value. Let's optimize the implementation of Advance
to improve the performance.
Why is this needed?
Improve Advance
performance makes us happy
Hmm, is it possible to know an advance value without calculating shapes?
An idea you might want to consider is to split the current GoTextFaceSource.shape
into two functions : one which only performs the layout, computing a shaping.Line
; the other one which takes such a line and draws it. Now, with this setup, advance
would only call the first function and avoid loading the glyph segments.
Unfortunately go-text HarfBuzzShaper.Shape function doesn't split the functions (calculating glyphs and calculating layouts), and this is the problem.
Unfortunately go-text HarfBuzzShaper.Shape function doesn't split the functions (calculating glyphs and calculating layouts), and this is the problem.
I might have misunderstood the issue : I thought you wanted to avoid creating glyph shapes, that is calling Face.GlyphData
.