text: add io.Reader Layout method to Shaper

use them for Editor, which is no longer required to construct a string
for laying out its content.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-01-13 20:11:55 +01:00
parent 16d2a3ac0a
commit b331407e81
6 changed files with 123 additions and 53 deletions
+3 -1
View File
@@ -3,6 +3,8 @@
package text
import (
"io"
"gioui.org/op"
"gioui.org/unit"
"golang.org/x/image/font"
@@ -54,7 +56,7 @@ type Font struct {
// Face implements text layout and shaping for a particular font.
type Face interface {
Layout(ppem fixed.Int26_6, str string, opts LayoutOptions) []Line
Layout(ppem fixed.Int26_6, txt io.Reader, opts LayoutOptions) ([]Line, error)
Shape(ppem fixed.Int26_6, str []Glyph) op.CallOp
Metrics(ppem fixed.Int26_6) font.Metrics
}