Documentation
¶
Overview ¶
Package text is a wrapper around the text rendering API part of github.com/hajimehoshi/ebiten/v2/text/v2.
It provides several additional conveniences that match how GUI text editing interfaces tend to work, including:
- Basic types for styling text.
- A styled String type that may interleave multiple styles along with helpers to efficiently construct them.
- A text Box that renders text strictly within a well-defined area with overflow hidden.
- An automatically-sized text box, AutoBox which allows simply drawing text and anchoring its position to a relative point in the box.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BoxOptions ¶
type BoxOptions struct {
// Padding sets the distance between the edge of the box and the text inside.
Padding geom.Dimensions
// LineSpacing is multiplier proportional to the size of each line of text.
LineSpacing float64
// Align sets the alignment of the text.
Align Alignment
// VertAlign sets the vertical alignment of the text.
VertAlign VertAlignment
}
type String ¶
type String struct {
// contains filtered or unexported fields
}
String is a string of styled text.
All of the styles must have font face with an identical Direction.
type StringBuilder ¶
type StringBuilder struct {
// contains filtered or unexported fields
}
StringBuilder is a builder for efficiently constructing styled strings. The zero value is ready for use.
func (*StringBuilder) Append ¶
func (s *StringBuilder) Append(piece Piece)
Append appends the provided piece.
func (*StringBuilder) Reset ¶
func (s *StringBuilder) Reset()
Reset resets the StringBuilder to be empty.
func (*StringBuilder) String ¶
func (s *StringBuilder) String() String
String returns the builder's accumulated String.
type Style ¶
Style describes the style of text.
func Basic ¶
Basic creates a simple style from the provided font name, a font size, and a color. If the font doesn't exist, this falls back to 2d/ebiten's default font.
type VertAlignment ¶
type VertAlignment int
VertAlignment describes vertical text alignment.
const ( AutoVertAlign VertAlignment = iota Top Middle Bottom )