I’m doing some graphics with cairo in Javascript, and I found that I can’t set the line width. In official documentation I should use gdk_cairo_set_line_width(context, new_width); so in Javascript it should be:
That would be a bug in the documentation. Gdk includes some API to integrate its own data types with cairo, but cairo_set_line_width() is part of cairo itself.
Cairo doesn’t use the GObject type system, so it is not introspectable itself. gobject-introspection includes a minimal GIR/typelib for cairo, but that only wraps some types that appear in other APIs (like GDK/GTK).
Bindings that want to expose the cairo API themselves need to implement a custom binding.
gjs does that, but it doesn’t expose different case styles like it does for introspected API. That is, you have to use camelCase, not snake_case: