Added text width function for font
This commit is contained in:
parent
a24dc7ba30
commit
0aff140884
@ -53,6 +53,13 @@ func (f *Font) Draw(left, top float32, color Color, align HorizontalAlignment, t
|
|||||||
C.al_draw_text(f.font, color.color, C.float(left), C.float(top), flags, t)
|
C.al_draw_text(f.font, color.color, C.float(left), C.float(top), flags, t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *Font) TextWidth(text string) float32 {
|
||||||
|
t := C.CString(text)
|
||||||
|
defer C.free(unsafe.Pointer(t))
|
||||||
|
|
||||||
|
return float32(C.al_get_text_width(f.font, t))
|
||||||
|
}
|
||||||
|
|
||||||
func (f *Font) Destroy() {
|
func (f *Font) Destroy() {
|
||||||
C.al_destroy_font(f.font)
|
C.al_destroy_font(f.font)
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user