Documentation
¶
Index ¶
- Constants
- Variables
- func CalcSDF(img image.Image, radius float64, cutoff float64) []uint8
- func DrawGlyph(glyph *Glyph, smoothstep bool) image.Image
- func SavePNG(path string, img image.Image)
- type Fontstack
- func (*Fontstack) Descriptor() ([]byte, []int)deprecated
- func (x *Fontstack) GetGlyphs() []*Glyph
- func (x *Fontstack) GetName() string
- func (x *Fontstack) GetRange() string
- func (*Fontstack) ProtoMessage()
- func (x *Fontstack) ProtoReflect() protoreflect.Message
- func (x *Fontstack) Reset()
- func (x *Fontstack) String() string
- type Glyph
- func (*Glyph) Descriptor() ([]byte, []int)deprecated
- func (x *Glyph) GetAdvance() uint32
- func (x *Glyph) GetBitmap() []byte
- func (x *Glyph) GetHeight() uint32
- func (x *Glyph) GetId() uint32
- func (x *Glyph) GetLeft() int32
- func (x *Glyph) GetTop() int32
- func (x *Glyph) GetWidth() uint32
- func (*Glyph) ProtoMessage()
- func (x *Glyph) ProtoReflect() protoreflect.Message
- func (x *Glyph) Reset()
- func (x *Glyph) String() string
- type Glyphs
- type SDFBuilder
- type SDFBuilderOpt
Constants ¶
View Source
const INF = 1e20
Variables ¶
View Source
var File_glyph_proto protoreflect.FileDescriptor
Functions ¶
Types ¶
type Fontstack ¶
type Fontstack struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Range string `protobuf:"bytes,2,opt,name=range,proto3" json:"range,omitempty"`
Glyphs []*Glyph `protobuf:"bytes,3,rep,name=glyphs,proto3" json:"glyphs,omitempty"`
// contains filtered or unexported fields
}
Stores fontstack information and a list of faces.
func (*Fontstack) Descriptor
deprecated
func (*Fontstack) ProtoMessage ¶
func (*Fontstack) ProtoMessage()
func (*Fontstack) ProtoReflect ¶
func (x *Fontstack) ProtoReflect() protoreflect.Message
type Glyph ¶
type Glyph struct {
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// A signed distance field of the glyph with a border of 3 pixels.
Bitmap []byte `protobuf:"bytes,2,opt,name=bitmap,proto3,oneof" json:"bitmap,omitempty"`
// Glyph metrics.
Width uint32 `protobuf:"varint,3,opt,name=width,proto3" json:"width,omitempty"`
Height uint32 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"`
Left int32 `protobuf:"zigzag32,5,opt,name=left,proto3" json:"left,omitempty"`
Top int32 `protobuf:"zigzag32,6,opt,name=top,proto3" json:"top,omitempty"`
Advance uint32 `protobuf:"varint,7,opt,name=advance,proto3" json:"advance,omitempty"`
// contains filtered or unexported fields
}
Stores a glyph with metrics and optional SDF bitmap information.
func (*Glyph) Descriptor
deprecated
func (*Glyph) GetAdvance ¶
func (*Glyph) ProtoMessage ¶
func (*Glyph) ProtoMessage()
func (*Glyph) ProtoReflect ¶
func (x *Glyph) ProtoReflect() protoreflect.Message
type Glyphs ¶
type Glyphs struct {
Stacks []*Fontstack `protobuf:"bytes,1,rep,name=stacks,proto3" json:"stacks,omitempty"`
// contains filtered or unexported fields
}
func (*Glyphs) Descriptor
deprecated
func (*Glyphs) ProtoMessage ¶
func (*Glyphs) ProtoMessage()
func (*Glyphs) ProtoReflect ¶
func (x *Glyphs) ProtoReflect() protoreflect.Message
type SDFBuilder ¶
type SDFBuilder struct {
Font *truetype.Font
Face font.Face
SDFBuilderOpt
// contains filtered or unexported fields
}
func NewSDFBuilder ¶
func NewSDFBuilder(font *truetype.Font, opts ...SDFBuilderOpt) *SDFBuilder
func (*SDFBuilder) Glyph ¶
func (b *SDFBuilder) Glyph(x rune) *Glyph
func (*SDFBuilder) Init ¶
func (b *SDFBuilder) Init()
type SDFBuilderOpt ¶
Click to show internal directories.
Click to hide internal directories.