static inline void vt_determine_colors(term_char_t c, int cursor, term_color_t *fg, term_color_t *bg) { term_color_t tmp; int invert; invert = 0; *fg = TCHAR_FGCOLOR(c); if (TCHAR_FORMAT(c) & TF_BOLD) *fg = TCOLOR_LIGHT(*fg); *bg = TCHAR_BGCOLOR(c); if (TCHAR_FORMAT(c) & TF_REVERSE) invert ^= 1; if (cursor) invert ^= 1; if (invert) { tmp = *fg; *fg = *bg; *bg = tmp; } }
static inline void vt_determine_colors(term_char_t c, int cursor, term_color_t *fg, term_color_t *bg) { *fg = TCHAR_FGCOLOR(c); if (TCHAR_FORMAT(c) & TF_BOLD) *fg = TCOLOR_LIGHT(*fg); *bg = TCHAR_BGCOLOR(c); if (TCHAR_FORMAT(c) & TF_REVERSE) { term_color_t tmp; tmp = *fg; *fg = *bg; *bg = tmp; } if (cursor) { *fg = *bg; *bg = TC_WHITE; } }
const uint8_t * vtfont_lookup(const struct vt_font *vf, term_char_t c) { uint32_t src; uint16_t dst; size_t stride; unsigned int normal_map; unsigned int bold_map; /* * No support for printing right hand sides for CJK fullwidth * characters. Simply print a space and assume that the left * hand side describes the entire character. */ src = TCHAR_CHARACTER(c); if (TCHAR_FORMAT(c) & TF_CJK_RIGHT) { normal_map = VFNT_MAP_NORMAL_RIGHT; bold_map = VFNT_MAP_BOLD_RIGHT; } else { normal_map = VFNT_MAP_NORMAL; bold_map = VFNT_MAP_BOLD; } if (TCHAR_FORMAT(c) & TF_BOLD) { dst = vtfont_bisearch(vf->vf_map[bold_map], vf->vf_map_count[bold_map], src); if (dst != 0) goto found; } dst = vtfont_bisearch(vf->vf_map[normal_map], vf->vf_map_count[normal_map], src); found: stride = howmany(vf->vf_width, 8) * vf->vf_height; return (&vf->vf_bytes[dst * stride]); }