mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Fixes #2674. The cause of the issue was in get_pango_layout. When we call pango_parse_markup, `text` is the escaped string, and the unescaped string is then computed and written to `buf`. We were then passing the unescaped string to pango_layout_set_markup, but this function needs the escaped string. `buf` is not needed and has been removed. The other part of this PR refactors escape_markup_text to remove the dest_length argument and removes the -1 return value on error. It now assumes that you've allocated dest to the correct length.
		
			
				
	
	
		
			23 lines
		
	
	
	
		
			774 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
	
		
			774 B
		
	
	
	
		
			C
		
	
	
	
	
	
#ifndef _SWAY_PANGO_H
 | 
						|
#define _SWAY_PANGO_H
 | 
						|
#include <stdarg.h>
 | 
						|
#include <stdbool.h>
 | 
						|
#include <stdint.h>
 | 
						|
#include <cairo/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 pango_printf(cairo_t *cairo, const char *font,
 | 
						|
		double scale, bool markup, const char *fmt, ...);
 | 
						|
 | 
						|
#endif
 |