today I talked to behdad in #cairo
He gave me these instructions after reading my code:

(02:03:59) behdad: JucaBlues: the new text_to_glyph areguments are mandoatry
(02:04:08) behdad: and you shouldn't ignore utf8_len
(02:04:09) behdad: really
(02:04:19) behdad: forget about the old api
(02:04:26) behdad: it was never in a released version of cairo
(02:05:43) behdad: JucaBlues: also you shouldn't use malloc for glyphs anymore.
(02:06:03) behdad: JucaBlues: read the new cairo_user_scaled_font_text_to_glyphs_func_t docs and implement it
(02:06:58) behdad: your code also is not utf8-clean
(02:07:27) Juca: :-P
(02:07:38) Juca: so I have lots of stuff to work on
(02:08:30) Juca: what do you mean by utf8-clean?
(02:08:57) behdad: use g_utf8_* functions to deal with text
(02:09:03) behdad: instead of assuming one char = one byte
(02:09:08) Juca: ah
(02:09:10) Juca: great!
(02:09:41) Juca: I didnt now that but I was sure there was a correct way of coding it
(02:09:56) Juca: and I suspected mine was wrong