From 92d88e2d10c833898da9d8b1afae55fea5606037 Mon Sep 17 00:00:00 2001 From: Kamil Jarosz Date: Sat, 30 Nov 2024 21:43:06 +0100 Subject: [PATCH] text: Do not show text that's missing an embedded font Flash Player does not show any text that requires an embedded font that is missing. --- core/src/html/layout.rs | 8 ++++---- .../embed_matching/no_font_found/test.toml | 1 - .../fonts/font_lookup_as3/output.expected.png | Bin 14543 -> 6062 bytes 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/core/src/html/layout.rs b/core/src/html/layout.rs index 73f92c074b73..e0082225c752 100644 --- a/core/src/html/layout.rs +++ b/core/src/html/layout.rs @@ -660,10 +660,10 @@ impl<'a, 'gc> LayoutContext<'a, 'gc> { { return font; } - // TODO: If set to use embedded fonts and we couldn't find any matching font, show nothing - // However - at time of writing, we don't support DefineFont4. If we matched this behaviour, - // then a bunch of SWFs would just show no text suddenly. - // return new_empty_font(context, span, self.font_type); + + // If set to use embedded fonts and we couldn't find any matching font, show nothing. + tracing::warn!("Embedded font not found: {font_name}, using an empty font"); + return new_empty_font(context, span, self.font_type); } // Check if the font name is one of the known default fonts. diff --git a/tests/tests/swfs/fonts/embed_matching/no_font_found/test.toml b/tests/tests/swfs/fonts/embed_matching/no_font_found/test.toml index 79c486db198e..1d1205f06dc8 100644 --- a/tests/tests/swfs/fonts/embed_matching/no_font_found/test.toml +++ b/tests/tests/swfs/fonts/embed_matching/no_font_found/test.toml @@ -1,7 +1,6 @@ # There are no fonts embedded in this swf. It should not render anything at all, or error. num_frames = 1 -known_failure = true # Right now we intentionally fall back, because we don't support DefineFont4 embedded fonts yet [image_comparisons.output] tolerance = 0 diff --git a/tests/tests/swfs/visual/fonts/font_lookup_as3/output.expected.png b/tests/tests/swfs/visual/fonts/font_lookup_as3/output.expected.png index eb0809b9908e61abb7075d7313d0235a961a49f3..0ffa47eb59e431961c927a2c3d0483a5a444fef5 100644 GIT binary patch literal 6062 zcmeHLXIN9|w*EqqqBO-8B!CDCf?xp!CJ@1)1q&IP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