func ParseFont(b []byte) (*truetype.Font, error)
ParseFont just calls the Parse function from the freetype/truetype package. It is provided here so that code that imports this package doesn't need to also include the freetype/truetype package.
func Pt(x, y int) fixed.Point26_6
Pt converts from a co-ordinate pair measured in pixels to a fixed.Point26_6 co-ordinate pair measured in fixed.Int26_6 units.
A Context holds the state for drawing text in a given font and size.
type Context struct {
// contains filtered or unexported fields
}
func NewContext() *Context
NewContext creates a new Context.
func (c *Context) DrawString(s string, p fixed.Point26_6) (fixed.Point26_6, error)
DrawString draws s at p and returns p advanced by the text extent. The text is placed so that the left edge of the em square of the first character of s and the baseline intersect at p. The majority of the affected pixels will be above and to the right of the point, but some may be below or to the left. For example, drawing a string that starts with a 'J' in an italic font may affect pixels below and left of the point.
p is a fixed.Point26_6 and can therefore represent sub-pixel positions.
func (c *Context) PointToFixed(x float64) fixed.Int26_6
PointToFixed converts the given number of points (as in "a 12 point font") into a 26.6 fixed point number of pixels.
func (c *Context) SetClip(clip image.Rectangle)
SetClip sets the clip rectangle for drawing.
func (c *Context) SetDPI(dpi float64)
SetDPI sets the screen resolution in dots per inch.
func (c *Context) SetDst(dst draw.Image)
SetDst sets the destination image for draw operations.
func (c *Context) SetFont(f *truetype.Font)
SetFont sets the font used to draw text.
func (c *Context) SetFontSize(fontSize float64)
SetFontSize sets the font size in points (as in "a 12 point font").
func (c *Context) SetHinting(hinting font.Hinting)
SetHinting sets the hinting policy.
func (c *Context) SetSrc(src image.Image)
SetSrc sets the source image for draw operations. This is typically an image.Uniform.
Name | Synopsis |
---|---|
.. | |
example | |
capjoin | |
drawer | |
freetype | |
gamma | |
genbasicfont | Program genbasicfont generates Go source code that imports golang.org/x/image/font/basicfont to provide a fixed width font face. |
raster | |
round | This program visualizes the quadratic approximation to the circle, used to implement round joins when stroking paths. |
truetype | |
raster | Package raster provides an anti-aliasing 2-D rasterizer. |
truetype | Package truetype provides a parser for the TTF and TTC file formats. |