diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-10-13 23:31:46 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-10-13 23:31:46 +0000 |
commit | 2b61f99bf2ba76a47538698f550c82f40a531253 (patch) | |
tree | 2011479e9445ca343ce50acbeff0b7ec2d17f5a7 /tbl_term.c | |
parent | 93daba037963fcb960efc065a77dbf9147b76659 (diff) | |
download | mandoc-2b61f99bf2ba76a47538698f550c82f40a531253.tar.gz mandoc-2b61f99bf2ba76a47538698f550c82f40a531253.tar.zst mandoc-2b61f99bf2ba76a47538698f550c82f40a531253.zip |
implement font modifiers in table layouts
Diffstat (limited to 'tbl_term.c')
-rw-r--r-- | tbl_term.c | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -1,4 +1,4 @@ -/* $Id: tbl_term.c,v 1.28 2014/08/10 23:54:41 schwarze Exp $ */ +/* $Id: tbl_term.c,v 1.29 2014/10/13 23:31:46 schwarze Exp $ */ /* * Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -43,6 +43,7 @@ static void tbl_number(struct termp *, const struct tbl_opts *, const struct roffcol *); static void tbl_hrule(struct termp *, const struct tbl_span *); static void tbl_vrule(struct termp *, const struct tbl_head *); +static void tbl_word(struct termp *, const struct tbl_dat *); static size_t @@ -378,7 +379,7 @@ tbl_literal(struct termp *tp, const struct tbl_dat *dp, } tbl_char(tp, ASCII_NBRSP, padl); - term_word(tp, dp->string); + tbl_word(tp, dp); tbl_char(tp, ASCII_NBRSP, padr); } @@ -419,8 +420,23 @@ tbl_number(struct termp *tp, const struct tbl_opts *opts, padl = col->decimal - d; tbl_char(tp, ASCII_NBRSP, padl); - term_word(tp, dp->string); + tbl_word(tp, dp); if (col->width > sz + padl) tbl_char(tp, ASCII_NBRSP, col->width - sz - padl); } +static void +tbl_word(struct termp *tp, const struct tbl_dat *dp) +{ + const void *prev_font; + + prev_font = term_fontq(tp); + if (dp->layout->flags & TBL_CELL_BOLD) + term_fontpush(tp, TERMFONT_BOLD); + else if (dp->layout->flags & TBL_CELL_ITALIC) + term_fontpush(tp, TERMFONT_UNDER); + + term_word(tp, dp->string); + + term_fontpopq(tp, prev_font); +} |