Add text offset size

This commit is contained in:
kj 2017-03-24 10:17:35 +09:00
parent fee2f86db7
commit fe32c034fa
3 changed files with 7 additions and 1 deletions

View file

@ -277,6 +277,7 @@ struct ya_bar {
uint8_t ulsize; //underline size
uint8_t olsize; //overline size
uint8_t oosize; //offset size
uint8_t slack; //slack size
uint32_t brcolor; //border color

View file

@ -728,7 +728,7 @@ void ya_draw_pango_text(struct ya_block *blk) {
pango_layout_set_width(layout, blk->width * PANGO_SCALE);
pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END);
int offset = (blk->bar->height - ht)/2;
int offset = (blk->bar->height - ht)/2 + blk->bar->oosize;
cairo_move_to(cr, 0, offset);
pango_cairo_show_layout(cr, layout);
cairo_move_to(cr, 0, offset);

View file

@ -59,6 +59,7 @@ static void ya_copy_bar_members(ya_bar_t *dstb, ya_bar_t *srcb) {
dstb->desc = srcb->desc;
dstb->ulsize = srcb->ulsize;
dstb->olsize = srcb->olsize;
dstb->oosize = srcb->oosize;
dstb->slack = srcb->slack;
dstb->brcolor = srcb->brcolor;
dstb->brsize = srcb->brsize;
@ -312,6 +313,10 @@ static void ya_setup_bar(config_setting_t * set) {
if(retcnf == CONFIG_TRUE) {
bar->olsize = retint;
}
retcnf = config_setting_lookup_int(set, "offset-size", &retint);
if(retcnf == CONFIG_TRUE) {
bar->oosize = retint;
}
retcnf = config_setting_lookup_int(set, "background-color-argb", &retint);
if(retcnf == CONFIG_FALSE) {
if(NOT_INHERIT_BAR(bar))