Prioritize fonts that support a territory-less language variant when no exact language match
Submitted by Caolán McNamara
Assigned to fon..@..op.org
Created attachment 44237 implement suggestion
When fontconfig matches by language tag, and the language tag supplied does not match exactly a known fontconfig language tag then fontconfig considers a list of all fonts that provide support for at least a variant language of the language tag.
It doesn't however prioritize fonts that support a territory-less variant, which is likely the best one to use under these circumstances.
i.e. practically fc-match :lang=pa-IN will generate a list of "pa" fonts and "pa-pk" fonts and fairly arbitrarily return one of that list. so for me I get "Droid Sans Arabic" because that supports "pa-pk", but anything that provided just "pa" would be a better choice.
Attached is an implementation to effectively sort "xx" before "xx-*" when no exact "xx-yy" was found.
Patch 44237, "implement suggestion":