|
|
|
@ -573,50 +573,46 @@ helper_cairo_destroy_context (cairo_t *cr) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct helper_cairo_line_t { |
|
|
|
|
cairo_glyph_t *glyphs; |
|
|
|
|
unsigned int num_glyphs; |
|
|
|
|
char *utf8; |
|
|
|
|
unsigned int utf8_len; |
|
|
|
|
cairo_text_cluster_t *clusters; |
|
|
|
|
unsigned int num_clusters; |
|
|
|
|
cairo_text_cluster_flags_t cluster_flags; |
|
|
|
|
|
|
|
|
|
void finish () { |
|
|
|
|
cairo_glyph_t *glyphs = nullptr; |
|
|
|
|
unsigned int num_glyphs = 0; |
|
|
|
|
char *utf8 = nullptr; |
|
|
|
|
unsigned int utf8_len = 0; |
|
|
|
|
cairo_text_cluster_t *clusters = nullptr; |
|
|
|
|
unsigned int num_clusters = 0; |
|
|
|
|
cairo_text_cluster_flags_t cluster_flags = (cairo_text_cluster_flags_t) 0; |
|
|
|
|
|
|
|
|
|
helper_cairo_line_t (const char *utf8_, |
|
|
|
|
unsigned utf8_len_, |
|
|
|
|
hb_buffer_t *buffer, |
|
|
|
|
hb_bool_t utf8_clusters, |
|
|
|
|
int scale_bits) : |
|
|
|
|
utf8 (utf8_ ? g_strndup (utf8_, utf8_len_) : nullptr), |
|
|
|
|
utf8_len (utf8_len_) |
|
|
|
|
{ |
|
|
|
|
hb_cairo_glyphs_from_buffer (buffer, |
|
|
|
|
utf8_clusters, |
|
|
|
|
1 << -scale_bits, 1 << -scale_bits, |
|
|
|
|
0., 0., |
|
|
|
|
utf8, utf8_len, |
|
|
|
|
&glyphs, &num_glyphs, |
|
|
|
|
&clusters, &num_clusters, |
|
|
|
|
&cluster_flags); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void finish () |
|
|
|
|
{ |
|
|
|
|
if (glyphs) |
|
|
|
|
cairo_glyph_free (glyphs); |
|
|
|
|
if (clusters) |
|
|
|
|
cairo_text_cluster_free (clusters); |
|
|
|
|
if (utf8) |
|
|
|
|
g_free (utf8); |
|
|
|
|
g_free (utf8); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void get_advance (double *x_advance, double *y_advance) { |
|
|
|
|
void get_advance (double *x_advance, double *y_advance) |
|
|
|
|
{ |
|
|
|
|
*x_advance = glyphs[num_glyphs].x; |
|
|
|
|
*y_advance = glyphs[num_glyphs].y; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static inline void |
|
|
|
|
helper_cairo_line_from_buffer (helper_cairo_line_t *l, |
|
|
|
|
hb_buffer_t *buffer, |
|
|
|
|
const char *text, |
|
|
|
|
unsigned int text_len, |
|
|
|
|
int scale_bits, |
|
|
|
|
hb_bool_t utf8_clusters) |
|
|
|
|
{ |
|
|
|
|
memset (l, 0, sizeof (*l)); |
|
|
|
|
|
|
|
|
|
l->utf8 = text ? g_strndup (text, text_len) : nullptr; |
|
|
|
|
l->utf8_len = text ? text_len : 0; |
|
|
|
|
|
|
|
|
|
hb_cairo_glyphs_from_buffer (buffer, |
|
|
|
|
utf8_clusters, |
|
|
|
|
1 << -scale_bits, 1 << -scale_bits, |
|
|
|
|
0., 0., |
|
|
|
|
l->utf8, l->utf8_len, |
|
|
|
|
&l->glyphs, &l->num_glyphs, |
|
|
|
|
&l->clusters, &l->num_clusters, |
|
|
|
|
&l->cluster_flags); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|