term_styled_ostream_create (int fd, const char *filename, ttyctl_t tty_control,
const char *css_filename)
{
- term_styled_ostream_t stream =
- XMALLOC (struct term_styled_ostream_representation);
+ term_styled_ostream_t stream;
CRStyleSheet *css_file_contents;
+ /* If css_filename is NULL, no styling is desired. The code below would end
+ up returning NULL anyway. But it's better to not rely on such details of
+ libcroco behaviour. */
+ if (css_filename == NULL)
+ return NULL;
+
+ stream = XMALLOC (struct term_styled_ostream_representation);
+
stream->base.base.vtable = &term_styled_ostream_vtable;
stream->destination = term_ostream_create (fd, filename, tty_control);
@end smallexample
Before this snippet, your code needs to determine the name of the style
-file to use (@code{style_file_name}).
+file to use (@code{style_file_name}). If no styling is desired -- the
+precise condition depends on the value of @code{color_mode} but also on
+your application logic --, you should set @code{style_file_name} to
+@code{NULL}.
An object of type @code{styled_ostream_t} is allocated. The function
@code{styled_ostream_create} allocates it; the function