I looked at it, but it doesnât say anywhere what is the default tab stop is.
Letâs say I have a following string: âabc\tdefâ. What the â\tâ will be expanded to by default: 4? 8? (spaces). It also says that it will use pango units by default. How does it match with the number of spaces?
The definition of device units is dependent on the output device; it will typically be pixels for a screen, and points for a printer
If you want to match them to âspacesâ you need to compute the size for a âspaceâ glyph given the current font description, and turn it into a PangoUnit, e.g.
// the size of the tab you want to set, in "spaces"
int tab_size = 4;
// fill out a string with tab_size spaces
char *tab_string = g_strnfill (tab_size, ' ');
// layout is set elsewhere, and it's a PangoLayout instance
pango_layout_set_text (layout, tab_string, -1);
// get the width of the layout in pixels
int tab_width = -1;
pango_layout_get_pixel_size (layout, &tab_width, NULL);
// set the default tab stop at tab_width pixels with a left alignment
PangoTabArray *tab_array = pango_tab_array_new (1, TRUE);
pango_tab_array_set_tab (tab_array, 0, PANGO_TAB_LEFT, tab_width);