2007-08-28 15:05:00 -04:00
|
|
|
/** Format attributes utilities
|
|
|
|
* @file */
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "elinks.h"
|
|
|
|
|
|
|
|
#include "document/format.h"
|
|
|
|
#include "document/options.h"
|
|
|
|
#include "terminal/draw.h"
|
|
|
|
#include "util/color.h"
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2016-04-20 12:05:00 -04:00
|
|
|
get_screen_char_template(struct screen_char *template_,
|
2007-08-28 15:05:00 -04:00
|
|
|
struct document_options *options,
|
|
|
|
struct text_style style)
|
|
|
|
{
|
2016-04-20 12:05:00 -04:00
|
|
|
template_->attr = 0;
|
|
|
|
template_->data = ' ';
|
2007-08-28 15:05:00 -04:00
|
|
|
|
|
|
|
if (style.attr) {
|
|
|
|
if (style.attr & AT_UNDERLINE) {
|
2016-04-20 12:05:00 -04:00
|
|
|
template_->attr |= SCREEN_ATTR_UNDERLINE;
|
2007-08-28 15:05:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (style.attr & AT_BOLD) {
|
2016-04-20 12:05:00 -04:00
|
|
|
template_->attr |= SCREEN_ATTR_BOLD;
|
2007-08-28 15:05:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (style.attr & AT_ITALIC) {
|
2016-04-20 12:05:00 -04:00
|
|
|
template_->attr |= SCREEN_ATTR_ITALIC;
|
2007-08-28 15:05:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (style.attr & AT_GRAPHICS) {
|
2016-04-20 12:05:00 -04:00
|
|
|
template_->attr |= SCREEN_ATTR_FRAME;
|
2007-08-28 15:05:00 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2007-10-12 10:41:06 -04:00
|
|
|
struct color_pair colors = INIT_COLOR_PAIR(style.color.background, style.color.foreground);
|
2016-04-20 12:05:00 -04:00
|
|
|
set_term_color(template_, &colors, options->color_flags, options->color_mode);
|
2007-08-28 15:05:00 -04:00
|
|
|
}
|
|
|
|
}
|