func fontSetSubtypeID(f *C.cairo_font_face_t, s subtypeID) { if fontType(C.cairo_font_face_get_type(f)) != FontTypeUser { panic("font is not a user font") } if C.cairo_font_face_get_user_data(f, stkey) != nil { panic("font already has subtype set") } C.cairo_font_face_set_user_data(f, stkey, s.c(), free) }
func fontGetSubtypeID(f *C.cairo_font_face_t) subtypeID { if fontType(C.cairo_font_face_get_type(f)) != FontTypeUser { panic("font is not a user font") } p := C.cairo_font_face_get_user_data(f, stkey) if p == nil { panic("no subtype set: font not registered") } return subtypeID(ctoint(p)) }