zworld/engine/renderapi/font/glyph.go
2024-01-14 22:56:06 +08:00

35 lines
641 B
Go

package font
import (
"zworld/engine/renderapi/image"
"zworld/engine/renderapi/texture"
"zworld/plugins/math/vec2"
"github.com/vkngwrapper/core/v2/core1_0"
)
type Glyph struct {
key string
Size vec2.T
Bearing vec2.T
Advance float32
Mask *image.Data
}
var _ texture.Ref = &Glyph{}
func (r *Glyph) Key() string { return r.key }
func (r *Glyph) Version() int { return 1 }
func (r *Glyph) ImageData() *image.Data {
return r.Mask
}
func (r *Glyph) TextureArgs() texture.Args {
return texture.Args{
Filter: texture.FilterNearest,
Wrap: texture.WrapClamp,
Border: core1_0.BorderColorFloatTransparentBlack,
}
}