Per esempio con questo semplice e breve codice io non ottengo l'errore da te segnalato:
Library "libcairomm-1.0:1.4.0"
Public Struct cairo_text_extents_t
x_bearing As Float
y_bearing As Float
width As Float
height As Float
x_advance As Float
y_advance As Float
End Struct
Private Const CAIRO_FORMAT_ARGB32 As Integer = 0
Private Enum CAIRO_FONT_SLANT_NORMAL = 0, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_SLANT_OBLIQUE
Private Enum CAIRO_FONT_WEIGHT_NORMAL = 0, CAIRO_FONT_WEIGHT_BOLD
' cairo_surface_t * cairo_image_surface_create(cairo_format_t formatI, int width, int height)
' Creates an image surface of the specified format and dimensions.
Private Extern cairo_image_surface_create(formatI As Integer, width As Integer, height As Integer) As Pointer
' void cairo_set_source_rgb (cairo_t *cr, double red, double green, double blue)
' Sets the source pattern within cr to an opaque color.
Private Extern cairo_set_source_rgb(cr As Pointer, red As Float, green As Float, blue As Float)
' void cairo_select_font_face (cairo_t *cr, const char *family, cairo_font_slant_t slant, cairo_font_weight_t weight)
' Selects a family and style of font from a simplified description as a family name, slant and weight.
Private Extern cairo_select_font_face(cr As Pointer, family As String, slant As Integer, weight As Integer)
' void cairo_set_font_size (cairo_t *cr, double size)
' Sets the current font matrix to a scale by a factor of size.
Private Extern cairo_set_font_size(cr As Pointer, size As Float)
' void cairo_text_extents(cairo_t *cr,Const char * utf8,cairo_text_extents_t * extents);
' Gets the extents for a string of text.
Private Extern cairo_text_extents(cr As Pointer, utf8_string As String, extents As Cairo_text_extents_t)
Public Sub Main()
Dim cairo As Pointer
Dim my_text_extent As New Cairo_text_extents_t
cairo = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 400, 200)
If cairo = 0 Then Error.Raise("Impossibile creare la superficie per l'immagine !")
cairo_set_source_rgb(cairo, 0.0, 0.0, 0.0)
cairo_select_font_face(cairo, "Liberation Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD)
cairo_set_font_size(cairo, 18.0)
cairo_text_extents(cairo, "testo quasiasi", my_text_extent)
End