Failed assertion regarding cache_frozen in cairo-scaled-font.c
While I was making a test for another issue, I stumbled upon a failed assertion. Here's the sample code:
#include <cairo.h>
#include <cairo-win32.h>
#include <windows.h>
#include <stdio.h>
const wchar_t* font_name[47] = {
L"Arial",
L"Bahnschrift",
L"Calibri",
L"Cambria",
L"Cambria Math",
L"Candara",
L"Comic Sans MS",
L"Consolas",
L"Constantia",
L"Corbel",
L"Courier New",
L"Ebrima",
L"Franklin Gothic",
L"Gabriola",
L"Gadugi",
L"Georgia",
L"HoloLens MDL2 Assets",
L"Impact",
L"Ink Free",
L"Javanese Text",
L"Leelawadee UI",
L"Lucida Console",
L"Lucida Sans Unicode",
L"MS Gothic",
L"MS PGothic",
L"MS UI Gothic",
L"MV Boli",
L"Malgun Gothic",
L"Microsoft Himalaya",
L"Microsoft JhengHei",
L"Microsoft JhengHei UI",
L"Microsoft New Tai Lue",
L"Microsoft PhagsPa",
L"Microsoft Sans Serif",
L"Microsoft Tai Le",
L"Microsoft YaHei",
L"Microsoft YaHei UI",
L"Microsoft Yi Baiti",
L"MingLiU-ExtB",
L"MingLiU_HKSCS-ExtB",
L"Mongolian Baiti",
L"Myanmar Text",
L"Nirmala UI",
L"PMingLiU-ExtB",
L"Palatino Linotype",
L"Segoe MDL2 Assets",
L"Segoe Print"
};
int main()
{
cairo_surface_t *surface = cairo_win32_surface_create_with_dib (CAIRO_FORMAT_ARGB32, 100, 100);
cairo_t *cr = cairo_create (surface);
for (unsigned int i = 0; i < 42; i++)
{
LOGFONTW logfont = {};
cairo_font_face_t *font_face;
cairo_font_options_t *options;
cairo_matrix_t identity;
cairo_scaled_font_t *font;
cairo_glyph_t glyph;
memset (&logfont, 0, sizeof (logfont));
wcscpy (logfont.lfFaceName, font_name[i]);
logfont.lfHeight = 40;
logfont.lfWidth = 0;
logfont.lfEscapement = 0;
logfont.lfOrientation = 0;
logfont.lfWeight = FW_SEMIBOLD;
logfont.lfItalic = 0;
logfont.lfUnderline = 0;
logfont.lfStrikeOut = 0;
logfont.lfCharSet = DEFAULT_CHARSET;
font_face = cairo_win32_font_face_create_for_logfontw (&logfont);
options = cairo_font_options_create ();
cairo_matrix_init_identity (&identity);
font = cairo_scaled_font_create (font_face, &identity, &identity, options);
cairo_set_scaled_font (cr, font);
glyph = (cairo_glyph_t) {
.index = 0,
.x = 0,
.y = 0,
};
for (glyph.index = 0; glyph.index < 3000; glyph.index++)
cairo_show_glyphs (cr, &glyph, 1);
cairo_font_options_destroy (options);
}
cairo_destroy (cr);
cairo_surface_destroy (surface);
}
When running I hit the following assertion:
Assertion failed: !scaled_font->cache_frozen, file ../cairo/src/cairo-scaled-font.c, line 467