Exemplo n.º 1
0
func (v *Context) FontExtents() FontExtents {
	var extents C.cairo_font_extents_t
	C.cairo_font_extents(v.native(), &extents)
	return FontExtents{
		Ascent:      float64(extents.ascent),
		Descent:     float64(extents.descent),
		Height:      float64(extents.height),
		MaxXAdvance: float64(extents.max_x_advance),
		MaxYAdvance: float64(extents.max_y_advance),
	}
}
Exemplo n.º 2
0
func (self *Surface) GetFontExtents() *GFontExtents {
	e := new(FontExtents)
	C.cairo_font_extents(self.context, &(e.extents))

	r := new(GFontExtents)
	r.Ascent = float64(e.extents.ascent)
	r.Descent = float64(e.extents.descent)
	r.Height = float64(e.extents.height)
	r.MaxXAdvance = float64(e.extents.max_x_advance)
	r.MaxYAdvance = float64(e.extents.max_y_advance)

	return r
}
Exemplo n.º 3
0
// void cairo_font_extents(cairo_t *cr, cairo_font_extents_t *extents);
func (self *Surface) FontExtents(extents *FontExtents) {
	C.cairo_font_extents(self.context, (*C.cairo_font_extents_t)(unsafe.Pointer(extents)))
}
Exemplo n.º 4
0
//FontExtents returns the extents of the currently selected font.
//
//Originally cairo_font_extents.
func (c *Context) FontExtents() FontExtents {
	var f C.cairo_font_extents_t
	C.cairo_font_extents(c.c, &f)
	return XtensionFontExtentsCtoGo(f)
}