package render
import "github.com/go-text/render"
Index ¶
Types ¶
type Renderer ¶
type Renderer struct { // FontSize defines the point size of output text, commonly between 10 and 14 for regular text FontSize float32 // PixScale is used to indicate the pixel density of your output target. // For example on a hi-DPI (or "retina") display this may be 2.0. // Default value is 1.0, meaning 1 pixel on the image for each render pixel. PixScale float32 // Color is the pen colour for rendering Color color.Color // contains filtered or unexported fields }
Renderer defines a type that can render strings to a bitmap canvas. The size and look of output depends on the various fields in this struct. Developers should provide suitable output images for their draw requests. This type is not thread safe so instances should be used from only 1 goroutine.
func (*Renderer) DrawShapedRunAt ¶
DrawShapedRunAt will rasterise the given shaper run into the output image using font face referenced in the shaping. The text will be drawn starting at the startX, startY pixel position. Note that startX and startY are not multiplied by the `PixScale` value as they refer to output coordinates. The return value is the X pixel position of the end of the drawn string.
func (*Renderer) DrawString ¶
DrawString will rasterise the given string into the output image using the specified font face. The text will be drawn starting at the left edge, down from the image top by the font ascent value, so that the text is all visible. The return value is the X pixel position of the end of the drawn string.
func (*Renderer) DrawStringAt ¶
DrawStringAt will rasterise the given string into the output image using the specified font face. The text will be drawn starting at the x, y pixel position. Note that x and y are not multiplied by the `PixScale` value as they refer to output coordinates. The return value is the X pixel position of the end of the drawn string.
Source Files ¶
- Version
- v0.1.2
- Published
- Sep 28, 2024
- Platform
- darwin/amd64
- Imports
- 16 packages
- Last checked
- now –
Tools for package owners.