From 789a877b379cd35c350610be62b971ae00feb542 Mon Sep 17 00:00:00 2001 From: Heghedus Razvan Date: Mon, 7 May 2018 19:30:45 +0300 Subject: Fix crash when using pango markup font The characters & < > ' " needs to be escaped when using pango markup Signed-off-by: Heghedus Razvan --- include/pango.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/pango.h') diff --git a/include/pango.h b/include/pango.h index f6325f28..d8263f9e 100644 --- a/include/pango.h +++ b/include/pango.h @@ -6,6 +6,17 @@ #include #include +/* Utility function which escape characters a & < > ' ". + * + * If the dest parameter is NULL, then the function returns the length of + * of the escaped src string. The dest_length doesn't matter. + * + * If the dest parameter is not NULL then the fuction escapes the src string + * an puts the escaped string in dest and returns the lenght of the escaped string. + * The dest_length parameter is the size of dest array. If the size of dest is not + * enough, then the function returns -1. + */ +int escape_markup_text(const char *src, char *dest, int dest_length); PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, const char *text, int32_t scale, bool markup); void get_text_size(cairo_t *cairo, const char *font, int *width, int *height, -- cgit v1.2.3-70-g09d2