mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
text: remove Metrics from Face interface
It's not used in text shaping, so let's not require it. Note that the concrete opentype package still retains the Metrics implementation. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -6,8 +6,6 @@ import (
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/image/font"
|
||||
|
||||
"gioui.org/op"
|
||||
"golang.org/x/image/math/fixed"
|
||||
)
|
||||
@@ -23,9 +21,6 @@ type Shaper interface {
|
||||
LayoutString(font Font, size fixed.Int26_6, maxWidth int, str string) []Line
|
||||
// ShapeString is like Shape for lines previously laid out by LayoutString.
|
||||
ShapeString(font Font, size fixed.Int26_6, str string, layout []Glyph) op.CallOp
|
||||
|
||||
// Metrics returns the font metrics for font.
|
||||
Metrics(font Font, size fixed.Int26_6) font.Metrics
|
||||
}
|
||||
|
||||
// A FontFace is a Font and a matching Face.
|
||||
@@ -120,11 +115,6 @@ func (s *Cache) ShapeString(font Font, size fixed.Int26_6, str string, layout []
|
||||
return cache.shape(size, str, layout)
|
||||
}
|
||||
|
||||
func (s *Cache) Metrics(font Font, size fixed.Int26_6) font.Metrics {
|
||||
cache := s.lookup(font)
|
||||
return cache.metrics(size)
|
||||
}
|
||||
|
||||
func (f *faceCache) layout(ppem fixed.Int26_6, maxWidth int, str string) []Line {
|
||||
if f == nil {
|
||||
return nil
|
||||
@@ -157,7 +147,3 @@ func (f *faceCache) shape(ppem fixed.Int26_6, str string, layout []Glyph) op.Cal
|
||||
f.pathCache.Put(pk, clip)
|
||||
return clip
|
||||
}
|
||||
|
||||
func (f *faceCache) metrics(ppem fixed.Int26_6) font.Metrics {
|
||||
return f.face.Metrics(ppem)
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"io"
|
||||
|
||||
"gioui.org/op"
|
||||
"golang.org/x/image/font"
|
||||
"golang.org/x/image/math/fixed"
|
||||
)
|
||||
|
||||
@@ -50,7 +49,6 @@ type Font struct {
|
||||
type Face interface {
|
||||
Layout(ppem fixed.Int26_6, maxWidth int, txt io.Reader) ([]Line, error)
|
||||
Shape(ppem fixed.Int26_6, str []Glyph) op.CallOp
|
||||
Metrics(ppem fixed.Int26_6) font.Metrics
|
||||
}
|
||||
|
||||
// Typeface identifies a particular typeface design. The empty
|
||||
|
||||
Reference in New Issue
Block a user