text/types.go

Functions Structs

Functions

func Empty

Empty reports whether the rectangle is empty.

func (r Rect) Empty() bool {
	return r.MinX >= r.MaxX || r.MinY >= r.MaxY
}

func Height

Height returns the height of the rectangle.

func (r Rect) Height() float64 {
	return r.MaxY - r.MinY
}

func IsHorizontal

IsHorizontal returns true if the direction is horizontal (LTR or RTL).

func (d Direction) IsHorizontal() bool {
	return d == DirectionLTR || d == DirectionRTL
}

func IsVertical

IsVertical returns true if the direction is vertical (TTB or BTT).

func (d Direction) IsVertical() bool {
	return d == DirectionTTB || d == DirectionBTT
}

func String

String returns the string representation of the direction.

func (d Direction) String() string {
	switch d {
	case DirectionLTR:
		return "LTR"
	case DirectionRTL:
		return "RTL"
	case DirectionTTB:
		return "TTB"
	case DirectionBTT:
		return "BTT"
	default:
		return unknownStr
	}
}

func String

String returns the string representation of the hinting.

func (h Hinting) String() string {
	switch h {
	case HintingNone:
		return noneStr
	case HintingVertical:
		return "Vertical"
	case HintingFull:
		return "Full"
	default:
		return unknownStr
	}
}

func Width

Width returns the width of the rectangle.

func (r Rect) Width() float64 {
	return r.MaxX - r.MinX
}

Structs

type Rect struct

Rect represents a rectangle for glyph bounds.

type Rect struct {
	// Min is the top-left corner
	MinX, MinY	float64
	// Max is the bottom-right corner
	MaxX, MaxY	float64
}