mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
text/v2: remove the common UnsafeInternal and add ones to GoTextFaceSource and StdFace
Updates #2454
This commit is contained in:
parent
989d749475
commit
f34f93a117
@ -202,11 +202,6 @@ func (g *GoTextFace) Metrics() Metrics {
|
||||
return m
|
||||
}
|
||||
|
||||
// UnsafeInternal implements Face.
|
||||
func (g *GoTextFace) UnsafeInternal() any {
|
||||
return g.Source.f
|
||||
}
|
||||
|
||||
func (g *GoTextFace) ensureVariationsString() string {
|
||||
if g.variationsString != "" {
|
||||
return g.variationsString
|
||||
|
@ -157,6 +157,13 @@ func (g *GoTextFaceSource) Metadata() Metadata {
|
||||
return g.metadata
|
||||
}
|
||||
|
||||
// UnsafeInternal returns its font.Face.
|
||||
//
|
||||
// This is unsafe since this might make internal cache states out of sync.
|
||||
func (g *GoTextFaceSource) UnsafeInternal() font.Face {
|
||||
return g.f
|
||||
}
|
||||
|
||||
func (g *GoTextFaceSource) shape(text string, face *GoTextFace) (shaping.Output, []glyph) {
|
||||
g.copyCheck()
|
||||
|
||||
|
@ -74,8 +74,10 @@ func (s *StdFace) Metrics() Metrics {
|
||||
}
|
||||
}
|
||||
|
||||
// UnsafeInternal implements Face.
|
||||
func (s *StdFace) UnsafeInternal() any {
|
||||
// UnsafeInternal returns its internal font.Face.
|
||||
//
|
||||
// This is unsafe since this might make internal cache states out of sync.
|
||||
func (s *StdFace) UnsafeInternal() font.Face {
|
||||
s.copyCheck()
|
||||
return s.f.f
|
||||
}
|
||||
|
@ -32,11 +32,6 @@ type Face interface {
|
||||
// Metrics returns the metrics for this Face.
|
||||
Metrics() Metrics
|
||||
|
||||
// UnsafeInternal returns the internal object for this face.
|
||||
// The returned value is either a semi-standard font.Face or go-text's font.Face.
|
||||
// This is unsafe since this might make internal cache states out of sync.
|
||||
UnsafeInternal() any
|
||||
|
||||
advance(text string) float64
|
||||
|
||||
appendGlyphsForLine(glyphs []Glyph, line string, indexOffset int, originX, originY float64) []Glyph
|
||||
|
Loading…
Reference in New Issue
Block a user