mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-08 03:18:05 +02:00
[test] Fix reference handling in user-font-rescale
user-font-rescale stored the current font on the context in order to create a rescaling proxy font. As we failed to take a reference to the font, it caught us by surprise when the font disappeared as we modified the context before creating our proxy. Ho hum.
This commit is contained in:
parent
5ad65dc4be
commit
93672d842f
1 changed files with 3 additions and 1 deletions
|
|
@ -323,7 +323,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_show_text (cr, text);
|
||||
|
||||
/* same text in 'mono' with widths that match the 'sans' version */
|
||||
old = cairo_get_font_face (cr);
|
||||
old = cairo_font_face_reference (cairo_get_font_face (cr));
|
||||
cairo_select_font_face (cr,
|
||||
"Bitstream Vera Sans Mono",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
|
|
@ -331,10 +331,12 @@ draw (cairo_t *cr, int width, int height)
|
|||
substitute = cairo_get_font_face (cr);
|
||||
|
||||
status = get_user_font_face (substitute, text, old, &rescaled);
|
||||
cairo_font_face_destroy (old);
|
||||
if (status) {
|
||||
return cairo_test_status_from_status (cairo_test_get_context (cr),
|
||||
status);
|
||||
}
|
||||
|
||||
cairo_set_font_face (cr, rescaled);
|
||||
cairo_font_face_destroy (rescaled);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue