Programmatically set Pango Cairo Backend

I know setting PANGOCAIRO_BACKEND will change the backend. How can that be done programmatically? Is it as simple as setting a defining statement?

I could find the docs say to use pango_cairo_font_map_set_default(), so is it like getting the font map using pango_cairo_font_map_new_for_font_type () and calling pango_cairo_font_map_set_default() ? But I find pango_cairo_font_map_new_for_font_type returns of type PangoFontMap * while pango_cairo_font_map_set_default wants of type PangoCairoFontMap * how to convert it?

I want to use fontconfig backend on Windows for my small gtk app.

Just cast it. That should work fine.

1 Like

That works, Thanks.

Now I am wondering when to free the font map generated there? Or is there a better way than doing this?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.