freetype

package module
v0.0.0-...-ba3ce44 Latest Latest
Warning

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

Go to latest
Published: May 16, 2015 License: MIT Imports: 6 Imported by: 0

README

go-freetype

Go wrapper for freetype

Build Status

Coverage Status

GoDoc

Work in progress. Code is not tested.

Documentation

Overview

Go wrapper for FreeType which is a freely available software library to render fonts.

Index

Constants

View Source
const (
	EncodingNone     int = C.FT_ENCODING_NONE
	EncodingMSSymbol int = C.FT_ENCODING_MS_SYMBOL
	EncodingUnicode  int = C.FT_ENCODING_UNICODE
	EncodingSjis     int = C.FT_ENCODING_SJIS
	EncodingGb2312   int = C.FT_ENCODING_GB2312
	EncodingBig5     int = C.FT_ENCODING_BIG5
	EncodingWansung  int = C.FT_ENCODING_WANSUNG
	EncodingJohab    int = C.FT_ENCODING_JOHAB

	/* for backwards compatibility */
	EncodingMSSjis    = EncodingSjis
	EncodingMSGb2312  = EncodingGb2312
	EncodingMSBig5    = EncodingBig5
	EncodingMSWansung = EncodingWansung
	EncodingMSJohab   = EncodingJohab

	EncodingAdobeStandard int = C.FT_ENCODING_ADOBE_STANDARD
	EncodingAdobeExpert   int = C.FT_ENCODING_ADOBE_EXPERT
	EncodingAdobeCustom   int = C.FT_ENCODING_ADOBE_CUSTOM
	EncodingAdobeLatin1   int = C.FT_ENCODING_ADOBE_LATIN_1
	EncodingOldLatin2     int = C.FT_ENCODING_OLD_LATIN_2
	EncodingAppleRoman    int = C.FT_ENCODING_APPLE_ROMAN
)
View Source
const (
	GlyphBBoxUnscaled  int = C.FT_GLYPH_BBOX_UNSCALED
	GlyphBBoxSubpixels int = C.FT_GLYPH_BBOX_SUBPIXELS
	GlyphBBoxGridfit   int = C.FT_GLYPH_BBOX_GRIDFIT
	GlyphBBoxTruncate  int = C.FT_GLYPH_BBOX_TRUNCATE
	GlyphBBoxPixels    int = C.FT_GLYPH_BBOX_PIXELS
)
View Source
const (
	GlyphFormatNone      int = C.FT_GLYPH_FORMAT_NONE
	GlyphFormatComposite int = C.FT_GLYPH_FORMAT_COMPOSITE
	GlyphFormatOutline   int = C.FT_GLYPH_FORMAT_OUTLINE
	GlyphFormatPlotter   int = C.FT_GLYPH_FORMAT_PLOTTER
)
View Source
const (
	LoadDefault                  int = C.FT_LOAD_DEFAULT
	LoadNoScale                  int = C.FT_LOAD_NO_SCALE
	LoadNoHinting                int = C.FT_LOAD_NO_HINTING
	LoadRender                   int = C.FT_LOAD_RENDER
	LoadNoBitmap                 int = C.FT_LOAD_NO_BITMAP
	LoadVerticalLayout           int = C.FT_LOAD_VERTICAL_LAYOUT
	LoadForceAutohint            int = C.FT_LOAD_FORCE_AUTOHINT
	LoadCropBitmap               int = C.FT_LOAD_CROP_BITMAP
	LoadPedantic                 int = C.FT_LOAD_PEDANTIC
	LoadIgnoreGlobalAdvanceWidth int = C.FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH
	LoadNoRecurse                int = C.FT_LOAD_NO_RECURSE
	LoadIgnoreTransform          int = C.FT_LOAD_IGNORE_TRANSFORM
	LoadMonochrome               int = C.FT_LOAD_MONOCHROME
	LoadLinearDesign             int = C.FT_LOAD_LINEAR_DESIGN
	LoadNoAutohint               int = C.FT_LOAD_NO_AUTOHINT
	LoadColor                    int = C.FT_LOAD_COLOR
)
View Source
const (
	PixelModeNone  int = C.FT_PIXEL_MODE_NONE
	PixelModeMono  int = C.FT_PIXEL_MODE_MONO
	PixelModeGray  int = C.FT_PIXEL_MODE_GRAY
	PixelModeGray2 int = C.FT_PIXEL_MODE_GRAY2
	PixelModeGray4 int = C.FT_PIXEL_MODE_GRAY4
	PixelModeLCD   int = C.FT_PIXEL_MODE_LCD
	PixelModeLCDV  int = C.FT_PIXEL_MODE_LCD_V
	PixelModeBGRA  int = C.FT_PIXEL_MODE_BGRA
	PixelModeMax   int = C.FT_PIXEL_MODE_MAX
)
View Source
const (
	RasterFlagDefault int = C.FT_RASTER_FLAG_DEFAULT
	RasterFlagAA      int = C.FT_RASTER_FLAG_AA
	RasterFlagDirect  int = C.FT_RASTER_FLAG_DIRECT
	RasterFlagClip    int = C.FT_RASTER_FLAG_CLIP
)
View Source
const (
	RenderModeNormal int = C.FT_RENDER_MODE_NORMAL
	RenderModeLight  int = C.FT_RENDER_MODE_LIGHT
	RenderModeMono   int = C.FT_RENDER_MODE_MONO
	RenderModeLCD    int = C.FT_RENDER_MODE_LCD
	RenderModeLCDV   int = C.FT_RENDER_MODE_LCD_V
)
View Source
const (
	StrokerLinejoinRound         int = C.FT_STROKER_LINEJOIN_ROUND
	StrokerLinejoinBevel         int = C.FT_STROKER_LINEJOIN_BEVEL
	StrokerLinejoinMiterVariable int = C.FT_STROKER_LINEJOIN_MITER_VARIABLE
	StrokerLinejoinMiter         int = C.FT_STROKER_LINEJOIN_MITER
	StrokerLinejoinMiterFixed    int = C.FT_STROKER_LINEJOIN_MITER_FIXED

	StrokerLinecapButt   int = C.FT_STROKER_LINECAP_BUTT
	StrokerLinecapRound  int = C.FT_STROKER_LINECAP_ROUND
	StrokerLinecapSquare int = C.FT_STROKER_LINECAP_SQUARE

	StrokerBorderLeft  int = C.FT_STROKER_BORDER_LEFT
	StrokerBorderRight int = C.FT_STROKER_BORDER_RIGHT
)

Variables

View Source
var (
	// wrapper errors
	ErrUnsupportedPixelMode = errors.New("freetype: unsupported pixel mode")

	// glyph/character errors
	ErrCanNotOpenResource   = errors.New("freetype: cannot open resource")
	ErrUnknownFileFormat    = errors.New("freetype: unknown file format")
	ErrInvalidFileFormat    = errors.New("freetype: broken file")
	ErrInvalidVersion       = errors.New("freetype: invalid FreeType version")
	ErrLowerModuleVersion   = errors.New("freetype: module version is too low")
	ErrInvalidArgument      = errors.New("freetype: invalid argument")
	ErrUnimplementedFeature = errors.New("freetype: unimplemented feature")
	ErrInvalidTable         = errors.New("freetype: broken table")
	ErrInvalidOffset        = errors.New("freetype: broken offset within table")
	ErrArrayTooLarge        = errors.New("freetype: array allocation size too large")
	ErrMissingModule        = errors.New("freetype: missing module")
	ErrMissingProperty      = errors.New("freetype: missing property")

	// glyph/character errors
	ErrInvalidGlyphIndex    = errors.New("freetype: invalid glyph index")
	ErrInvalidCharacterCode = errors.New("freetype: invalid character code")
	ErrInvalidGlyphFormat   = errors.New("freetype: unsupported glyph image format")
	ErrCannotRenderGlyph    = errors.New("freetype: cannot render this glyph format")
	ErrInvalidOutline       = errors.New("freetype: invalid outline")
	ErrInvalidComposite     = errors.New("freetype: invalid composite glyph")
	ErrTooManyHints         = errors.New("freetype: too many hints")
	ErrInvalidPixelSize     = errors.New("freetype: invalid pixel size")

	// handle errors
	ErrInvalidHandle        = errors.New("freetype: invalid object handle")
	ErrInvalidLibraryHandle = errors.New("freetype: invalid library handle")
	ErrInvalidDriverHandle  = errors.New("freetype: invalid module handle")
	ErrInvalidFaceHandle    = errors.New("freetype: invalid face handle")
	ErrInvalidSizeHandle    = errors.New("freetype: invalid size handle")
	ErrInvalidSlotHandle    = errors.New("freetype: invalid glyph slot handle")
	ErrInvalidCharMapHandle = errors.New("freetype: invalid charmap handle")
	ErrCacheHandle          = errors.New("freetype: invalid cache manager handle")
	ErrInvalidStreamHandle  = errors.New("freetype: invalid stream handle")
)

Functions

func GetError

func GetError(errno C.FT_Error) error

Types

type BBox

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

A structure used to hold an outline's bounding box, i.e., the coordinates of its extrema in the horizontal and vertical directions.

func (*BBox) MaxX

func (b *BBox) MaxX() int64

The horizontal maximum (right-most).

func (*BBox) MaxY

func (b *BBox) MaxY() int64

The vertical maximum (top-most).

func (*BBox) MinX

func (b *BBox) MinX() int64

The horizontal minimum (left-most).

func (*BBox) MinY

func (b *BBox) MinY() int64

The vertical minimum (bottom-most).

type Bitmap

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

func (*Bitmap) AlphaImage

func (b *Bitmap) AlphaImage() (*image.Alpha, error)

AlphaImage converts an freetype bitmap of PixelModeGray into an Go image.Alpha. NOTE: Memory is not copied.

func (*Bitmap) Buffer

func (b *Bitmap) Buffer() []byte

Buffer returns the bitmap buffer.

func (*Bitmap) Done

func (b *Bitmap) Done(lib *Library) error

func (*Bitmap) GrayImage

func (b *Bitmap) GrayImage() (*image.Gray, error)

GrayImage returns a gray image. NOTE: Memory is not copied.

func (*Bitmap) Image

func (b *Bitmap) Image() (image.Image, error)

Image returns an Go image.Image.

func (*Bitmap) NRGBA

func (b *Bitmap) NRGBA() (*image.NRGBA, error)

NRGBA returns a converted freetype BGRA bitmap. NOTE: Memory is copied.

func (*Bitmap) NumGrays

func (b *Bitmap) NumGrays() int

This field is only used with PixelModeGray; it gives the number of gray levels used in the bitmap.

func (*Bitmap) Pitch

func (b *Bitmap) Pitch() int

The pitch's absolute value is the number of bytes taken by one bitmap row, including padding. However, the pitch is positive when the bitmap has a ‘down’ flow, and negative when it has an ‘up’ flow. In all cases, the pitch is an offset to add to a bitmap pointer in order to go down one row.

func (*Bitmap) PixelMode

func (b *Bitmap) PixelMode() int

The pixel mode, i.e., how pixel bits are stored. See FT_Pixel_Mode for possible values.

func (*Bitmap) Rows

func (b *Bitmap) Rows() int

The number of bitmap rows.

func (*Bitmap) Width

func (b *Bitmap) Width() int

The number of pixels in bitmap row.

type BitmapSize

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

This structure models the metrics of a bitmap strike (i.e., a set of glyphs for a given point size and resolution) in a bitmap font. It is used for the ‘available_sizes’ field of Face.

func (*BitmapSize) Height

func (size *BitmapSize) Height() int16

The vertical distance, in pixels, between two consecutive baselines. It is always positive.

func (*BitmapSize) Size

func (size *BitmapSize) Size() int64

The nominal size of the strike in 26.6 fractional points. This field is not very useful.

func (*BitmapSize) Width

func (size *BitmapSize) Width() int16

The average width, in pixels, of all glyphs in the strike.

func (*BitmapSize) XPpem

func (size *BitmapSize) XPpem() int64

The horizontal ppem (nominal width) in 26.6 fractional pixels.

func (*BitmapSize) YPpem

func (size *BitmapSize) YPpem() int64

The vertical ppem (nominal height) in 26.6 fractional pixels.

type CharMap

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

A handle to a given character map. A charmap is used to translate character codes in a given encoding into glyph indexes for its parent's face. Some font formats may provide several charmaps per font.

func (*CharMap) Encoding

func (c *CharMap) Encoding() uint64

An Encoding tag identifying the charmap. Use this with Face.SelectCharmap.

func (*CharMap) EncodingID

func (c *CharMap) EncodingID() uint16

A platform specific encoding number. This also comes from the TrueType specification and should be emulated similarly.

func (*CharMap) Face

func (c *CharMap) Face() Face

A handle to the parent face object.

func (*CharMap) PlatformID

func (c *CharMap) PlatformID() uint16

An ID number describing the platform for the following encoding ID. This comes directly from the TrueType specification and should be emulated for other formats.

type Face

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

func NewFace

func NewFace(library *Library, filePathName string, faceIndex int64) (*Face, error)

NewFace opens a font by its filePathName.

func NewMemoryFace

func NewMemoryFace(library *Library, data []byte, faceIndex int64) (*Face, error)

func (*Face) Ascender

func (f *Face) Ascender() int16

func (*Face) AvailableSizes

func (f *Face) AvailableSizes() []BitmapSize

func (*Face) BBox

func (f *Face) BBox() BBox

func (*Face) CharMap

func (f *Face) CharMap() CharMap

func (*Face) CharMaps

func (f *Face) CharMaps() []CharMap

func (*Face) Descender

func (f *Face) Descender() int16

func (*Face) Done

func (f *Face) Done() error

func (*Face) FaceFlags

func (f *Face) FaceFlags() int64

func (*Face) FaceIndex

func (f *Face) FaceIndex() int64

func (*Face) FamilyName

func (f *Face) FamilyName() string

func (*Face) GetCharIndex

func (f *Face) GetCharIndex(char uint64) uint

GetCharIndex returns the glyph index of a given character code. This function uses a charmap object to do the mapping.

func (*Face) Glyph

func (f *Face) Glyph() *GlyphSlot

func (*Face) Height

func (f *Face) Height() int16

func (*Face) LoadChar

func (f *Face) LoadChar(char uint64, flags int) error

func (*Face) LoadGlyph

func (f *Face) LoadGlyph(index uint, flags int) error

func (*Face) MaxAdvanceHeight

func (f *Face) MaxAdvanceHeight() int16

func (*Face) MaxAdvanceWidth

func (f *Face) MaxAdvanceWidth() int16

func (*Face) NumCharmaps

func (f *Face) NumCharmaps() int

func (*Face) NumFaces

func (f *Face) NumFaces() int64

func (*Face) NumFixedSizes

func (f *Face) NumFixedSizes() int

func (*Face) SelectCharmap

func (f *Face) SelectCharmap(encoding int) error

func (*Face) SetCharSize

func (f *Face) SetCharSize(charWidth, charHeight int64, horzResolution, vertResolution uint) error

func (*Face) SetPixelSizes

func (f *Face) SetPixelSizes(width, height uint) error

func (*Face) SetTransform

func (f *Face) SetTransform(matrix *Matrix, delta *Vector)

func (*Face) Size

func (f *Face) Size() Size

func (*Face) StyleFlags

func (f *Face) StyleFlags() int64

func (*Face) StyleName

func (f *Face) StyleName() string

func (*Face) UnderlinePosition

func (f *Face) UnderlinePosition() int16

func (*Face) UnderlineThickness

func (f *Face) UnderlineThickness() int16

type Glyph

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

func (*Glyph) Advance

func (g *Glyph) Advance() *Vector

func (*Glyph) Copy

func (g *Glyph) Copy() (*Glyph, error)

func (*Glyph) Done

func (g *Glyph) Done()

func (*Glyph) Format

func (g *Glyph) Format() int

func (*Glyph) GetCBox

func (g *Glyph) GetCBox(bboxMode uint) *BBox

func (*Glyph) Library

func (g *Glyph) Library() *Library

func (*Glyph) ReinterpretAsOutlineGlyph

func (g *Glyph) ReinterpretAsOutlineGlyph() *OutlineGlyph

func (*Glyph) Stroke

func (g *Glyph) Stroke(stroker *Stroker, destroy bool) error

Stroke a given outline glyph object with a given stroker.

func (*Glyph) StrokeBorder

func (g *Glyph) StrokeBorder(stroker *Stroker, inside, destroy bool) error

Stroke a given outline glyph object with a given stroker, but only return either its inside or outside border.

func (*Glyph) ToBitmap

func (g *Glyph) ToBitmap(renderMode int, origin *Vector, destroy bool) error

func (*Glyph) Transform

func (g *Glyph) Transform(matrix *Matrix, delta *Vector) error

type GlyphMetrics

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

func (*GlyphMetrics) Height

func (m *GlyphMetrics) Height() int64

The glyph's height.

func (*GlyphMetrics) HoriAdvance

func (m *GlyphMetrics) HoriAdvance() int64

Advance width for horizontal layout.

func (*GlyphMetrics) HoriBearingX

func (m *GlyphMetrics) HoriBearingX() int64

Left side bearing for horizontal layout.

func (*GlyphMetrics) HoriBearingY

func (m *GlyphMetrics) HoriBearingY() int64

Top side bearing for horizontal layout.

func (*GlyphMetrics) VertAdvance

func (m *GlyphMetrics) VertAdvance() int64

Advance height for vertical layout. Positive values mean the glyph has a positive advance downward.

func (*GlyphMetrics) VertBearingX

func (m *GlyphMetrics) VertBearingX() int64

Left side bearing for vertical layout.

func (*GlyphMetrics) VertBearingY

func (m *GlyphMetrics) VertBearingY() int64

Top side bearing for vertical layout. Larger positive values mean further below the vertical glyph origin.

func (*GlyphMetrics) Width

func (m *GlyphMetrics) Width() int64

The glyph's width.

type GlyphSlot

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

func (*GlyphSlot) Advance

func (g *GlyphSlot) Advance() *Vector

func (*GlyphSlot) Bitmap

func (g *GlyphSlot) Bitmap() *Bitmap

func (*GlyphSlot) BitmapLeft

func (g *GlyphSlot) BitmapLeft() int

func (*GlyphSlot) BitmapTop

func (g *GlyphSlot) BitmapTop() int

func (*GlyphSlot) ControlData

func (g *GlyphSlot) ControlData() []byte

func (*GlyphSlot) ControlLen

func (g *GlyphSlot) ControlLen() int

func (*GlyphSlot) Face

func (g *GlyphSlot) Face() *Face

func (*GlyphSlot) Format

func (g *GlyphSlot) Format() int

func (*GlyphSlot) GetGlyph

func (g *GlyphSlot) GetGlyph() (*Glyph, error)

func (*GlyphSlot) Library

func (g *GlyphSlot) Library() *Library

func (*GlyphSlot) LinearHoriAdvance

func (g *GlyphSlot) LinearHoriAdvance() int64

func (*GlyphSlot) LinearVertAdvance

func (g *GlyphSlot) LinearVertAdvance() int64

func (*GlyphSlot) LsbDelta

func (g *GlyphSlot) LsbDelta() int64

func (*GlyphSlot) Metrices

func (g *GlyphSlot) Metrices() *GlyphMetrics

func (*GlyphSlot) Next

func (g *GlyphSlot) Next() *GlyphSlot

func (*GlyphSlot) NumSubGlyphs

func (g *GlyphSlot) NumSubGlyphs() uint

func (*GlyphSlot) Outline

func (g *GlyphSlot) Outline() *Outline

func (*GlyphSlot) Render

func (g *GlyphSlot) Render(mode int) error

functions

func (*GlyphSlot) RsbDelta

func (g *GlyphSlot) RsbDelta() int64

type Library

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

A handle to a FreeType library instance. Each ‘library’ is completely independent from the others; it is the ‘root’ of a set of objects like fonts, faces, sizes, etc. In multi-threaded applications, make sure that the same library object or any of its children doesn't get accessed in parallel.

func InitFreeType

func InitFreeType() (*Library, error)

func (*Library) Done

func (l *Library) Done() error

type Matrix

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

func NewMatrix

func NewMatrix() *Matrix

func (*Matrix) SetXX

func (m *Matrix) SetXX(xx int64)

func (*Matrix) SetXY

func (m *Matrix) SetXY(xy int64)

func (*Matrix) SetYX

func (m *Matrix) SetYX(yx int64)

func (*Matrix) SetYY

func (m *Matrix) SetYY(yy int64)

func (*Matrix) XX

func (m *Matrix) XX() int64

func (*Matrix) XY

func (m *Matrix) XY() int64

func (*Matrix) YX

func (m *Matrix) YX() int64

func (*Matrix) YY

func (m *Matrix) YY() int64

type Outline

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

func (*Outline) Contours

func (o *Outline) Contours() []int16

the contour end points

func (*Outline) Flags

func (o *Outline) Flags() int

outline masks

func (*Outline) NumContours

func (o *Outline) NumContours() int

number of contours in glyph

func (*Outline) NumPoints

func (o *Outline) NumPoints() int

number of points in the glyph

func (*Outline) Points

func (o *Outline) Points() []Vector

the outline's points

func (*Outline) Render

func (o *Outline) Render(library *Library, params *RasterParams) error

func (*Outline) Tags

func (o *Outline) Tags() []byte

the points flags

type OutlineGlyph

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

A handle to an object used to model an outline glyph image. This is a sub-class of Glyph, and a pointer to OutlineGlyphRec.

func CastGlyphToOutlineGlyph

func CastGlyphToOutlineGlyph(glyph *Glyph) *OutlineGlyph

func (*OutlineGlyph) Outline

func (g *OutlineGlyph) Outline() *Outline

func (*OutlineGlyph) Root

func (g *OutlineGlyph) Root() *Glyph

type RasterParams

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

func NewRasterParams

func NewRasterParams() *RasterParams

func (*RasterParams) ClipBox

func (params *RasterParams) ClipBox() *BBox

An optional clipping box. It is only used in direct rendering mode. Note that coordinates here should be expressed in integer pixels (and not in 26.6 fixed-point units)

func (*RasterParams) Flags

func (params *RasterParams) Flags() int

The rendering flags.

func (*RasterParams) GraySpans

func (params *RasterParams) GraySpans() SpanFunc

func (*RasterParams) SetClipBox

func (params *RasterParams) SetClipBox(bbox *BBox)

func (*RasterParams) SetFlags

func (params *RasterParams) SetFlags(flags int)

func (*RasterParams) SetGraySpans

func (params *RasterParams) SetGraySpans(f SpanFunc)

func (*RasterParams) SetSource

func (params *RasterParams) SetSource(source *interface{})

func (*RasterParams) SetTarget

func (params *RasterParams) SetTarget(target *Bitmap)

func (*RasterParams) Source

func (params *RasterParams) Source() unsafe.Pointer

func (*RasterParams) Target

func (params *RasterParams) Target() *Bitmap

The target bitmap.

type Size

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

func (*Size) Face

func (s *Size) Face() Face

parent face object

func (*Size) Metrics

func (s *Size) Metrics() SizeMetrics

size metrics

type SizeMetrics

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

func (*SizeMetrics) Ascender

func (size *SizeMetrics) Ascender() int64

ascender in 26.6 frac. pixels

func (*SizeMetrics) Descender

func (size *SizeMetrics) Descender() int64

descender in 26.6 frac. pixels

func (*SizeMetrics) Height

func (size *SizeMetrics) Height() int64

text height in 26.6 frac. pixels

func (*SizeMetrics) MaxAdvance

func (size *SizeMetrics) MaxAdvance() int64

max horizontal advance, in 26.6 pixels

func (*SizeMetrics) XPpem

func (size *SizeMetrics) XPpem() int64

horizontal pixels per EM

func (*SizeMetrics) XScale

func (size *SizeMetrics) XScale() int64

scaling values used to convert font

func (*SizeMetrics) YPpem

func (size *SizeMetrics) YPpem() int64

vertical pixels per EM

func (*SizeMetrics) YScale

func (size *SizeMetrics) YScale() int64

units to 26.6 fractional pixels

type Span

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

func (*Span) Coverage

func (s *Span) Coverage() byte

func (*Span) Len

func (s *Span) Len() uint16

func (*Span) X

func (s *Span) X() int16

type SpanFunc

type SpanFunc func(y, count int, spans []Span)

type Stroker

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

func NewStroker

func NewStroker(library *Library) (*Stroker, error)

func (*Stroker) BeginSubPath

func (s *Stroker) BeginSubPath(to Vector, open bool) error

Start a new sub-path in the stroker.

func (*Stroker) ConicTo

func (s *Stroker) ConicTo(control, to *Vector) error

‘Draw’ a single quadratic Bézier in the stroker's current sub-path, from the last position.

func (*Stroker) CubicTo

func (s *Stroker) CubicTo(control1, control2, to *Vector) error

‘Draw’ a single cubic Bézier in the stroker's current sub-path, from the last position.

func (*Stroker) Done

func (s *Stroker) Done()

Destroy stroker object.

func (*Stroker) EndSubPath

func (s *Stroker) EndSubPath() error

Close the current sub-path in the stroker.

func (*Stroker) Export

func (s *Stroker) Export(outline *Outline)

Call this function after Stroker.GetBorderCounts to export all borders to your own Outline structure.

Note that this function appends the border points and contours to your outline,

but does not try to resize its arrays.

func (*Stroker) ExportBorder

func (s *Stroker) ExportBorder(border int, outline *Outline)

Call this function after Stroker.GetBorderCounts to export the corresponding border to your own Outline structure.

Note that this function appends the border points and contours to your outline, but does not try to resize its arrays.

func (*Stroker) GetBorderCounts

func (s *Stroker) GetBorderCounts(border int) (uint, uint, error)

Call this function once you have finished parsing your paths with the stroker. It returns the number of points and contours necessary to export one of the ‘border’ or ‘stroke’ outlines generated by the stroker.

func (*Stroker) GetCounts

func (s *Stroker) GetCounts() (uint, uint, error)

Call this function once you have finished parsing your paths with the stroker. It returns the number of points and contours necessary to export all points/borders from the stroked outline/path.

func (*Stroker) LineTo

func (s *Stroker) LineTo(to *Vector) error

‘Draw’ a single line segment in the stroker's current sub-path, from the last position.

func (*Stroker) ParseOutline

func (s *Stroker) ParseOutline(outline *Outline, opened bool) error

A convenience function used to parse a whole outline with the stroker. The resulting outline(s) can be retrieved later by functions

like Stroker.GetCounts and Stroker.Export.

func (*Stroker) Rewind

func (s *Stroker) Rewind()

Reset a stroker object without changing its attributes. You should call this function before beginning

a new series of calls to Stroker.BeginSubPath or Stroker.EndSubPath.

func (*Stroker) Set

func (s *Stroker) Set(radius int64, lineCap, lineJoin int, miterLimit int64)

Set resets the attributes.

type Vector

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

func NewVector

func NewVector() *Vector

func (*Vector) SetX

func (v *Vector) SetX(x int64)

func (*Vector) SetY

func (v *Vector) SetY(y int64)

func (*Vector) X

func (v *Vector) X() int64

func (*Vector) Y

func (v *Vector) Y() int64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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