diff --git a/gsk/gskrendernodeparser.c b/gsk/gskrendernodeparser.c index ea83f11723..03183c61fb 100644 --- a/gsk/gskrendernodeparser.c +++ b/gsk/gskrendernodeparser.c @@ -854,7 +854,8 @@ parse_mask_mode (GtkCssParser *parser, static PangoFont * font_from_string (PangoFontMap *fontmap, - const char *string) + const char *string, + gboolean allow_fallback) { PangoFontDescription *desc; PangoContext *ctx; @@ -865,7 +866,7 @@ font_from_string (PangoFontMap *fontmap, font = pango_font_map_load_font (fontmap, ctx, desc); g_object_unref (ctx); - if (font) + if (font && !allow_fallback) { PangoFontDescription *desc2; const char *family, *family2; @@ -1081,7 +1082,7 @@ parse_font (GtkCssParser *parser, return FALSE; if (context->fontmap) - font = font_from_string (context->fontmap, font_name); + font = font_from_string (context->fontmap, font_name, FALSE); if (gtk_css_parser_has_url (parser)) { @@ -1140,7 +1141,7 @@ parse_font (GtkCssParser *parser, if (success) { - font = font_from_string (context->fontmap, font_name); + font = font_from_string (context->fontmap, font_name, FALSE); if (!font) { gtk_css_parser_error (parser, @@ -1156,7 +1157,7 @@ parse_font (GtkCssParser *parser, else { if (!font) - font = font_from_string (pango_cairo_font_map_get_default (), font_name); + font = font_from_string (pango_cairo_font_map_get_default (), font_name, TRUE); if (!font) gtk_css_parser_error_value (parser, "The font \"%s\" does not exist", font_name); @@ -2236,7 +2237,7 @@ parse_text_node (GtkCssParser *parser, if (font == NULL) { - font = font_from_string (pango_cairo_font_map_get_default (), "Cantarell 11"); + font = font_from_string (pango_cairo_font_map_get_default (), "Cantarell 11", TRUE); g_assert (font); } diff --git a/testsuite/gsk/nodeparser/text-fail.errors b/testsuite/gsk/nodeparser/text-fail.errors index 66d41ec380..612c1ad4b5 100644 --- a/testsuite/gsk/nodeparser/text-fail.errors +++ b/testsuite/gsk/nodeparser/text-fail.errors @@ -1,3 +1,3 @@ -:3:11-12: error: GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE -:4:11-12: error: GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE +:4:3-7: error: GTK_CSS_PARSER_WARNING_SYNTAX :6:3-9: error: GTK_CSS_PARSER_WARNING_SYNTAX +:8:1-2: error: GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE diff --git a/testsuite/gsk/nodeparser/text-fail.ref.node b/testsuite/gsk/nodeparser/text-fail.ref.node index a2a4db5aea..404fb1b892 100644 --- a/testsuite/gsk/nodeparser/text-fail.ref.node +++ b/testsuite/gsk/nodeparser/text-fail.ref.node @@ -1,6 +1,4 @@ -text { - color: rgb(50,50,50); - font: "Cantarell 11"; - glyphs: "N"; - offset: 0 32.0186; +color { + bounds: 0 0 50 50; + color: rgb(255,0,204); } diff --git a/testsuite/gsk/nodeparser/text-font-errors.errors b/testsuite/gsk/nodeparser/text-font-errors.errors index 4388f69f3c..12b1720bcd 100644 --- a/testsuite/gsk/nodeparser/text-font-errors.errors +++ b/testsuite/gsk/nodeparser/text-font-errors.errors @@ -1,5 +1,4 @@ :21:32-36: error: GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE -:50:23-24: error: GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE :55:24-69:3: error: GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE :74:24-33: error: GTK_CSS_PARSER_ERROR_SYNTAX :79:24-38: error: g-io-error-quark 15 diff --git a/testsuite/gsk/nodeparser/text-font-errors.ref.node b/testsuite/gsk/nodeparser/text-font-errors.ref.node index ac0c32cea8..3e6df2c445 100644 --- a/testsuite/gsk/nodeparser/text-font-errors.ref.node +++ b/testsuite/gsk/nodeparser/text-font-errors.ref.node @@ -28,7 +28,7 @@ text { glyphs: "Hello"; } text { - font: "Cantarell 11"; + font: "Noto Sans 11"; glyphs: "Hello"; } text {