From 137f0c8cc64c72a7d1be07826bf9ffa8d62b55d3 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 12 Sep 2026 23:21:39 +0200 Subject: [PATCH] tdf#108243: semicolon separated fonts substitution pb (Linux/fontconfig) The pb was that a substitution for the nonexisting font was done and successful without taking into account a explicitely font provided. So before calling FindFontSubstitute, test nTokenPos to know if there's a substitute font. I started from https://bugs.documentfoundation.org/show_bug.cgi?id=108243#c13 but the root cause was found and a fix proposed by ChatGpt (GPT-5.6 Luna). I tested the initial odt file provided in the bugtracker it worked. I also did the same test without substitution font provided, it was ok too since it was replaced by a Noto font. Change-Id: I992d1ed5e4ebcf8795718001d17f8afda32e4735 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210680 Reviewed-by: Julien Nabet Tested-by: Jenkins --- vcl/source/font/PhysicalFontCollection.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx index d6eef30efa30..b3ebaf03a1ad 100644 --- a/vcl/source/font/PhysicalFontCollection.cxx +++ b/vcl/source/font/PhysicalFontCollection.cxx @@ -1139,7 +1139,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindFontFamily(FontSelectPattern& rF return pFoundData; } - if (mpPreMatchHook && mpPreMatchHook->FindFontSubstitute(rFSD)) + if (nTokenPos == -1 && mpPreMatchHook && mpPreMatchHook->FindFontSubstitute(rFSD)) { rFSD.maSearchName = GetEnglishSearchFontName(rFSD.maSearchName); }