mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
text,widget: [API] drop runereader based shaping API
The io.Reader based API has the potential to be significantly more efficient, and there are very few users of the runereader API. This commit simply drops it entirely in favor of the reader API. Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
+1
-7
@@ -177,15 +177,9 @@ func NewShaper(collection []FontFace) *Shaper {
|
|||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
|
|
||||||
// Layout a text according to a set of options. Results can be retrieved by
|
|
||||||
// iteratively calling NextGlyph.
|
|
||||||
func (l *Shaper) Layout(params Parameters, minWidth, maxWidth int, lc system.Locale, txt io.RuneReader) {
|
|
||||||
l.layoutText(params, minWidth, maxWidth, lc, txt, "")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Layout text from an io.Reader according to a set of options. Results can be retrieved by
|
// Layout text from an io.Reader according to a set of options. Results can be retrieved by
|
||||||
// iteratively calling NextGlyph.
|
// iteratively calling NextGlyph.
|
||||||
func (l *Shaper) LayoutReader(params Parameters, minWidth, maxWidth int, lc system.Locale, txt io.Reader) {
|
func (l *Shaper) Layout(params Parameters, minWidth, maxWidth int, lc system.Locale, txt io.Reader) {
|
||||||
l.layoutText(params, minWidth, maxWidth, lc, bufio.NewReader(txt), "")
|
l.layoutText(params, minWidth, maxWidth, lc, bufio.NewReader(txt), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -113,7 +113,7 @@ func TestShapingNewlineHandling(t *testing.T) {
|
|||||||
}
|
}
|
||||||
checkGlyphs()
|
checkGlyphs()
|
||||||
|
|
||||||
cache.LayoutReader(Parameters{
|
cache.Layout(Parameters{
|
||||||
Alignment: Middle,
|
Alignment: Middle,
|
||||||
PxPerEm: fixed.I(10),
|
PxPerEm: fixed.I(10),
|
||||||
}, 200, 200, english, strings.NewReader(tc.textInput))
|
}, 200, 200, english, strings.NewReader(tc.textInput))
|
||||||
|
|||||||
+1
-1
@@ -399,7 +399,7 @@ func (e *textView) layoutText(lt *text.Shaper) {
|
|||||||
e.index = glyphIndex{}
|
e.index = glyphIndex{}
|
||||||
it := textIterator{viewport: image.Rectangle{Max: image.Point{X: math.MaxInt, Y: math.MaxInt}}}
|
it := textIterator{viewport: image.Rectangle{Max: image.Point{X: math.MaxInt, Y: math.MaxInt}}}
|
||||||
if lt != nil {
|
if lt != nil {
|
||||||
lt.LayoutReader(text.Parameters{
|
lt.Layout(text.Parameters{
|
||||||
Font: e.font,
|
Font: e.font,
|
||||||
PxPerEm: e.textSize,
|
PxPerEm: e.textSize,
|
||||||
Alignment: e.Alignment,
|
Alignment: e.Alignment,
|
||||||
|
|||||||
Reference in New Issue
Block a user