Skip to content

Commit

Permalink
[FreeType] Do not special case the "sans" font family name
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=265182

Reviewed by Carlos Garcia Campos.

Do not consider "sans" a generic font family name, as it is not one
according to the CSS spec. This avoids shortcuts in the font matching
algorithm, which leads to picking a better font fallbacks instead if
the FontConfig configuration has odd bits like symbol fonts listed as
preferred in order to make sure symbols (e.g. emoji or PUA glyphs)
from it picked preferably to symbols from the actual font to be used.

* Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp:
(WebCore::isCommonlyUsedGenericFamily): Remove match on the "sans" font
family name.

Canonical link: https://commits.webkit.org/271007@main
  • Loading branch information
aperezdc committed Nov 21, 2023
1 parent fea7b07 commit 9479bf3
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,7 @@ static bool areStronglyAliased(const String& familyA, const String& familyB)

static inline bool isCommonlyUsedGenericFamily(const String& familyNameString)
{
return equalLettersIgnoringASCIICase(familyNameString, "sans"_s)
|| equalLettersIgnoringASCIICase(familyNameString, "sans-serif"_s)
return equalLettersIgnoringASCIICase(familyNameString, "sans-serif"_s)
|| equalLettersIgnoringASCIICase(familyNameString, "serif"_s)
|| equalLettersIgnoringASCIICase(familyNameString, "monospace"_s)
|| equalLettersIgnoringASCIICase(familyNameString, "fantasy"_s)
Expand Down

0 comments on commit 9479bf3

Please sign in to comment.