Can't apply monospace font to TextTag

Can’t understand the reason why it does not work:

let tag = TextTag::builder()
    .family("monospace") // does not work
    .left_margin(28)
    .scale(0.8)
    .wrap_mode(WrapMode::None)
    .build();

Maybe I forgot to enable some option?

It seems that can’t apply font setting on the TextTag.

string css_text = "textview { font-family: %s; font-size: %spt; }\0".printf(font_name, font_size);
try {
    this.editor.get_style_context().remove_provider(m_css_provider);
    m_css_provider.load_from_string (css_text);
    this.editor.get_style_context().add_provider(m_css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
} catch (Error err) {
    GLib.warning (_("Couldn't apply style to code view: %s"), err. Message);
}
1 Like

Now I understand, that’s mono, but aligned to left. Sorry, my fail with incorrect lines trimming

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