static void vt_bitblt_char(struct vt_device *vd, struct vt_font *vf, term_char_t c, int iscursor, unsigned int row, unsigned int col) { term_color_t fg, bg; vt_determine_colors(c, iscursor, &fg, &bg); if (vf != NULL) { const uint8_t *src; vt_axis_t top, left; src = vtfont_lookup(vf, c); /* * Align the terminal to the centre of the screen. * Fonts may not always be able to fill the entire * screen. */ top = row * vf->vf_height + vd->vd_offset.tp_row; left = col * vf->vf_width + vd->vd_offset.tp_col; vd->vd_driver->vd_bitbltchr(vd, src, NULL, 0, top, left, vf->vf_width, vf->vf_height, fg, bg); } else { vd->vd_driver->vd_putchar(vd, TCHAR_CHARACTER(c), row, col, fg, bg); } }
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]); }