add new text shadow documentation

This commit is contained in:
Felix Kratz 2021-12-23 15:04:51 +01:00
parent 113447d74d
commit 1b9f9c3486
2 changed files with 9 additions and 2 deletions

View file

@ -182,6 +182,7 @@ Icon properties:
* *icon.width*: Used to make the icon have a fixed custom width given in points (default: *dynamic*)
* *icon.align*: Used to align icons when they have a fixed width (values: *center*, *left*, *right*, default: *left*)
* *icon.background.\<property\>*: all background properties are also available for the icon
* *icon.shadow.\<property\>*: all shadow properties are available for the icon
Label properties:
* *label*: the label of the item
@ -196,6 +197,7 @@ Label properties:
* *label.width*: Used to make the label have a fixed custom width given in points (default: *dynamic*)
* *label.align*: Used to align labels when they have a fixed width (values: *center*, *left*, *right*, default: *left*)
* *label.background.\<property\>*: all background properties are also available for the label
* *icon.shadow.\<property\>*: all shadow properties are available for the shadow
Background properties:
* *background.drawing*: wether the item should draw a background (values: *on*, *off*, *toggle*, default: *off*)
@ -218,6 +220,13 @@ Drawing properties:
* *drawing*: If the item should be drawn into the bar (values: *on*, *off*, *toggle*, default: *on*)
* *lazy*: Changes do not trigger a redraw of the bar, item is refreshed when the bar is redrawn anyways (values: *on*, *off*, *toggle*, default: *off*)
Shadow properties (Only on HEAD currently):
* *shadow.drawing*: If the shadow should be drawn (values: *on*, *off*, *toggle*, default: *off*)
* *shadow.angle*: The angle of the shadow (between 0 and 360, default: 30)
* *shadow.distance*: The distance of the shadow (default: 5)
* *shadow.color*: The color of the shadow (default: 0xff000000)
### Changing the default values for all further items
It is possible to change the *defaults* at every point in the configuration. All item created *after* changing the defaults will
inherit these properties from the default item.

View file

@ -159,10 +159,8 @@ void text_draw(struct text* text, CGContextRef context) {
background_draw(&text->background, context);
if (text->shadow.enabled) {
printf("Drawing shadow\n");
CGContextSetRGBFillColor(context, text->shadow.color.r, text->shadow.color.g, text->shadow.color.b, text->shadow.color.a);
CGRect bounds = shadow_get_bounds(&text->shadow, text->bounds);
printf("At: %f %f \n", bounds.origin.x, bounds.origin.y);
CGContextSetTextPosition(context, bounds.origin.x + text->padding_left, bounds.origin.y + text->y_offset);
CTLineDraw(text->line.line, context);
}