sway/include/pango.h
Felix Weilbach a2763262d4 Fix crash when long window titles are used
cairo_image_surface_create() return CAIRO_STATUS_INVALID_SIZE on too
long window titles and creates then no surface. Therefore it makes
sense to limit the window title length to a reasonable length.

Fix: https://github.com/swaywm/sway/issues/6531

Signed-off-by: Felix Weilbach <felix.weilbach@t-online.de>
2021-12-05 12:25:14 +01:00

26 lines
963 B
C

#ifndef _SWAY_PANGO_H
#define _SWAY_PANGO_H
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <cairo.h>
#include <pango/pangocairo.h>
/**
* Utility function which escape characters a & < > ' ".
*
* The function returns the length of the escaped string, optionally writing the
* escaped string to dest if provided.
*/
size_t escape_markup_text(const char *src, char *dest);
PangoLayout *get_pango_layout(cairo_t *cairo, const char *font,
const char *text, double scale, bool markup);
void get_text_size(cairo_t *cairo, const char *font, int *width, int *height,
int *baseline, double scale, bool markup, const char *fmt, ...);
void get_text_metrics(const char *font, int *height, int *baseline);
void render_text(cairo_t *cairo, const char *font,
double scale, bool markup, const char *fmt, ...);
void render_text_ellipsize(cairo_t *cairo, const char *font, double scale,
bool markup, double width, const char *fmt, ...);
#endif