// NewTextLayout creates a new TextLayout. func NewTextLayout(text string, initialStyle *InitialTextStyle) *TextLayout { l := new(TextLayout) ctext := C.CString(text) // all three of these are cleaned up by C.newTextLayout() is := C.newInitialTextStyle() is.Family = C.CString(initialStyle.Family) is.Size = C.double(initialStyle.Size) is.Weight = C.uiDrawTextWeight(initialStyle.Weight) is.Italic = C.uiDrawTextItalic(initialStyle.Italic) is.SmallCaps = frombool(initialStyle.SmallCaps) is.Stretch = C.uiDrawTextStretch(initialStyle.Stretch) // is.Gravity = C.uiDrawTextGravity(initialStyle.Gravity) is.Gravity = C.uiDrawTextGravitySouth l.l = C.newTextLayout(ctext, is) return l }
// NewTextLayout creates a new TextLayout. // For details on the width parameter, see SetWidth. func NewTextLayout(text string, defaultFont *Font, width float64) *TextLayout { l := new(TextLayout) ctext := C.CString(text) // freed by C.newTextLayout() l.l = C.newTextLayout(ctext, defaultFont.f, C.double(width)) return l }
// NewTextLayout creates a new TextLayout. func NewTextLayout(text string, defaultFont *Font) *TextLayout { l := new(TextLayout) ctext := C.CString(text) // freed by C.newTextLayout() l.l = C.newTextLayout(ctext, defaultFont.f) return l }