I have a C program with these excerpts:
// Create new window to display unfragmented packet.
window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_resizable (GTK_WINDOW (window1), TRUE);
gtk_window_set_position (GTK_WINDOW (window1), GTK_WIN_POS_NONE);
gtk_window_set_title (GTK_WINDOW (window1), title[0]);
gtk_window_set_default_size (GTK_WINDOW (window1), 1000, 200);
gtk_container_set_border_width (GTK_CONTAINER (window1), 1);
// Create a textview object to display unfragmented packet.
textview1 = gtk_text_view_new ();
buffer1 = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview1));
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (textview1), TRUE);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_path (provider, "./packet.css", NULL);
context = gtk_widget_get_style_context (textview1);
gtk_style_context_add_provider (context, GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
I then put my text into nofrag_string.
And display:
// Put the text into the buffer.
gtk_text_buffer_set_text (buffer1, nofrag_string, -1);
// Add scrolled window and textview to new window1 and display unfragmented packet.
scrolled_win1 = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (scrolled_win1), textview1);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win1),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
gtk_container_add (GTK_CONTAINER (window1), scrolled_win1);
gtk_widget_show_all (window1);
and a CSS file packet.css:
textview {
font-family: Courier;
}
This works, except when it tries to display "ff":
For some reason, it changes to a proportional font for "ff". What I want is a non-proportional font always so that my output looks similar to what you'd get from xxd.
