textutil

package
v0.0.0-...-44760b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackspaceOnGraphemes

func BackspaceOnGraphemes(str string, position int) (string, int)

func DeleteOnGraphemes

func DeleteOnGraphemes(str string, position int) (string, int)

func Draw

func Draw(bounds image.Rectangle, dst *ebiten.Image, str string, options *DrawOptions)

func FirstLineBreakPositionAndLen

func FirstLineBreakPositionAndLen(str string) (pos, length int)

func Measure

func Measure(width int, str string, autoWrap bool, face text.Face, lineHeight float64, tabWidth float64, keepTailingSpace bool) (float64, float64)

func NextPositionOnGraphemes

func NextPositionOnGraphemes(str string, position int) int

func PrevPositionOnGraphemes

func PrevPositionOnGraphemes(str string, position int) int

func TextIndexFromPosition

func TextIndexFromPosition(width int, position image.Point, str string, options *Options) int

Types

type DrawOptions

type DrawOptions struct {
	Options

	TextColor color.Color

	DrawSelection  bool
	SelectionStart int
	SelectionEnd   int
	SelectionColor color.Color

	DrawComposition          bool
	CompositionStart         int
	CompositionEnd           int
	CompositionActiveStart   int
	CompositionActiveEnd     int
	InactiveCompositionColor color.Color
	ActiveCompositionColor   color.Color
	CompositionBorderWidth   float32
}

type HorizontalAlign

type HorizontalAlign int
const (
	HorizontalAlignStart HorizontalAlign = iota
	HorizontalAlignCenter
	HorizontalAlignEnd
	HorizontalAlignLeft
	HorizontalAlignRight
)

type Options

type Options struct {
	AutoWrap         bool
	Face             text.Face
	LineHeight       float64
	HorizontalAlign  HorizontalAlign
	VerticalAlign    VerticalAlign
	TabWidth         float64
	KeepTailingSpace bool
}

type TextPosition

type TextPosition struct {
	X      float64
	Top    float64
	Bottom float64
}

func TextPositionFromIndex

func TextPositionFromIndex(width int, str string, index int, options *Options) (position0, position1 TextPosition, count int)

type VerticalAlign

type VerticalAlign int
const (
	VerticalAlignTop VerticalAlign = iota
	VerticalAlignMiddle
	VerticalAlignBottom
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL