aboutsummaryrefslogtreecommitdiff
path: root/src/frame.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-03-23 21:28:30 +0100
committerThomas White <taw@physics.org>2018-03-23 21:28:30 +0100
commite0204fa4ae96ec9b298b67b723afe9fb6919a0d7 (patch)
treeaf8c7b75108be798483c9c33b7bb493640ca971f /src/frame.c
parent476a5210dcdddcad5eab5c5bc0e3cdee9a7efad1 (diff)
Add \ralign
Diffstat (limited to 'src/frame.c')
-rw-r--r--src/frame.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/frame.c b/src/frame.c
index bd66498..5d9acc0 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -54,6 +54,7 @@ struct _paragraph
int n_runs;
struct text_run *runs;
PangoLayout *layout;
+ PangoAlignment alignment;
/* For anything other than PARA_TYPE_TEXT
* (for text paragraphs, these things are in the runs) */
@@ -371,6 +372,7 @@ void wrap_paragraph(Paragraph *para, PangoContext *pc, double w,
}
pango_layout_set_width(para->layout, pango_units_from_double(w));
pango_layout_set_text(para->layout, text, total_len);
+ pango_layout_set_alignment(para->layout, para->alignment);
pango_layout_set_attributes(para->layout, attrs);
free(text);
pango_attr_list_unref(attrs);
@@ -439,6 +441,7 @@ Paragraph *create_paragraph(struct frame *fr, SCBlock *bl, SCBlock *rbl)
pnew->runs = NULL;
pnew->layout = NULL;
pnew->height = 0.0;
+ pnew->alignment = PANGO_ALIGN_LEFT;
return pnew;
}
@@ -1827,6 +1830,13 @@ void set_para_spacing(Paragraph *para, float space[4])
}
+void set_para_alignment(Paragraph *para, PangoAlignment align)
+{
+ if ( para == NULL ) return;
+ para->alignment = align;
+}
+
+
void *get_para_bvp(Paragraph *para)
{
if ( para->type != PARA_TYPE_CALLBACK ) return NULL;