eglyr

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

The eglyr subpackage defines a Renderer struct that behaves like the main etxt.Renderer, but overriding a few methods to operate with glyph indices instead of strings.

This subpackage is only relevant if you are doing text shaping on your own.

This subpackage also demonstrates how to use type embedding and the original etxt renderer methods in order to create a more specialized renderer (in this case, one that improves support for working with glyph indices).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Font

type Font = sfnt.Font

Same as etxt.Font.

type GlyphIndex

type GlyphIndex = sfnt.GlyphIndex

Same as etxt.GlyphIndex.

type Renderer

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

A renderer just like etxt.Renderer, but with a few methods overridden and adapted to operate with GlyphIndex slices instead of strings.

Despite the documentation missing the inherited methods, notice that all the property setters and getters available for etxt.Renderer are also available for this renderer.

func NewRenderer

func NewRenderer(rasterizer emask.Rasterizer) *Renderer

Creates a new Renderer with the given glyph mask rasterizer. For the default rasterizer, see NewStdRenderer() instead.

This method is the eglyr equivalent to etxt.NewRenderer().

func NewStdRenderer

func NewStdRenderer() *Renderer

Creates a new glyph-specialized Renderer with the default vector rasterizer.

This method is the eglyr equivalent to etxt.NewStdRenderer().

func (*Renderer) Draw

func (self *Renderer) Draw(glyphIndices []GlyphIndex, x, y int) fixed.Point26_6

Draws the given glyphs with the current configuration. Glyph indices outside the [0, font.NumGlyphs()) range will cause the renderer to panic.

This method is the eglyr equivalent to etxt.Renderer.Draw().

func (*Renderer) DrawFract

func (self *Renderer) DrawFract(glyphIndices []GlyphIndex, x, y fixed.Int26_6) fixed.Point26_6

Same as Renderer.Draw(), but accepting fractional pixel coordinates.

This method is the eglyr equivalent to etxt.Renderer.DrawFract().

func (*Renderer) SelectionRect

func (self *Renderer) SelectionRect(glyphIndices []GlyphIndex) etxt.RectSize

An alias for etxt.Renderer.SelectionRectGlyphs().

Jump to

Keyboard shortcuts

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