Documentation ¶
Index ¶
- Constants
- func CachedFontFace(style fyne.TextStyle, opts *truetype.Options) font.Face
- func ClearFontCache()
- func DrawCircle(circle *canvas.Circle, vectorPad float32, scale func(float32) float32) *image.RGBA
- func DrawLine(line *canvas.Line, vectorPad float32, scale func(float32) float32) *image.RGBA
- func DrawRectangle(rect *canvas.Rectangle, vectorPad float32, scale func(float32) float32) *image.RGBA
- func GetAspect(img *canvas.Image) float32
- func IsResourceSVG(res fyne.Resource) bool
- func MeasureString(f font.Face, s string, tabWidth int) (advance fixed.Int26_6)
- func PaintImage(img *canvas.Image, c fyne.Canvas, width, height int) image.Image
- func RenderedTextSize(text string, fontSize float32, style fyne.TextStyle) (size fyne.Size, baseline float32)
- func VectorPad(obj fyne.CanvasObject) float32
- type FontDrawer
Constants ¶
const ( // DefaultTabWidth is the default width in spaces DefaultTabWidth = 4 // TextDPI is a global constant that determines how text scales to interface sizes TextDPI = 78 )
Variables ¶
This section is empty.
Functions ¶
func CachedFontFace ¶
CachedFontFace returns a font face held in memory. These are loaded from the current theme.
func ClearFontCache ¶
func ClearFontCache()
ClearFontCache is used to remove cached fonts in the case that we wish to re-load font faces
func DrawCircle ¶
DrawCircle rasterizes the given circle object into an image. The bounds of the output image will be increased by vectorPad to allow for stroke overflow at the edges. The scale function is used to understand how many pixels are required per unit of size.
func DrawLine ¶
DrawLine rasterizes the given line object into an image. The bounds of the output image will be increased by vectorPad to allow for stroke overflow at the edges. The scale function is used to understand how many pixels are required per unit of size.
func DrawRectangle ¶
func DrawRectangle(rect *canvas.Rectangle, vectorPad float32, scale func(float32) float32) *image.RGBA
DrawRectangle rasterizes the given rectangle object with stroke border into an image. The bounds of the output image will be increased by vectorPad to allow for stroke overflow at the edges. The scale function is used to understand how many pixels are required per unit of size.
func IsResourceSVG ¶ added in v2.1.2
func IsResourceSVG(res fyne.Resource) bool
IsResourceSVG checks if the resource is an SVG or not.
func MeasureString ¶ added in v2.1.0
MeasureString returns how far dot would advance by drawing s with f. Tabs are translated into a dot location change.
func PaintImage ¶
PaintImage renders a given fyne Image to a Go standard image
func RenderedTextSize ¶
func RenderedTextSize(text string, fontSize float32, style fyne.TextStyle) (size fyne.Size, baseline float32)
RenderedTextSize looks up how big a string would be if drawn on screen. It also returns the distance from top to the text baseline.
Types ¶
type FontDrawer ¶ added in v2.1.0
FontDrawer extends "golang.org/x/image/font" to add support for tabs FontDrawer draws text on a destination image.
A FontDrawer is not safe for concurrent use by multiple goroutines, since its Face is not.
func (*FontDrawer) DrawString ¶ added in v2.1.0
func (d *FontDrawer) DrawString(s string, tabWidth int)
DrawString draws s at the dot and advances the dot's location. Tabs are translated into a dot location change.