Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Font ¶
Font contains a font face, color and size information. To change the font color, set the R, G, B, A values. These are red/green/blue/opacity color channels in the range [0..255]. A=0 is fully transparent, A=255 is solid. To change the font size, set the HeightInPixels.
func LoadFromFile ¶
LoadFromFile loads a True Type Font file (.ttf) and creates a font from it. The returned font is solid black and 20 pixels high.
func Read ¶
Read reads the True Type Font (.ttf) and creates a font from it. The returned font is solid black and 20 pixels high.
func (*Font) Measure ¶
Measure returns the size of the text when written in the Font's current pixel height.
func (*Font) Write ¶
Write writes the given text aligned top-left at the given image position. It returns the position where the text ends. This can be used to write the next text, e.g. if you want to write a single word in a text with a different color.
func (*Font) WriteAnchor ¶
WriteAnchor lets you justify the text horizontally and vertically. The anchor determines the point that the text "gravitates to". Here are some examples of what the Anchor type means, 'X' marks the anchor point in the image:
AnchorCenter AnchorCenterLeft AnchorBottomRight +----------+ +----------+ +----------+ | | | | | | | this | |centered | | | | iX | Xleft | | text at| | centered | |vertically| | bottom| | | | | | right| +----------+ +----------+ +----------X