aboutsummaryrefslogtreecommitdiff
path: root/libstorycode/slide_render_cairo.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.me.uk>2019-02-25 21:54:40 +0100
committerThomas White <taw@bitwiz.me.uk>2019-02-25 22:16:19 +0100
commit52d08227913e4cbbc593ed2ccb066ee29e4e33c9 (patch)
tree68d758a390c7555b229cf704339b5b6163a2b835 /libstorycode/slide_render_cairo.c
parentb9c16eb6d903ab809b340d404139dcaa1872ea9c (diff)
Use text alignment
Diffstat (limited to 'libstorycode/slide_render_cairo.c')
-rw-r--r--libstorycode/slide_render_cairo.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libstorycode/slide_render_cairo.c b/libstorycode/slide_render_cairo.c
index b7e3f15..7942d27 100644
--- a/libstorycode/slide_render_cairo.c
+++ b/libstorycode/slide_render_cairo.c
@@ -73,6 +73,7 @@ static void render_text(struct slide_item *item, cairo_t *cr, PangoContext *pc,
double fgcol[4];
PangoRectangle rect;
PangoFontDescription *fontdesc;
+ PangoAlignment palignment;
x = lcalc(item->geom.x, parent_w);
y = lcalc(item->geom.y, parent_h);
@@ -92,6 +93,14 @@ static void render_text(struct slide_item *item, cairo_t *cr, PangoContext *pc,
}
}
+ if ( item->align == ALIGN_INHERIT ) {
+ /* Use value from stylesheet */
+ palignment = to_pangoalignment(align);
+ } else {
+ /* Use item-specific value */
+ palignment = to_pangoalignment(item->align);
+ }
+
for ( i=0; i<item->n_paras; i++ ) {
if ( item->layouts[i] == NULL ) {
@@ -101,8 +110,7 @@ static void render_text(struct slide_item *item, cairo_t *cr, PangoContext *pc,
pango_units_from_double(w));
pango_layout_set_text(item->layouts[i], item->paragraphs[i], -1);
- pango_layout_set_alignment(item->layouts[i],
- to_pangoalignment(item->align));
+ pango_layout_set_alignment(item->layouts[i], palignment);
pango_layout_set_font_description(item->layouts[i], fontdesc);