2018-03-29 03:04:20 +00:00
|
|
|
#ifndef _SWAY_PANGO_H
|
|
|
|
#define _SWAY_PANGO_H
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
2021-05-07 20:57:51 +00:00
|
|
|
#include <cairo.h>
|
2018-03-29 03:04:20 +00:00
|
|
|
#include <pango/pangocairo.h>
|
2023-02-28 15:13:59 +00:00
|
|
|
#include "stringop.h"
|
2018-03-29 03:04:20 +00:00
|
|
|
|
2018-09-21 11:27:36 +00:00
|
|
|
/**
|
|
|
|
* Utility function which escape characters a & < > ' ".
|
2018-05-07 16:30:45 +00:00
|
|
|
*
|
2018-09-21 11:27:36 +00:00
|
|
|
* The function returns the length of the escaped string, optionally writing the
|
|
|
|
* escaped string to dest if provided.
|
2018-05-07 16:30:45 +00:00
|
|
|
*/
|
2018-09-21 11:27:36 +00:00
|
|
|
size_t escape_markup_text(const char *src, char *dest);
|
2022-07-01 10:23:04 +00:00
|
|
|
PangoLayout *get_pango_layout(cairo_t *cairo, const PangoFontDescription *desc,
|
2018-05-16 16:01:04 +00:00
|
|
|
const char *text, double scale, bool markup);
|
2022-07-01 10:23:04 +00:00
|
|
|
void get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width, int *height,
|
2023-02-28 15:13:59 +00:00
|
|
|
int *baseline, double scale, bool markup, const char *fmt, ...) _SWAY_ATTRIB_PRINTF(8, 9);
|
2022-07-01 10:23:04 +00:00
|
|
|
void get_text_metrics(const PangoFontDescription *desc, int *height, int *baseline);
|
|
|
|
void render_text(cairo_t *cairo, PangoFontDescription *desc,
|
2023-02-28 15:13:59 +00:00
|
|
|
double scale, bool markup, const char *fmt, ...) _SWAY_ATTRIB_PRINTF(5, 6);
|
2018-03-29 03:04:20 +00:00
|
|
|
|
|
|
|
#endif
|