1
0
mirror of https://github.com/rkd77/elinks.git synced 2025-01-03 14:57:44 -05:00
elinks/src/document/format.c
Laurent MONIN 09cf904814 Backport Pasky's changes concerning text_style-related stuff.
It partially includes changes made in following commits:

document/html: struct text_attrib_style -> struct text_style
commit    e133941206

document: struct format_attr -> struct text_style_format
commit    070d335796

document: Unify text style -> screen attribute handling
commit    b66d2bec67

document: Move text_style-related stuff to dedicated format.*
commit    db9431465f
2007-09-14 14:59:37 +02:00

47 lines
892 B
C

/** 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
get_screen_char_template(struct screen_char *template,
struct document_options *options,
struct text_style style)
{
template->attr = 0;
template->data = ' ';
if (style.attr) {
if (style.attr & AT_UNDERLINE) {
template->attr |= SCREEN_ATTR_UNDERLINE;
}
if (style.attr & AT_BOLD) {
template->attr |= SCREEN_ATTR_BOLD;
}
if (style.attr & AT_ITALIC) {
template->attr |= SCREEN_ATTR_ITALIC;
}
if (style.attr & AT_GRAPHICS) {
template->attr |= SCREEN_ATTR_FRAME;
}
}
{
struct color_pair colors = INIT_COLOR_PAIR(style.bg, style.fg);
set_term_color(template, &colors, options->color_flags, options->color_mode);
}
}