drawutil

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CarriageReturnRune = '♪'
View Source
var NullRune = '◦'
View Source
var TabWidth = 8

Functions

func Baseline

func Baseline(m *font.Metrics) fixed.Int26_6

func GetTestFace

func GetTestFace() font.Face

func LineHeight

func LineHeight(m *font.Metrics) fixed.Int26_6

func LineHeightInt

func LineHeightInt(m *font.Metrics) int

func NewFace

func NewFace(font *truetype.Font, opt *truetype.Options) font.Face

Types

type Drawer

type Drawer interface {
	Reader() iorw.Reader
	SetReader(iorw.Reader)
	ContentChanged()

	Face() font.Face
	SetFace(font.Face)
	LineHeight() int
	SetFg(color.Color)

	Bounds() image.Rectangle
	SetBounds(image.Rectangle)

	// rune offset  (set text view position; save/restore view in session file)
	RuneOffset() int
	SetRuneOffset(int)

	LocalPointOf(index int) image.Point
	LocalIndexOf(image.Point) int

	Measure() image.Point
	Draw(img draw.Image)

	// specialized: covers editor row button margin
	FirstLineOffsetX() int
	SetFirstLineOffsetX(x int)

	// cursor
	SetCursorOffset(int)

	// scrollable utils
	ScrollOffset() image.Point
	SetScrollOffset(image.Point)
	ScrollSize() image.Point
	ScrollViewSize() image.Point
	ScrollPageSizeY(up bool) int
	ScrollWheelSizeY(up bool) int

	// visibility utils
	RangeVisible(offset, n int) bool
	RangeVisibleOffset(offset, n int) int
}

type FaceCache

type FaceCache struct {
	font.Face
	// contains filtered or unexported fields
}

func NewFaceCache

func NewFaceCache(face font.Face) *FaceCache

func (*FaceCache) Glyph

func (fc *FaceCache) Glyph(dot fixed.Point26_6, ru rune) (
	dr image.Rectangle,
	mask image.Image,
	maskp image.Point,
	advance fixed.Int26_6,
	ok bool,
)

func (*FaceCache) GlyphAdvance

func (fc *FaceCache) GlyphAdvance(ru rune) (advance fixed.Int26_6, ok bool)

func (*FaceCache) GlyphBounds

func (fc *FaceCache) GlyphBounds(ru rune) (bounds fixed.Rectangle26_6, advance fixed.Int26_6, ok bool)

func (*FaceCache) Kern

func (fc *FaceCache) Kern(r0, r1 rune) fixed.Int26_6

type FaceCacheL

type FaceCacheL struct {
	font.Face
	// contains filtered or unexported fields
}

Same as FaceCache but with locks.

func NewFaceCacheL

func NewFaceCacheL(face font.Face) *FaceCacheL

func (*FaceCacheL) Glyph

func (fc *FaceCacheL) Glyph(dot fixed.Point26_6, ru rune) (
	dr image.Rectangle,
	mask image.Image,
	maskp image.Point,
	advance fixed.Int26_6,
	ok bool,
)

func (*FaceCacheL) GlyphAdvance

func (fc *FaceCacheL) GlyphAdvance(ru rune) (advance fixed.Int26_6, ok bool)

func (*FaceCacheL) GlyphBounds

func (fc *FaceCacheL) GlyphBounds(ru rune) (bounds fixed.Rectangle26_6, advance fixed.Int26_6, ok bool)

func (*FaceCacheL) Kern

func (fc *FaceCacheL) Kern(r0, r1 rune) fixed.Int26_6

type FaceRunes

type FaceRunes struct {
	font.Face
}

Special runes face

func NewFaceRunes

func NewFaceRunes(face font.Face) *FaceRunes

func (*FaceRunes) Glyph

func (fr *FaceRunes) Glyph(dot fixed.Point26_6, ru rune) (
	dr image.Rectangle,
	mask image.Image,
	maskp image.Point,
	advance fixed.Int26_6,
	ok bool,
)

func (*FaceRunes) GlyphAdvance

func (fr *FaceRunes) GlyphAdvance(ru rune) (advance fixed.Int26_6, ok bool)

type GlyphAdvanceCache

type GlyphAdvanceCache struct {
	// contains filtered or unexported fields
}

type GlyphBoundsCache

type GlyphBoundsCache struct {
	// contains filtered or unexported fields
}

type GlyphCache

type GlyphCache struct {
	// contains filtered or unexported fields
}

type SyntaxHighlightComment

type SyntaxHighlightComment struct {
	S, E   string // {start,end} sequence
	IsLine bool   // single line comment (end argument is ignored)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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