From 603d87c9783150818f49e3929baece123d4e5026 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Fri, 20 Dec 2024 20:01:06 +0100 Subject: [PATCH] Fix local font matching algorithm We want to check that the name in local() is exactly the same as the local font, not only included in it. Fix #2335. --- weasyprint/text/fonts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weasyprint/text/fonts.py b/weasyprint/text/fonts.py index aad787731..1fb305600 100644 --- a/weasyprint/text/fonts.py +++ b/weasyprint/text/fonts.py @@ -144,7 +144,7 @@ def add_font_face(self, rule_descriptors, url_fetcher): for tag in b'fullname', b'postscriptname': fontconfig.FcPatternGetString(matching_pattern, tag, 0, string) name = ffi.string(string[0]) - if font_name.lower() in name.lower(): + if font_name.lower() == name.lower(): fontconfig.FcPatternGetString( matching_pattern, b'file', 0, string) path = ffi.string(string[0]).decode(FILESYSTEM_ENCODING)