Documentation ¶
Index ¶
- Constants
- 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 DrawString(dst draw.Image, s string, color color.Color, f []font.Face, ...)
- func MeasureString(f []font.Face, s string, textSize float32, tabWidth int) (size fyne.Size, advance float32)
- 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 FontCacheItem
Constants ¶
const (
// DefaultTabWidth is the default width in spaces
DefaultTabWidth = 4
)
Variables ¶
This section is empty.
Functions ¶
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 DrawString ¶
func DrawString(dst draw.Image, s string, color color.Color, f []font.Face, fontSize, scale float32, tabWidth int)
DrawString draws a string into an image.
func MeasureString ¶
func MeasureString(f []font.Face, s string, textSize float32, tabWidth int) (size fyne.Size, advance float32)
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 If a fyne.Canvas is given and the image’s fill mode is “fill original” the image’s min size has to fit its original size. If it doesn’t, PaintImage does not paint the image but adjusts its min size. The image will then be painted on the next frame because of the min size change.
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 FontCacheItem ¶
func CachedFontFace ¶
func CachedFontFace(style fyne.TextStyle, fontDP float32, texScale float32) *FontCacheItem
CachedFontFace returns a Font face held in memory. These are loaded from the current theme.